Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Intermittent failure on test environment about missing constants #15089

@sobrinho

Description

@sobrinho

Hello guys,

We have 3 complete different applications which are raising strange exceptions on the test environment.

I'm assuming it's a race condition but I'm not sure, still trying to figure out what's happening.

On a rails 4.0.4 application we are randomly seeing this exception:

An error occurred in an after hook
  ActionController::RoutingError: Object is not missing constant PeopleController!
  occurred at ..../activesupport-4.0.4/lib/active_support/dependencies.rb:449:in `load_missing_constant'

Using ActiveSupport::Dependencies.log_activity = true, as @rafaelfranca suggested, we see this on the test.log:

Started POST "/people" for 127.0.0.1 at 2014-05-13 09:37:32 -0300
Started POST "/people" for 127.0.0.1 at 2014-05-13 09:37:32 -0300
Dependencies: called load_missing_constant(Object, :PeopleController)
Dependencies: called load_missing_constant(Object, :PeopleController)
Dependencies: called require_or_load("..../app/controllers/people_controller", "PeopleController")
Dependencies: called require_or_load("..../app/controllers/people_controller", "PeopleController")
Dependencies: requiring ..../app/controllers/people_controller
Dependencies: called require_or_load("people_helper", nil)
Dependencies: requiring people_helper
Processing by PeopleController#create as JSON

We are seeing similar failures on rails 4.1 applications (circular dependency exception appears from time to time and we don't have any circular dependency).

What I can tell is that when we make 2 requests at same endpoint, in this case, at people controller, something happens on active support and it mess with the autoloading.

We changed config.eager_load to true on the test environment and the exceptions seems to be gone, we are running the same build again over and over again to be sure it won't fail again.

I'm assuming that is something related to the capybara running the server in a different thread but since webrick responds only one request per time, it do not makes sense.

Is that excepted to happen when eager load is false on test environment?

What else can we do to isolate the exception and you guys have some info about it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions