Skip to content

Clear errinfo after each finalizer runs#7288

Merged
headius merged 1 commit intojruby:jruby-9.3from
headius:clear_errinfo_after_finalize
Aug 9, 2022
Merged

Clear errinfo after each finalizer runs#7288
headius merged 1 commit intojruby:jruby-9.3from
headius:clear_errinfo_after_finalize

Conversation

@headius
Copy link
Member

@headius headius commented Aug 4, 2022

In #7267 we had a report of endless exception cause processing
that turned out to be triggered by a bad finalizer (that allowed
an exception to bubble out) stacking up causes from previous calls
of that finalizer.

The fix here mimics what CRuby does: where they reset the errinfo
to what it was prior to the finalizer running (because CRuby's GC
often/usually runs on the current user thread), we simply clear it
after each finalizer has run (because the JDK runs finalizers on
a separate thread, as will our future non-JVM-finalizer version of
this logic).

No spec is provided yet due to the difficulty of testing
GC-triggered events across VMs. See ruby/spec#935
for more details.

Fixes #7267

@headius headius added this to the JRuby 9.3.7.0 milestone Aug 4, 2022
In jruby#7267 we had a report of endless exception cause processing
that turned out to be triggered by a bad finalizer (that allowed
an exception to bubble out) stacking up causes from previous calls
of that finalizer.

The fix here mimics what CRuby does: where they reset the errinfo
to what it was prior to the finalizer running (because CRuby's GC
often/usually runs on the current user thread), we simply clear it
after each finalizer has run (because the JDK runs finalizers on
a separate thread, as will our future non-JVM-finalizer version of
this logic).

No spec is provided yet due to the difficulty of testing
GC-triggered events across VMs. See ruby/spec#935
for more details.

Fixes jruby#7267
@headius headius force-pushed the clear_errinfo_after_finalize branch from 24353f4 to 238bcbd Compare August 9, 2022 15:45
@headius headius merged commit 629c099 into jruby:jruby-9.3 Aug 9, 2022
@headius headius deleted the clear_errinfo_after_finalize branch August 9, 2022 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant