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

Don't try to marshal non-serializable variables #7739

Merged
merged 2 commits into from
Mar 29, 2023

Conversation

headius
Copy link
Member

@headius headius commented Mar 29, 2023

This fixes #7734 by not confusing the finalizer with marshalable state.

This avoids marshaling the __finalizer__ slot and any other
internal state that is not serializable.

Fixes jruby#7734
@headius headius added this to the JRuby 9.4.3.0 milestone Mar 29, 2023
@headius headius merged commit 0b5918c into jruby:master Mar 29, 2023
43 of 47 checks passed
@headius headius deleted the no_marshal_finalizer branch March 29, 2023 21:33

it "dumps without marshaling any attached finalizer" do
obj = Object.new
ObjectSpace.define_finalizer(obj, &:itself)
Copy link
Member

Choose a reason for hiding this comment

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

FYI this causes:

1)
Marshal.dump with an Object dumps without marshaling any attached finalizer ERROR
ArgumentError: Can't create Binding from C level Proc
/home/eregon/code/rubyspec/core/marshal/dump_spec.rb:464:in `define_finalizer'
/home/eregon/code/rubyspec/core/marshal/dump_spec.rb:464:in `block (3 levels) in <top (required)>'
/home/eregon/code/rubyspec/core/marshal/dump_spec.rb:6:in `<top (required)>'
[| | ==================100%================== | 00:00:00]      0F      1E 

on CRuby 3.0+. Just on 2.7 it seems to work.
I modified the spec a bit to make it work on all CRuby versions: ruby/spec@d44cd79

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.

Object with finalizer dumps wrong data leading to: load': marshal data too short
2 participants