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

show mark-queue on GC critical error #49902

Merged
merged 2 commits into from
May 22, 2023
Merged

show mark-queue on GC critical error #49902

merged 2 commits into from
May 22, 2023

Conversation

d-netto
Copy link
Member

@d-netto d-netto commented May 20, 2023

Re-adds the capability of showing the mark-queue on a GC critical error.

Example:

a = Ref(1)
ptr = pointer_from_objref(a) - 8
unsafe_store!(Ptr{Int}(ptr), ptr)
GC.gc()

produces:

GC error (probable corruption)
Allocations: 15137 (Pool: 15119; Big: 18); GC: 0
Core.ReturnNode(val=SSAValue(1))

thread 0 ptr queue:
~~~~~~~~~~ ptr queue top ~~~~~~~~~~
...
Core.Binding(value=#<null>, globalref=Main.:(+), owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.println, owner=Core.Binding(value=Base.println, globalref=Base.println, owner=<circular reference @-1>, ty=#<null>, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.print, owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.stdout, owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.:(=>), owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.IOContext, owner=Core.Binding(value=Base.IOContext{IO_t} where IO_t<:IO, globalref=Base.IOContext, owner=<circular reference @-1>, ty=Any, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.:(/), owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.show, owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.DEPOT_PATH, owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.Sys, owner=Core.Binding(value=Base.Sys, globalref=Base.Sys, owner=<circular reference @-1>, ty=#<null>, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.Int64, owner=#<null>, ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.:(@warn), owner=Core.Binding(value=Base.CoreLogging.var"@warn", globalref=Base.CoreLogging.:(@warn), owner=<circular reference @-1>, ty=#<null>, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.Threads, owner=Core.Binding(value=Base.Threads, globalref=Base.Threads, owner=<circular reference @-1>, ty=#<null>, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.:(!=), owner=Core.Binding(value=Base.:(!=), globalref=Base.:(!=), owner=<circular reference @-1>, ty=#<null>, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.:(!==), owner=Core.Binding(value=Base.:(!==), globalref=Base.:(!==), owner=<circular reference @-1>, ty=#<null>, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.IOBuffer, owner=Core.Binding(value=Base.GenericIOBuffer{Array{UInt8, 1}}, globalref=Base.IOBuffer, owner=<circular reference @-1>, ty=Any, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=#<null>, globalref=Main.time_ns, owner=Core.Binding(value=Base.time_ns, globalref=Base.time_ns, owner=<circular reference @-1>, ty=#<null>, flags=0x03), ty=#<null>, flags=0x00)
==========
Core.Binding(value=Main.var"#1#2"{pre_output_time} where pre_output_time, globalref=Main.:(#1#2), owner=<circular reference @-1>, ty=Any, flags=0x01)
==========
Core.Binding(value=#<null>, globalref=Main.Ref, owner=Core.Binding(value=Ref{T} where T, globalref=Core.Ref, owner=<circular reference @-1>, ty=Any, flags=0x03), ty=#<null>, flags=0x00)
==========
~~~~~~~~~~ ptr queue bottom ~~~~~~~~~~

@d-netto d-netto added the GC Garbage collector label May 20, 2023
Copy link
Sponsor Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation seems fine. Though I think this is never actually a stack now of the parent path (as it once was), so I don't know if this still comes in useful?

@d-netto
Copy link
Member Author

d-netto commented May 22, 2023

It's no longer a path from parent to corrupted object.

Having some information about siblings of corrupted object would be better than nothing IMO.

@d-netto d-netto added the merge me PR is reviewed. Merge when all tests are passing label May 22, 2023
@d-netto d-netto merged commit 944b28c into master May 22, 2023
@d-netto d-netto deleted the dcn/gc-critical-error branch May 22, 2023 19:29
@oscardssmith oscardssmith removed the merge me PR is reviewed. Merge when all tests are passing label May 22, 2023
d-netto added a commit to RelationalAI/julia that referenced this pull request Sep 18, 2023
d-netto pushed a commit to RelationalAI/julia that referenced this pull request Sep 18, 2023
…ng#49741)

* Attempting to add debug logs for ENQUEUING an invalid object

Check for the object's validity _before enqueuing_
so that we can hopefully give a more useful error message (which
object's pointer was corrupted).

---------

Co-authored-by: Diogo Netto <diogonetto.dcn@gmail.com>

show mark-queue on GC critical error (JuliaLang#49902)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GC Garbage collector
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants