Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap dumping for debugging GC or VM binding #805

Open
wks opened this issue May 6, 2023 · 0 comments
Open

Heap dumping for debugging GC or VM binding #805

wks opened this issue May 6, 2023 · 0 comments
Labels
C-feature Category: Feature P-normal Priority: Normal.

Comments

@wks
Copy link
Collaborator

wks commented May 6, 2023

Note: This is a sub-task of #803 for debugging

Scope

This PR is about GC-time heap dumping for debugging.

The requirement is different from user-visible heap traversing API, such as JVM TI and Ruby's ObjectSpace. Those APIs are for users to enumerate objects of certain kinds, or children of certain objects. They expect the GC to be bug-free, otherwise they will not work. But this PR is intended for helping us debugging buggy GC algorithms or buggy VM bindings.

The heap dumping mentioned in this PR shall happen during GC. It may include both

  • enumerating objects (live of dead) using the valid-object bit (VO bit), and
  • enumerating objects (live only) using transitive closure.

They should complement each other, and the discrepancies between them may reveal bugs.

"Broken edges" problem

Currently, if any edge (root or field) contains a dangling pointer, the GC will either crash with SIGSEGV or result in an assertion failure. This is too fast, because when we are debugging, we want to dump as many objects as possible so that we can get a "big picture" of the VM state.

To solve this problem, we can let object tracing "fail slow". When tracing an edge (root or field), we can use the VO bit to check whether it points to a valid object or not. If not, it should record the "broken" edge instead of crashing. It shall write the heap dump into a file before panicking if there are any broken edges.

This feature is costly because it requires a VO-bit check for every edge. So it should be able to be turned off at compile time. We can make it a Cargo feature because it also depends on the vo_bit Cargo feature.

@wks wks changed the title "Fail-slow mode" for debugging Heap dumping for debugging GC or VM binding May 9, 2023
@k-sareen k-sareen added C-feature Category: Feature P-normal Priority: Normal. labels Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: Feature P-normal Priority: Normal.
Projects
None yet
Development

No branches or pull requests

2 participants