Skip to content

Tests cause ThreadError: already initialized with Ruby 2.6.0Β #34790

Closed
@shirosaki

Description

@shirosaki

Steps to reproduce

Test like this causes ThreadError: already initialized after updating Ruby 2.6.0.

class EmployeesControllerTest < ActionController::TestCase
  def test_list_markup
    get :list
    assert_response(:success)
  end
  ...
end
EmployeesControllerTest#test_edit_markup:
ThreadError: already initialized
    /home/shirosaki/.rbenv/versions/2.6.0/lib/ruby/2.6.0/monitor.rb:259:in `mon_initialize'
    /home/shirosaki/.rbenv/versions/2.6.0/lib/ruby/2.6.0/monitor.rb:252:in `initialize'
    /home/shirosaki/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-4.2.11/lib/action_dispatch/http/response.rb:119:in `initialize'
    /home/shirosaki/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-4.2.11/lib/action_controller/test_case.rb:277:in `recycle!'
    /home/shirosaki/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-4.2.11/lib/action_controller/test_case.rb:617:in `process'
    /home/shirosaki/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-4.2.11/lib/action_controller/test_case.rb:67:in `process'
    /home/shirosaki/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/actionpack-4.2.11/lib/action_controller/test_case.rb:514:in `get'
    /home/shirosaki/work/master/test/functional/employees_controller_test.rb:24:in `test_edit_markup'

Expected behavior

Not raise ThreadError.

Actual behavior

Raise ThreadError.

System configuration

Rails version:
4.2.11
Ruby version:
2.6.0

The error would be related to this issue.
https://bugs.ruby-lang.org/issues/15000

If I remove raise ThreadError, "already initialized" in lib/monitor.rb, tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    more-information-neededWhen reporter needs to provide more information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions