Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

"This connection is still waiting for a result" #154

ilyakatz opened this Issue Sep 8, 2011 · 14 comments


None yet

ilyakatz commented Sep 8, 2011

Running tests with capybara-webkit sometime gives this error, after an ajax request

Test is something like this

    And I press "Submit"  # triggers an ajax request
    Then I should see a popup with "Thanks for signing up" # only shows up on the view render
    And a mailing entry should exist with email: "ilya@balhbidyblah.com"

Last line throws the following error message
This connection is still waiting for a result, try again once you have the result (Mysql2::Error)

I've tried both with headless and without

diegorv commented Sep 9, 2011

Same for me with Rails 3.1

Mysql2::Error: This connection is still waiting for a result, try again once you have the result: SELECT questions.* FROM questions WHERE questions.name = 'Question 1' LIMIT 1 (ActiveRecord::StatementInvalid)
./features/step_definitions/report_steps.rb:40:in /^I should see overall results for (question|category) "([^"]*)"$/' features/survey_reporting.feature:61:inThen I should see overall results for question "Question 1"'

+1 here as well with capybara-webkit 0.6.0, rails 3.0.10, cucumber 1.0.2, database_cleaner 0.6.7

In my case I rewrote
page.evaluate_script('score.yAxisRange();').should == expected

to use capybara finders
page.all('.score-graph.axisrange').map{|i| i.text.to_s}.should == expected

...which got me past this particular issue.

zdennis commented Sep 23, 2011

I see this issue with capybara 1.0.0, selenium-webdriver 0.2.1, and Rails 3.1.0 and also with capybara 1.1.1, selenium-webdriver 2.7.0, and Rails 3.1.0. I bring this up as this may not be an issue with capybara-webkit.


dmitriy-kiriyenko commented Sep 28, 2011

+1 for seeing this in Rails 3.0, capybara 1.0, mysql2 0.2.10-0.2.13 and Rails 3.1, capybara 1.1.1, mysql2 latest stable and master.

And year, also notice it with selenium-webdriver 2.7.0 and capybara 1.1.1.

zdennis commented Sep 28, 2011

There is an issue for the mysql2 project. It may be helpful to add comments over there so the mysql2 devs know that it's more wide-spread.



halogenandtoast commented Sep 30, 2011

I don't believe this is a capybara-webkit issue. A couple of things to note though:

  1. You should not be running the database in transactional mode
  2. Cucumber currently shares a connection across threads and it's possible that this is causing the issue.

dennisreimann commented Oct 1, 2011

@halogenandtoast The error also occurs when running without transactions, i.e. when using DatabaseCleaner with truncation strategy.


dmitriy-kiriyenko commented Oct 1, 2011

Yep. My reproduction is also without transactions, i.e. with DatabaseCleaner with truncation strategy.

travisp commented Nov 2, 2011

Yes, I have this issue with the truncation strategy

Works with mysql gem instead of mysql2

I'm sharing the connection with transactional fixtures and sometimes get this too. This gem fixed the issue for me: https://github.com/zdennis/activerecord-mysql2-retry-ext


mperham commented Jul 5, 2012

This happens if you use the shared_connection monkeypatch with DatabaseCleaner that is floating around. See brianmario/mysql2#99 for my solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment