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

json 2.7.3 has broken my test environment #646

Closed
david22swan opened this issue Oct 24, 2024 · 6 comments
Closed

json 2.7.3 has broken my test environment #646

david22swan opened this issue Oct 24, 2024 · 6 comments

Comments

@david22swan
Copy link

Hey, sorry to bother but have had issues with the newest release of the Gem with the below error blocking my test development:

An error occurred while loading ./spec/acceptance/set_config_spec.rb.
On host `localhost:52362'
Failure/Error: require 'json'
ArgumentError:
  wrong number of arguments (given 1, expected 0)

# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json/common.rb:82:in `initialize'
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json/common.rb:82:in `new'
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json/common.rb:82:in `create_fast_state'
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json/common.rb:75:in `generator='
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json/ext.rb:11:in `<module:Ext>'
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json/ext.rb:6:in `<module:JSON>'
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json/ext.rb:3:in `<top (required)>'
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json.rb:579:in `<module:JSON>'
# ./.bundle/ruby/3.2.0/gems/json_pure-2.6.3/lib/json.rb:575:in `<top (required)>'
# ./spec/spec_helper_acceptance.rb:8:in `<top (required)>'
# ./spec/acceptance/set_config_spec.rb:1:in `<top (required)>'

Was able to resolve this by pinning the json gem itself to 2.7.2 so can confirm the issue is with the new release, and thought I should shout out incase anyone else has gotten hit with it.
Unsure of the actual cause of the error, or if it has something to do with us using json_pure and json being pulled in from another dependency.

@byroot
Copy link
Member

byroot commented Oct 24, 2024

Ah yes, json_pure and json need to be at the same version if both are co-existing.

@david22swan
Copy link
Author

Was able to fix the issue with them different though.
Fixed it by pinning json to 2.7.2 while json_pure was still pinned to 2.6.3?

@byroot
Copy link
Member

byroot commented Oct 24, 2024

Yes, some version mix can sometime work, but they are only guaranteed to work if the version matches.

Unfortunately the json_pure 2.7.3 release is delayed for technical reasons, but it should be released some time next week: #640

So I'll close, as the failure is unfortunately expected.

@casperisfine
Copy link

Someone else reported a similar issue, and after investigation it's caused by a rubygems bug: rubygems/rubygems#6490

Upgrading rubygems solves it gem update --system

casperisfine pushed a commit to casperisfine/json that referenced this issue Oct 25, 2024
Fix: ruby#646

Since both `json` and `json_pure` expose the same files, if the
versions don't match, the native extension may be loaded with Ruby
code that don't match and is incompatible.

By doing the `require json/ext/generator/state` from C we ensure
we're at least loading that.

But this is a dirty workaround for the 2.7.x branch, we should
find a better way to fully isolate the two gems.
@casperisfine
Copy link

Actually, ignore the above, it's the same problem but a different trigger.

I'm working on a workaround in #648 so that hopefully 2.7.4 will work OK even if loaded with a different version of json_pure, but long term I'm hoping to find a better fix.

casperisfine pushed a commit to casperisfine/json that referenced this issue Oct 25, 2024
Fix: ruby#646

Since both `json` and `json_pure` expose the same files, if the
versions don't match, the native extension may be loaded with Ruby
code that don't match and is incompatible.

By doing the `require json/ext/generator/state` from C we ensure
we're at least loading that.

But this is a dirty workaround for the 2.7.x branch, we should
find a better way to fully isolate the two gems.
casperisfine pushed a commit to casperisfine/json that referenced this issue Oct 25, 2024
Fix: ruby#646

Since both `json` and `json_pure` expose the same files, if the
versions don't match, the native extension may be loaded with Ruby
code that don't match and is incompatible.

By doing the `require json/ext/generator/state` from C we ensure
we're at least loading that.

But this is a dirty workaround for the 2.7.x branch, we should
find a better way to fully isolate the two gems.
byroot added a commit that referenced this issue Oct 25, 2024
Fix: #646

Since both `json` and `json_pure` expose the same files, if the
versions don't match, the native extension may be loaded with Ruby
code that don't match and is incompatible.

By doing the `require json/ext/generator/state` from C we ensure
we're at least loading that.

But this is a dirty workaround for the 2.7.x branch, we should
find a better way to fully isolate the two gems.
@byroot
Copy link
Member

byroot commented Oct 25, 2024

I released 2.7.4 with a workaround for such situation, but I'll try to find a better solution to allow independent use of json_pure and json for 2.8.0.

hsbt pushed a commit to hsbt/ruby that referenced this issue Oct 26, 2024
… version

Fix: ruby/json#646

Since both `json` and `json_pure` expose the same files, if the
versions don't match, the native extension may be loaded with Ruby
code that don't match and is incompatible.

By doing the `require json/ext/generator/state` from C we ensure
we're at least loading that.

But this is a dirty workaround for the 2.7.x branch, we should
find a better way to fully isolate the two gems.

ruby/json@dfdd4acf36
hsbt pushed a commit to hsbt/ruby that referenced this issue Oct 26, 2024
… version

Fix: ruby/json#646

Since both `json` and `json_pure` expose the same files, if the
versions don't match, the native extension may be loaded with Ruby
code that don't match and is incompatible.

By doing the `require json/ext/generator/state` from C we ensure
we're at least loading that.

But this is a dirty workaround for the 2.7.x branch, we should
find a better way to fully isolate the two gems.

ruby/json@dfdd4acf36
hsbt pushed a commit to ruby/ruby that referenced this issue Oct 26, 2024
… version

Fix: ruby/json#646

Since both `json` and `json_pure` expose the same files, if the
versions don't match, the native extension may be loaded with Ruby
code that don't match and is incompatible.

By doing the `require json/ext/generator/state` from C we ensure
we're at least loading that.

But this is a dirty workaround for the 2.7.x branch, we should
find a better way to fully isolate the two gems.

ruby/json@dfdd4acf36
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

3 participants