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

Dry::Container::Error: There is already an item registered with the key "nominal.string" on jruby-head #431

Closed
dblock opened this issue Dec 27, 2021 · 4 comments

Comments

@dblock
Copy link

dblock commented Dec 27, 2021

Describe the bug

This is probably a jruby + dry-container problem. Decided I'd report it here because it's more likely to be found here by the next person and maybe someone can recommend how to fix it? The repro also needs to be reduced to this gem only before opening that bug. Maybe add jruby-head to CI?

Coming from https://github.com/ruby-grape/grape/runs/4645390152?check_suite_focus=true, dry-types is failing on jruby-head.

/home/runner/.rubies/jruby-head/bin/jruby -I/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/rspec-core-3.10.1/lib:/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/rspec-support-3.10.3/lib /home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\*\*/\*_spec.rb  --exclude-pattern spec/integration/\*\*/\*_spec.rb
/home/runner/.rubies/jruby-head/lib/ruby/stdlib/time.rb:3: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::IDENTITY

/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::Undefined
An error occurred while loading ./spec/grape/api/custom_validations_spec.rb. - Did you mean?
                    rspec ./spec/grape/exceptions/validation_spec.rb
                    rspec ./spec/grape/dsl/validations_spec.rb
                    rspec ./spec/grape/validations_spec.rb

Failure/Error: require 'dry-types'

LoadError:
  load error: dry/types/core -- java.lang.NullPointerException: null
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types.rb:231:in `<main>'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry-types.rb:3:in `<main>'
# ./lib/grape/validations/types/dry_type_coercer.rb:3:in `<main>'
# ./lib/grape/validations/types/array_coercer.rb:3:in `<main>'
# ./lib/grape/validations/types/build_coercer.rb:3:in `<main>'
# ./lib/grape/validations/types.rb:3:in `<main>'
# ./vendor/bundle/jruby/3.0.0/gems/activesupport-7.0.0/lib/active_support/dependencies/autoload.rb:72:in `block in eager_load!'
# ./vendor/bundle/jruby/3.0.0/gems/activesupport-7.0.0/lib/active_support/dependencies/autoload.rb:72:in `eager_load!'
# ./spec/support/eager_load.rb:14:in `block in eager_load!'
# ./spec/support/eager_load.rb:9:in `eager_load!'
# ./spec/spec_helper.rb:26:in `<main>'
# ./spec/grape/api/custom_validations_spec.rb:3:in `<main>'
# ------------------
# --- Caused by: ---
# Java::JavaLang::NullPointerException:
#   org.jruby.dist/org.jruby.ir.operands.Hash.retrieve(Hash.java:132)

An error occurred while loading ./spec/grape/api/deeply_included_options_spec.rb.
Failure/Error: require 'dry-types'

Dry::Container::Error:
  There is already an item registered with the key "nominal.string"
# ./vendor/bundle/jruby/3.0.0/gems/dry-container-0.9.0/lib/dry/container/registry.rb:38:in `block in call'
# ./vendor/bundle/jruby/3.0.0/gems/dry-container-0.9.0/lib/dry/container/registry.rb:36:in `call'
# ./vendor/bundle/jruby/3.0.0/gems/dry-container-0.9.0/lib/dry/container/mixin.rb:105:in `register'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types.rb:78:in `register'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:51:in `block in Types'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:49:in `<module:Types>'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:6:in `<module:Dry>'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:5:in `<main>'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types.rb:231:in `<main>'
# ./vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry-types.rb:3:in `<main>'
# ./lib/grape/validations/types/dry_type_coercer.rb:3:in `<main>'
# ./lib/grape/validations/types/array_coercer.rb:3:in `<main>'
# ./lib/grape/validations/types/build_coercer.rb:3:in `<main>'
# ./lib/grape/validations/types.rb:3:in `<main>'
# ./vendor/bundle/jruby/3.0.0/gems/activesupport-7.0.0/lib/active_support/dependencies/autoload.rb:72:in `block in eager_load!'
# ./vendor/bundle/jruby/3.0.0/gems/activesupport-7.0.0/lib/active_support/dependencies/autoload.rb:72:in `eager_load!'
# ./spec/support/eager_load.rb:14:in `block in eager_load!'
# ./spec/support/eager_load.rb:9:in `eager_load!'
# ./spec/spec_helper.rb:26:in `<main>'
# ./spec/grape/api/deeply_included_options_spec.rb:3:in `<main>'
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_ARRAY
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_HASH
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_STRING
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_SET
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_OPTS
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::Self
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types.rb:35: warning: already initialized constant Dry::Types::TYPE_SPEC_REGEX
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:15: warning: already initialized constant Dry::Types::KERNEL_COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:20: warning: already initialized constant Dry::Types::METHOD_COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:25: warning: already initialized constant Dry::Types::METHOD_COERCIBLE_METHODS
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:37: warning: already initialized constant Dry::Types::NON_COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:40: warning: already initialized constant Dry::Types::ALL_PRIMITIVES
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:43: warning: already initialized constant Dry::Types::COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:46: warning: already initialized constant Dry::Types::NON_NIL
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::IDENTITY
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::Undefined
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_ARRAY
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_HASH
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_STRING
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_SET
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_OPTS
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::Self
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types.rb:35: warning: already initialized constant Dry::Types::TYPE_SPEC_REGEX
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:15: warning: already initialized constant Dry::Types::KERNEL_COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:20: warning: already initialized constant Dry::Types::METHOD_COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:25: warning: already initialized constant Dry::Types::METHOD_COERCIBLE_METHODS
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:37: warning: already initialized constant Dry::Types::NON_COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:40: warning: already initialized constant Dry::Types::ALL_PRIMITIVES
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:43: warning: already initialized constant Dry::Types::COERCIBLE
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types/core.rb:46: warning: already initialized constant Dry::Types::NON_NIL
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::IDENTITY
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::Undefined
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_ARRAY
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_HASH
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_STRING
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_SET
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::EMPTY_OPTS
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-core-0.7.1/lib/dry/core/constants.rb:112: warning: already initialized constant Dry::Types::Self
/home/runner/work/grape/grape/vendor/bundle/jruby/3.0.0/gems/dry-types-1.5.1/lib/dry/types.rb:35: warning: already initialized constant Dry::Types::TYPE_SPEC_REGEX

To Reproduce

git clone git@github.com:dblock/grape.git
cd grape
git checkout efc25f2495f03b36c82f64ea3951cbf325df6e3b
rvm use jruby-head 
rake

https://github.com/jruby/jruby.git @ 5134c73021.

My environment

~/source/opensearch-project$ ruby --version
jruby 9.4.0.0-SNAPSHOT (3.0.2) 2021-12-27 5134c73021 OpenJDK 64-Bit Server VM 14.0.2+12-Ubuntu-120.04 on 14.0.2+12-Ubuntu-120.04 +jit [linux-x86_64]
@flash-gordon
Copy link
Member

Some code seems to get loaded twice, dry-types specifically. I don't think dry-container or dry-types has anything to do with it. I can run dry-types against jruby-head though, 1 sec.

@flash-gordon
Copy link
Member

ok, it fails with a NPE :) I'll move the issue there. We don't run against head branches on purpose, it takes more time to have a tested build/PR. Issues like this happen very occasionally.

@flash-gordon
Copy link
Member

Filed an issue to JRuby jruby/jruby#6980

@flash-gordon
Copy link
Member

OK, that was fixed but tests against jruby-head now fail for another reason https://github.com/dry-rb/dry-types/runs/4798757164?check_suite_focus=true I'm not going to fix them, though until jruby is close to the release.

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

No branches or pull requests

2 participants