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

Exception in finalizer: can't be called from trap context #1559

Closed
denisdefreyne opened this issue Jan 8, 2022 · 1 comment · Fixed by #1564
Closed

Exception in finalizer: can't be called from trap context #1559

denisdefreyne opened this issue Jan 8, 2022 · 1 comment · Fixed by #1564

Comments

@denisdefreyne
Copy link
Member

denisdefreyne commented Jan 8, 2022

Steps to reproduce

Run nanoc or its tests.

Expected behavior

No error

Actual behavior

The following error is shown, though compilation success as normal:

2022-01-08T10:57:21.8860000Z /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:129: warning: Exception in finalizer #<Proc:0x00007f6e1808a5b0 /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/ref-2.0.0/lib/ref/soft_reference.rb:28 (lambda)>
10
/home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/ref-2.0.0/lib/ref/soft_reference.rb:29:in `synchronize': can't be called from trap context (ThreadError)
11
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/ref-2.0.0/lib/ref/soft_reference.rb:29:in `block in <class:SoftReference>'
12
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:129:in `is_a?'
13
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:129:in `parse_data'
14
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:264:in `block in parse_properties'
15
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:263:in `each'
16
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:263:in `parse_properties'
17
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:350:in `parse_schema'
18
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:140:in `parse_data'
19
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:33:in `parse'
20
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema/parser.rb:42:in `parse!'
21
	from /home/runner/work/nanoc/nanoc/vendor/bundle/ruby/3.1.0/gems/json_schema-0.21.0/lib/json_schema.rb:29:in `parse!'
22
	from /home/runner/work/nanoc/nanoc/nanoc-core/lib/nanoc/core/configuration.rb:198:in `validate'
23
	from /home/runner/work/nanoc/nanoc/nanoc-core/lib/nanoc/core/configuration.rb:53:in `initialize'
24
	from /home/runner/work/nanoc/nanoc/nanoc-core/lib/nanoc/core/configuration.rb:63:in `new'
25
	from /home/runner/work/nanoc/nanoc/nanoc-core/lib/nanoc/core/configuration.rb:63:in `with_defaults'
@denisdefreyne
Copy link
Member Author

Here’s a single test case that exhibits the problem:

cd nanoc-core
bundle exec rspec --format=documentation spec/nanoc/core/identifiable_collection_spec.rb:68
      context 'frozen' do
        before { identifiable_collection.freeze }

        example do
          expect(identifiable_collection['/one']).to equal(objects[0])
          expect(identifiable_collection['/fifty']).to be_nil
        end
      end

It appears that #freeze in particular causes this issue.

Will continue investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant