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

uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState #43851

Closed
dorianmariecom opened this issue Dec 13, 2021 · 6 comments
Closed

Comments

@dorianmariecom
Copy link
Contributor

Steps to reproduce

It seems like there is a bug in cocoapods but seems related to the 7.0.0rc1 version of rails, so posting here and there in case

gem install cocoapods
pod install
require File.join(
          File.dirname(`node --print "require.resolve('expo/package.json')"`),
          "scripts/autolinking"
        )
require File.join(
          File.dirname(
            `node --print "require.resolve('react-native/package.json')"`
          ),
          "scripts/react_native_pods"
        )
require File.join(
          File.dirname(
            `node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`
          ),
          "native_modules"
        )

platform :ios, "12.0"

require "json"
podfile_properties =
  begin
    JSON.parse(File.read("./Podfile.properties.json"))
  rescue StandardError
    {}
  end

target "socializus" do
  use_expo_modules!

  config = use_native_modules!

  use_react_native!(
    path: config[:reactNativePath],
    hermes_enabled: podfile_properties["expo.jsEngine"] == "hermes"
  )

  use_flipper!({ "Flipper" => "0.119.0" })

  post_install do |installer|
    flipper_post_install(installer)
    react_native_post_install(installer)

    installer.pods_project.targets.each do |target|
      if (target.name&.eql?("FBReactNativeSpec"))
        target.build_phases.each do |build_phase|
          if (
               build_phase.respond_to?(:name) &&
                 build_phase.name.eql?("[CP-User] Generate Specs")
             )
            target.build_phases.move(build_phase, 0)
          end
        end
      end
    end
  end
end

target "OneSignalNotificationServiceExtension" do
  pod "OneSignal"
end

Expected behavior

Upgrades pods, works fine

Actual behavior

An error

/Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0.rc1/lib/active_support/xml_mini.rb:184:in `current_thread_backend': uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState (NameError)
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0.rc1/lib/active_support/xml_mini.rb:103:in `backend='
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0.rc1/lib/active_support/xml_mini.rb:201:in `<module:ActiveSupport>'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0.rc1/lib/active_support/xml_mini.rb:11:in `<top (required)>'
	from <internal:/Users/dorianmariefr/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/Users/dorianmariefr/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0.rc1/lib/active_support/core_ext/array/conversions.rb:3:in `<top (required)>'
	from <internal:/Users/dorianmariefr/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/Users/dorianmariefr/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/cocoapods-1.11.2/lib/cocoapods.rb:9:in `<top (required)>'
	from <internal:/Users/dorianmariefr/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/Users/dorianmariefr/.rvm/rubies/ruby-3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/cocoapods-1.11.2/bin/pod:36:in `<top (required)>'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/bin/pod:25:in `load'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/bin/pod:25:in `<main>'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/bin/ruby_executable_hooks:22:in `eval'
	from /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/bin/ruby_executable_hooks:22:in `<main>'

System configuration

Rails version:

Ruby version:

@dorianmariecom
Copy link
Contributor Author

The fix would be either for rails to add require "active_support/isolated_execution_state" in activesupport's lib/active_support/xml_mini.rb or for cocoapods to add it

@adamniedzielski
Copy link

I stumbled across this error when trying to do:

require "active_record/base"

class StagedJob < ActiveRecord::Base
end

This is a gem and not a Rails app, so I have to require active_record manually. It felt like a good idea to require active_record/base specifically as this is the class that I'm referencing in my code.

Unfortunately this doesn't work and throws ActiveSupport::XmlMini::IsolatedExecutionState. I'm not sure if require "active_record/base" worked before Rails 7 or not 🤔

Anyway, I changed it to:

require "active_record"

class StagedJob < ActiveRecord::Base
end

and now it works properly 🎉 That's because active_record.rb requires active_support properly.

Leaving this comment here, in case somebody finds it useful.

@dorianmariecom
Copy link
Contributor Author

I just stumbled against this error again while upgrading my app to rails 7

Failure/Error: require "active_support/testing/time_helpers"

NameError:
  uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:184:in `current_thread_backend'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:103:in `backend='
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:201:in `<module:ActiveSupport>'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/xml_mini.rb:11:in `<top (required)>'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/core_ext/array/conversions.rb:3:in `require'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/core_ext/array/conversions.rb:3:in `<top (required)>'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/duration.rb:3:in `require'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/duration.rb:3:in `<top (required)>'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/core_ext/time/calculations.rb:3:in `require'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/core_ext/time/calculations.rb:3:in `<top (required)>'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/testing/time_helpers.rb:4:in `require'
# /Users/dorianmariefr/.rvm/gems/ruby-3.0.3/gems/activesupport-7.0.0/lib/active_support/testing/time_helpers.rb:4:in `<top (required)>'
# ./spec/spec_helper.rb:6:in `require'
# ./spec/spec_helper.rb:6:in `<top (required)>'

The fix was to do:

require "active_support"
require "active_support/testing/time_helpers"

@ddoherty03
Copy link

Same with require active_support/date. Staying with 6.* for now.

ihors-livestorm added a commit to ihors-livestorm/OpenTok-Ruby-SDK that referenced this issue Jan 5, 2022
…State

It was breaking specs and sample app from running.

based on solution here:
rails/rails#43851 (comment)
olleolleolle added a commit to olleolleolle/lograge that referenced this issue Jan 11, 2022
This has changed in later releases of ActiveSupport, see this Issue: rails/rails#43851
olleolleolle added a commit to olleolleolle/lograge that referenced this issue Jan 11, 2022
This has changed in later releases of ActiveSupport, see this Issue: rails/rails#43851
iloveitaly pushed a commit to roidrage/lograge that referenced this issue Jan 11, 2022
This has changed in later releases of ActiveSupport, see this Issue: rails/rails#43851
sergioisidoro added a commit to sergioisidoro/rswag that referenced this issue Jan 24, 2022
mjankowski added a commit to mjankowski/inline_svg that referenced this issue Feb 11, 2022
When running the test suite with activesupport version 7, an
unitialized constant error for `XmlMini::IsolatedExecutionState`
is raised.

As described here:

- rails/rails#43851
- rails/rails#43852

The resolution for this is to first require `active_support` before
requiring `core_ext/string` so that autoloading happens correctly.
mjankowski added a commit to mjankowski/inline_svg that referenced this issue Feb 11, 2022
When running the test suite with activesupport version 7, an
unitialized constant error for `XmlMini::IsolatedExecutionState`
is raised.

As described here:

- rails/rails#43851
- rails/rails#43852

The resolution for this is to first require `active_support` before
requiring `core_ext/string` so that autoloading happens correctly.
ollietreend added a commit to alphagov/govspeak that referenced this issue Feb 16, 2022
…tate

After the move to Rails 7, the following error was causing tests to fail:
```
uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState
```

The solution was to explicitly require `active_support` before requiring the Hash and Array core extensions. This is the suggested approach given in the [Active Support documentation][1], but presumably the previous combination of Ruby and Rails was more forgiving of its omittance.

This change is based on the solution identified here:
rails/rails#43851 (comment)

[1]: https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support
ollietreend added a commit to alphagov/govspeak that referenced this issue Feb 16, 2022
…tate

After the move to Rails 7, the following error was causing tests to fail:
```
uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState
```

The solution was to explicitly require `active_support` before requiring the Hash and Array core extensions. This is the suggested approach given in the [Active Support documentation][1], but presumably the previous combination of Ruby and Rails was more forgiving of its omittance.

This change is based on the solution identified here:
rails/rails#43851 (comment)

[1]: https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support
ollietreend added a commit to alphagov/govspeak that referenced this issue Feb 16, 2022
…tate

After the move to Rails 7, the following error was causing tests to fail:
```
uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState
```

The solution was to explicitly require `active_support` before requiring the Hash and Array core extensions. This is the suggested approach given in the [Active Support documentation][1], but presumably the previous combination of Ruby and Rails was more forgiving of its omittance.

This change is based on the solution identified here:
rails/rails#43851 (comment)

[1]: https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support
ollietreend added a commit to alphagov/govspeak that referenced this issue Feb 16, 2022
…tate

After the move to Rails 7, the following error was causing tests to fail:
```
uninitialized constant ActiveSupport::XmlMini::IsolatedExecutionState
```

The solution was to explicitly require `active_support` before requiring the Hash and Array core extensions. This is the suggested approach given in the [Active Support documentation][1], but presumably the previous combination of Ruby and Rails was more forgiving of its omittance.

This change is based on the solution identified here:
rails/rails#43851 (comment)

[1]: https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support
sorah added a commit to sorah/kaminari-sinatra that referenced this issue Feb 20, 2022
@jaswinderahuja
Copy link

require "active_support"
require "active_support/testing/time_helpers"

require in which file please ?

@dorianmariecom
Copy link
Contributor Author

@jaswinderahuja wherever you are requiring active support time helpers, you need to require active support first

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 a pull request may close this issue.

4 participants