Giter VIP home page Giter VIP logo

Comments (8)

gillesbergerp avatar gillesbergerp commented on July 29, 2024

I completely overlooked that Mongoid is only officially compatible with ruby 3.2 from version 8.1.
I'll give that a try

https://www.mongodb.com/docs/mongoid/current/reference/compatibility/#ruby-compatibility

from truffleruby.

gillesbergerp avatar gillesbergerp commented on July 29, 2024

mongoid-8.1 with truffleruby-jvm-24.0.1 results in the same behavior

from truffleruby.

gillesbergerp avatar gillesbergerp commented on July 29, 2024

I was able to produce an example of a (maybe?) related issue:

class Foo
  include(Mongoid::Document)

  field(:bar, type: Array)
end

foo = Foo.create!
foo.set(bar: [DateTime.now]) # works
foo.set(bar: foo.bar + [DateTime.now]) # works
foo.set(bar: (foo.bar << DateTime.now)) # throws

The last line results in

Cannot invoke "org.truffleruby.cext.ValueWrapperManager$ValueWrapperWeakReferenc
e.get()" because "this.wrappers[offset]" is null (java.lang.NullPointerException
)
        from org.truffleruby.cext.ValueWrapperManager$HandleBlock.getWrapper(Val
ueWrapperManager.java:234)
        from org.truffleruby.cext.ValueWrapperManager.getWrapperFromHandleMap(Va
lueWrapperManager.java:109)
        from org.truffleruby.cext.UnwrapNode$UnwrapNativeNode.unwrapTaggedObject
(UnwrapNode.java:89)
        from org.truffleruby.cext.UnwrapNodeGen$UnwrapNativeNodeGen$Inlined.exec
uteAndSpecialize(UnwrapNodeGen.java:421)
        from org.truffleruby.cext.UnwrapNodeGen$UnwrapNativeNodeGen$Inlined.exec
ute(UnwrapNodeGen.java:387)
        from org.truffleruby.cext.UnwrapNode.longToWrapper(UnwrapNode.java:270)
        from org.truffleruby.cext.UnwrapNodeGen$Inlined.executeAndSpecialize(Unw
rapNodeGen.java:183)
        from org.truffleruby.cext.UnwrapNodeGen$Inlined.execute(UnwrapNodeGen.ja
va:158)
        from org.truffleruby.core.array.library.NativeArrayStorage.read(NativeAr
rayStorage.java:98)
        from org.truffleruby.core.array.library.NativeArrayStorageGen$ArrayStore
LibraryExports$Cached.read(NativeArrayStorageGen.java:249)
        from org.truffleruby.core.array.ArrayEachIteratorNode.iterateMany(ArrayE
achIteratorNode.java:66)
        from org.truffleruby.core.array.ArrayEachIteratorNodeGen$Inlined.execute
AndSpecialize(ArrayEachIteratorNodeGen.java:497)
        from org.truffleruby.core.array.ArrayEachIteratorNodeGen$Inlined.execute
(ArrayEachIteratorNodeGen.java:447)
        from org.truffleruby.core.array.ArrayNodes$MapNode.map(ArrayNodes.java:1
455)
        from org.truffleruby.core.array.ArrayNodesFactory$MapNodeFactory$MapNode
Gen.executeAndSpecialize(ArrayNodesFactory.java:10161)
        from org.truffleruby.core.array.ArrayNodesFactory$MapNodeFactory$MapNode
Gen.execute(ArrayNodesFactory.java:10150)
        from org.truffleruby.builtins.EnumeratorSizeNode.execute(EnumeratorSizeN
ode.java:56)
        from org.truffleruby.language.RubyCoreMethodRootNode.execute(RubyCoreMet
hodRootNode.java:58)
/usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/extensions/array.rb:152:in `map
'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/extensions/array.r
b:152:in `mongoize'
        from /usr/local/lib/mri/forwardable.rb:240:in `mongoize'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/attributes.rb:285:
in `typed_value_for'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/attributes.rb:175:
in `block in write_attribute'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/threaded/lifecycle
.rb:30:in `_assigning'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/attributes.rb:172:
in `write_attribute'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/fields.rb:691:in `
bar='
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/attributes/process
ing.rb:122:in `process_attribute'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/persistable/settab
le.rb:82:in `block (2 levels) in set'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/persistable.rb:208
:in `block in process_atomic_operations'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/persistable.rb:206
:in `each'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/persistable.rb:206
:in `process_atomic_operations'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/persistable/settab
le.rb:49:in `block in set'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/persistable.rb:186
:in `prepare_atomic_operation'
        from /usr/local/bundle/gems/mongoid-8.1.5/lib/mongoid/persistable/settab
le.rb:48:in `set'
        from (irb):10:in `<top (required)>'
        from /usr/local/lib/mri/irb/workspace.rb:119:in `evaluate'
        from /usr/local/lib/mri/irb/context.rb:502:in `evaluate'
        from /usr/local/lib/mri/irb.rb:588:in `block (2 levels) in eval_input'
        from /usr/local/lib/mri/irb.rb:777:in `signal_status'
        from /usr/local/lib/mri/irb.rb:567:in `block in eval_input'
        from /usr/local/lib/mri/irb/ruby-lex.rb:267:in `block (2 levels) in each
_top_level_statement'
        from <internal:core> core/kernel.rb:409:in `loop'
        from /usr/local/lib/mri/irb/ruby-lex.rb:249:in `block in each_top_level_
statement'
        from <internal:core> core/throw_catch.rb:36:in `catch'
        from /usr/local/lib/mri/irb/ruby-lex.rb:248:in `each_top_level_statement
'
        from /usr/local/lib/mri/irb.rb:566:in `eval_input'
        from /usr/local/lib/mri/irb.rb:500:in `block in run'
        from <internal:core> core/throw_catch.rb:36:in `catch'
        from /usr/local/lib/mri/irb.rb:499:in `run'
        from /usr/local/lib/mri/irb.rb:421:in `start'
        from /usr/local/bundle/gems/railties-6.1.7.7/lib/rails/commands/console/
console_command.rb:70:in `start'
        from /usr/local/bundle/gems/railties-6.1.7.7/lib/rails/commands/console/
console_command.rb:19:in `start'
        from /usr/local/bundle/gems/railties-6.1.7.7/lib/rails/commands/console/
console_command.rb:102:in `perform'
        from /usr/local/bundle/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
        from /usr/local/bundle/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `in
voke_command'
        from /usr/local/bundle/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
        from /usr/local/bundle/gems/railties-6.1.7.7/lib/rails/command/base.rb:6
9:in `perform'
        from /usr/local/bundle/gems/railties-6.1.7.7/lib/rails/command.rb:48:in
`invoke'
        from /usr/local/bundle/gems/railties-6.1.7.7/lib/rails/commands.rb:18:in
 `<top (required)>'
        from <internal:core> core/kernel.rb:229:in `gem_original_require'
        from <internal:/usr/local/lib/mri/rubygems/core_ext/kernel_require.rb>:3
7:in `require'
        from /workspace/bin/rails:4:in `<main>'

from truffleruby.

eregon avatar eregon commented on July 29, 2024

Thank you for the report, could you try with truffleruby+graalvm-dev (e.g. available in ruby-build or here)?
There have been some C extension fixes on master but not yet in a release related to dead handles errors like the ones above.

from truffleruby.

gillesbergerp avatar gillesbergerp commented on July 29, 2024

Using the latest dev version yields the same result

from truffleruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.