-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[logcat-parse] Support repeated handles. (#35)
I've come across some log files which would contain *several thousand* global references, as per the `grefc` values, but when processing via logcat-parse `grefs.AlivePeers.Count()` would invariably return `11`, or some other ludicrously low value given the input. On further investigation, a problem is with repeated handle values. Once a handle has been disposed, there's no reason why it couldn't be reused again: +g+ grefc 1 gwrefc 0 obj-handle 0x4a00009/L -> new-handle 0x19004aa/G from thread '(null)'(3) -g- grefc 0 gwrefc 0 handle 0x19004aa/G from thread '(null)'(3) # OK, created + destroyed an instance... +g+ grefc 1 gwrefc 0 obj-handle 0x4a00009/L -> new-handle 0x19004aa/G from thread '(null)'(3) # OK, created a *different* instance Unfortunately, `logcat-parse` would treat the second +g+ as if it were an alias of the originally created instance. As such, `grefs.AlivePeers.Count()` would return 0, not 1, which is wrong. To better support this, keep a separate `alive` list of peers, and only consult the "alive" list when performing handle lookups. This prevents the original -- dead! -- PeerInfo from being reused, allowing us to have (more?) accurate peer information.
- Loading branch information
1 parent
a9312d2
commit c37e029
Showing
5 changed files
with
74 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
tools/logcat-parse/Tests/Resources/stdio-repeated-handles.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
+g+ grefc 1 gwrefc 0 obj-handle 0x4a00009/L -> new-handle 0x19004aa/G from thread '(null)'(3) | ||
at Doesn't Matter | ||
handle 0x19004aa; key_handle 0x41e29778: Java Type: `java/lang/String`; MCW type: `Java.Lang.String` | ||
Disposing handle 0x19004aa | ||
-g- grefc 0 gwrefc 0 handle 0x19004aa/G from thread '(null)'(3) | ||
at Doesn't Matter | ||
+g+ grefc 1 gwrefc 0 obj-handle 0x4a00009/L -> new-handle 0x19004aa/G from thread '(null)'(3) | ||
at Doesn't Matter | ||
handle 0x19004aa; key_handle 0x41e29778: Java Type: `java/lang/String`; MCW type: `Java.Lang.String` |