teampoltergeist / poltergeist

A PhantomJS driver for Capybara
MIT License
2.5k stars 415 forks source link

capybara/poltergeist - Page timed out #713

Closed haridak closed 8 years ago

haridak commented 8 years ago

I see this message often and at random places. I've set the timeout of 60 seconds and that does help either. This usually occurs when I visit a page or click button that loads a new page. Could you provide inputs on how to work around this?

`Capybara::Poltergeist::TimeoutError: Timed out waiting for response to {"name":"visit","args":["url_of_the application]}. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the Poltergeist :timeout option to a higher value will help (see the docs for details). If increasing the timeout does not help, this is probably a bug in Poltergeist - please report it to the issue tracker.

haridak commented 8 years ago

when I look at the screenshot, I see that the page has completely loaded.(all the UI elements are available).

haridak commented 8 years ago

Is there a way I could start working on an object once it is visible without waiting for the page to load completely?

twalpole commented 8 years ago

You'll need to provide the versions of poltergeist and phantomjs you are using,, configuration options you are using for the driver, whether or not your site is https and a debug mode log before anyone can provide an informed guess as to what's causing this

haridak commented 8 years ago

my bad. sorry.

poltergeist (1.7.0) phantoms 2.0 driver configurations - options = {js_errors: false, timeout: 60} https: yes

The problem with debug log is that not always do I see this problem. I enabled the debug mode and tried to replicate this problem but it didn't occur. I will run the suite couple of times and see get back when I have the log.

twalpole commented 8 years ago

First suggestion would be to upgrade to the latest poltergeist since it tied the request/response pair together with a unique ID, which should fix the issues where they got out of sync causing all sorts of timeout errors. 1.8.1 would also allow you to look at any network errors returned in page.driver.network_traffic

dillonwelch commented 8 years ago

I'm seeing the same error on 1.8.1 somewhat frequently on different pages of my app. It spits out the following error:

     # ------------------
     # --- Caused by: ---
     # Errno::EAGAIN:
     #   Resource temporarily unavailable
     #   /Users/dillonwelch/.rvm/gems/ruby-2.2.3/gems/poltergeist-1.8.1/lib/capybara/poltergeist/web_socket_server.rb:78:in `receive'

Poltergeist: 1.8.1 Phantomjs: 2.0.0 https: yes Driver config options -

Capybara.register_driver :poltergeist_with_blacklist do |app|
  driver = Capybara::Poltergeist::Driver.new(app, timeout: 60)
  driver.browser.url_blacklist = %w(
    http://fonts.googleapis.com
    http://html5shiv.googlecode.com
  )
  driver
end

Don't have a debug log because it's not a consistent error.

twalpole commented 8 years ago

Without a debug log there really is nothing we can deduce here, and @oniofchaos - when you say this is the same error - what are you basing that on?

dillonwelch commented 8 years ago

How can I turn on debug logging? If there's an easy way to do it I'll see about turning it on our CI so I can send it over when it happens again.

I'm basing it on that I'm seeing the same Timed out waiting for response error. Would you prefer that I create a separate issue?

twalpole commented 8 years ago

@oniofchaos You just need to pass debug: true as an option to your driver config - https://github.com/teampoltergeist/poltergeist#customization - The reason I asked whether you were sure it was the same error is because @haridak didn't mention the EAGAIN error, although that could be because of not being on 1.8.1 I guess

dillonwelch commented 8 years ago

debug log.txt Here is a debug log for a failing build with the EAGAIN error

twalpole commented 8 years ago

@oniofchaos Any clue where in this file the error occurred ?

dillonwelch commented 8 years ago

No idea, sorry. Here is what I see on CircleCI:

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 41413

  1) Sentry disables user access to a facility disabling permissions for one facility
     Failure/Error: visit new_user_session_path

     Capybara::Poltergeist::TimeoutError:
       Timed out waiting for response to {"id":"4cce1ae1-83d5-4a76-bb8b-6e6865ceea2c","name":"visit","args":["http://127.0.0.1:54682/users/login"]}. It's possible that this happened because something took a very long time (for example a page load was slow). If so, setting the Poltergeist :timeout option to a higher value will help (see the docs for details). If increasing the timeout does not help, this is probably a bug in Poltergeist - please report it to the issue tracker.
     # ./spec/support/feature_helpers.rb:3:in `sign_in_with'
     # ./spec/support/feature_helpers.rb:10:in `sign_in_with_user'
     # ./spec/features/authentication/sentry_disables_user_account_spec.rb:22:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # Errno::EAGAIN:
     #   Resource temporarily unavailable
     #   ./spec/support/feature_helpers.rb:3:in `sign_in_with'

 146/146 |======================= 100 ========================>| Time: 00:02:26 

Finished in 2 minutes 26.7 seconds (files took 5.32 seconds to load)
146 examples, 1 failure

Failed examples:

rspec ./spec/features/authentication/sentry_disables_user_account_spec.rb:20 # Sentry disables user access to a facility disabling permissions for one facility
twalpole commented 8 years ago

@oniofchaos The id of the message from the error you posted doesn't exist in the debug log at all -- were these from the same test run?? If not then its not really of any help

dillonwelch commented 8 years ago

Yes, this is the the debug log from the test run.

jdelStrother commented 8 years ago

I'm also seeing this behaviour, I think. When it happens, I see this sequence of events:

this all completes within around 1 second. Then, poltergeist gets stuck on IO.select for the remainder of the 30 second timeout, waiting for a response to the original command. This never happens - or at least, there's no mention of a {"command_id":"3ec6586b-cc30-4873-94ce-af357f8341f5","response":true} in poltergeist's log.

Does that supply any useful information? Anything else I should look into?

twalpole commented 8 years ago

@jdelStrother That would tend to imply that the page being fully loaded event isn't triggering, which could be a bug in phantomjs -- what version of phantomjs are you using? I just wish we could reliably replicate the behavior in order to actually confirm that.

twalpole commented 8 years ago

Can anyway provide the output of pp page.driver.network_traffic when a test fails?

jdelStrother commented 8 years ago

Good tip. In my case, the last entry in the network_traffic list was:

#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33ae78 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>14, "method"=>"GET", "time"=>"2016-01-13T14:49:55.285Z", "url"=>"http://t.co/i/adsct?p_id=Twitter&p_user_id=0&txn_id=l6nzy&tw_sale_amount=0&tw_order_quantity=0"}, @response_parts=[], @error=nil>]

ie, a twitter ad tracking pixel. (I wondered if rapid requests to that same URL might result in t.co holding the connection open for a long time as some sort of anti-flood mechanism, but I've not been able to reproduce that in a small test case.)

I've disable that pixel in our integration tests and it appears to be running a lot smoother (so far...)

FWIW, I'm using phantomjs 1.9.8 and poltergeist 1.8.1.

twalpole commented 8 years ago

@jdelStrother Thats interesting, although I don't think PhantomJS waits for resources to load before returning from visit - do you happen to have the complete network traffic list for that one test? I'm suspecting that there may be a race condition with resources attempting to be loaded and failing before the initial document has finished being received, but I haven't been able to replicate

jdelStrother commented 8 years ago

I don't think PhantomJS waits for resources to load before returning from visit

I may be wrong, but I was under the impression it does, at least for image resources.

do you happen to have the complete network traffic list for that one test?

Here you go:

[
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33bb20 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Accept", "value"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}], "id"=>1, "method"=>"GET", "time"=>"2016-01-13T14:49:54.645Z", "url"=>"http://127.0.0.1:56914/fake_login_for_tests?promote_to_admin=&username=bob"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33bb98 @data={"bodySize"=>89, "contentType"=>"text/html; charset=utf-8", "headers"=>[{"name"=>"X-Frame-Options", "value"=>"SAMEORIGIN"}, {"name"=>"X-Xss-Protection", "value"=>"1; mode=block"}, {"name"=>"X-Content-Type-Options", "value"=>"nosniff"}, {"name"=>"Location", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"Content-Type", "value"=>"text/html; charset=utf-8"}, {"name"=>"Cache-Control", "value"=>"no-cache"}, {"name"=>"X-Request-Id", "value"=>"ee11cfb0-87a2-483f-8138-800c30ce19f9"}, {"name"=>"X-Runtime", "value"=>"0.030791"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Content-Length", "value"=>"89"}, {"name"=>"Connection", "value"=>"Keep-Alive"}, {"name"=>"Set-Cookie", "value"=>"test_cookie=1; path=/\n_audioboo_session2=UjBIWE5ublVnT1RmRmZyS09PTk80VFBscmx4bFhPRWdvMXB2RFA4dFlQNElXYkdZMzVkS3BvSHlsSnpnYVQxczkveHpMUHVaNnJmdGh3L3BqY1p4SzA5dEhFd2NTYTloWUkySlpjcmV4YTE4Qkc5V3lyMXNtQUtSQXJQRXphcDZuVFl5WFNjNys3bzVTL2RyZU03Y0h5VWYzQ3ZkWTBnaVhMa1hHbVd6QlduS3h3cGtNcCttVjN0TExZQkY1azN0SlRNK2RkNzVsMktaQUQvN0Z3R3Bidz09LS10eXUwT3V6UzU2SEN1QStOeENmTkdBPT0%3D--9016ea5f7eba7f5e79d34554227729ad603b71d3; path=/; HttpOnly"}], "id"=>1, "redirectURL"=>"http://127.0.0.1:56914/", "stage"=>"start", "status"=>302, "statusText"=>"Found ", "time"=>"2016-01-13T14:49:54.683Z", "url"=>"http://127.0.0.1:56914/fake_login_for_tests?promote_to_admin=&username=bob"}>, 
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33bb70 @data={"contentType"=>"text/html; charset=utf-8", "headers"=>[{"name"=>"X-Frame-Options", "value"=>"SAMEORIGIN"}, {"name"=>"X-Xss-Protection", "value"=>"1; mode=block"}, {"name"=>"X-Content-Type-Options", "value"=>"nosniff"}, {"name"=>"Location", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"Content-Type", "value"=>"text/html; charset=utf-8"}, {"name"=>"Cache-Control", "value"=>"no-cache"}, {"name"=>"X-Request-Id", "value"=>"ee11cfb0-87a2-483f-8138-800c30ce19f9"}, {"name"=>"X-Runtime", "value"=>"0.030791"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Content-Length", "value"=>"89"}, {"name"=>"Connection", "value"=>"Keep-Alive"}, {"name"=>"Set-Cookie", "value"=>"test_cookie=1; path=/\n_audioboo_session2=UjBIWE5ublVnT1RmRmZyS09PTk80VFBscmx4bFhPRWdvMXB2RFA4dFlQNElXYkdZMzVkS3BvSHlsSnpnYVQxczkveHpMUHVaNnJmdGh3L3BqY1p4SzA5dEhFd2NTYTloWUkySlpjcmV4YTE4Qkc5V3lyMXNtQUtSQXJQRXphcDZuVFl5WFNjNys3bzVTL2RyZU03Y0h5VWYzQ3ZkWTBnaVhMa1hHbVd6QlduS3h3cGtNcCttVjN0TExZQkY1azN0SlRNK2RkNzVsMktaQUQvN0Z3R3Bidz09LS10eXUwT3V6UzU2SEN1QStOeENmTkdBPT0%3D--9016ea5f7eba7f5e79d34554227729ad603b71d3; path=/; HttpOnly"}], "id"=>1, "redirectURL"=>"http://127.0.0.1:56914/", "stage"=>"end", "status"=>302, "statusText"=>"Found ", "time"=>"2016-01-13T14:49:54.683Z", "url"=>"http://127.0.0.1:56914/fake_login_for_tests?promote_to_admin=&username=bob"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33ba08 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Accept", "value"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}], "id"=>2, "method"=>"GET", "time"=>"2016-01-13T14:49:54.683Z", "url"=>"http://127.0.0.1:56914/"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33ba80 @data={"bodySize"=>9968, "contentType"=>"text/html; charset=utf-8", "headers"=>[{"name"=>"X-Frame-Options", "value"=>"SAMEORIGIN"}, {"name"=>"X-Xss-Protection", "value"=>"1; mode=block"}, {"name"=>"X-Content-Type-Options", "value"=>"nosniff"}, {"name"=>"Content-Type", "value"=>"text/html; charset=utf-8"}, {"name"=>"Etag", "value"=>"W/\"4c119d55b4e95f32878428601adff5c3\""}, {"name"=>"Cache-Control", "value"=>"max-age=0, private, must-revalidate"}, {"name"=>"X-Request-Id", "value"=>"ae09e5dc-befd-4744-9b91-ff7c7f3569e1"}, {"name"=>"X-Runtime", "value"=>"0.090220"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Content-Length", "value"=>"9968"}, {"name"=>"Connection", "value"=>"Keep-Alive"}, {"name"=>"Set-Cookie", "value"=>"_audioboo_session2=V0h0YzdUT3ltUmVPYkk0aXFXTEZSS3p6cUU4RE1vM0UwUjMyTHd1cWpnNWtoSlRTckZ6MXRZM2tPZDJudHZ5ZUQ0SjdURUNaVTBpeFVxSlgxVXNtUlBRWVp2enFVVitpd0tKdU5oaU9oSmpkNktsL0g3ZVVsYkdQSE16OG5wdk1HZGFIblV4Ti9ESWVDdWgwWDQ2OE0ydWprcHh0bzZid01zdldiYjVKUlpRcGsxaWZNZVIvZEM4WTN2ZGQ3V3Q5YkF5RHovRno2VkU5dHRPb1pyTXZmUT09LS1Ra0h5NjdqaGFkVk1OY21oR01DeGRnPT0%3D--eb037b2307bf881dbf476db29380e72e4035bfe8; path=/; HttpOnly"}], "id"=>2, "redirectURL"=>nil, "stage"=>"start", "status"=>200, "statusText"=>"OK ", "time"=>"2016-01-13T14:49:54.779Z", "url"=>"http://127.0.0.1:56914/"}>, 
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33ba58 @data={"contentType"=>"text/html; charset=utf-8", "headers"=>[{"name"=>"X-Frame-Options", "value"=>"SAMEORIGIN"}, {"name"=>"X-Xss-Protection", "value"=>"1; mode=block"}, {"name"=>"X-Content-Type-Options", "value"=>"nosniff"}, {"name"=>"Content-Type", "value"=>"text/html; charset=utf-8"}, {"name"=>"Etag", "value"=>"W/\"4c119d55b4e95f32878428601adff5c3\""}, {"name"=>"Cache-Control", "value"=>"max-age=0, private, must-revalidate"}, {"name"=>"X-Request-Id", "value"=>"ae09e5dc-befd-4744-9b91-ff7c7f3569e1"}, {"name"=>"X-Runtime", "value"=>"0.090220"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Content-Length", "value"=>"9968"}, {"name"=>"Connection", "value"=>"Keep-Alive"}, {"name"=>"Set-Cookie", "value"=>"_audioboo_session2=V0h0YzdUT3ltUmVPYkk0aXFXTEZSS3p6cUU4RE1vM0UwUjMyTHd1cWpnNWtoSlRTckZ6MXRZM2tPZDJudHZ5ZUQ0SjdURUNaVTBpeFVxSlgxVXNtUlBRWVp2enFVVitpd0tKdU5oaU9oSmpkNktsL0g3ZVVsYkdQSE16OG5wdk1HZGFIblV4Ti9ESWVDdWgwWDQ2OE0ydWprcHh0bzZid01zdldiYjVKUlpRcGsxaWZNZVIvZEM4WTN2ZGQ3V3Q5YkF5RHovRno2VkU5dHRPb1pyTXZmUT09LS1Ra0h5NjdqaGFkVk1OY21oR01DeGRnPT0%3D--eb037b2307bf881dbf476db29380e72e4035bfe8; path=/; HttpOnly"}], "id"=>2, "redirectURL"=>nil, "stage"=>"end", "status"=>200, "statusText"=>"OK ", "time"=>"2016-01-13T14:49:54.783Z", "url"=>"http://127.0.0.1:56914/"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b918 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Accept", "value"=>"text/css,*/*;q=0.1"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"5c02389c3b69b207a5cbf165160adb471184078297509383785d67610a5ea37e\""}], "id"=>3, "method"=>"GET", "time"=>"2016-01-13T14:49:54.782Z", "url"=>"http://127.0.0.1:56914/assets/audioboom_core.css"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b968 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"5c02389c3b69b207a5cbf165160adb471184078297509383785d67610a5ea37e\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"6fa3fbbc-4348-49ac-a3ed-82fc886c4585"}, {"name"=>"X-Runtime", "value"=>"0.005622"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>3, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.035Z", "url"=>"http://127.0.0.1:56914/assets/audioboom_core.css"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b828 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Accept", "value"=>"text/css,*/*;q=0.1"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"a5e23e083c19bcd12c47446859adc6843cde60973e300f7a641e6e3bcfe2981e\""}], "id"=>4, "method"=>"GET", "time"=>"2016-01-13T14:49:54.782Z", "url"=>"http://127.0.0.1:56914/assets/audioboom_styles.css"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b878 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"a5e23e083c19bcd12c47446859adc6843cde60973e300f7a641e6e3bcfe2981e\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"09d0b0f3-3cfa-49dd-90ef-dd72ac23bcbd"}, {"name"=>"X-Runtime", "value"=>"0.005194"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>4, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.047Z", "url"=>"http://127.0.0.1:56914/assets/audioboom_styles.css"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b738 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Accept", "value"=>"*/*"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"d7e0caa2bdf424ab9a531a8ffb046cb860898637193340c3cb7b38fe3dcd804e\""}], "id"=>5, "method"=>"GET", "time"=>"2016-01-13T14:49:54.782Z", "url"=>"http://127.0.0.1:56914/assets/preload.js"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b788 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"d7e0caa2bdf424ab9a531a8ffb046cb860898637193340c3cb7b38fe3dcd804e\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"36f6ebc6-572a-4fea-b356-b7f57761e9b5"}, {"name"=>"X-Runtime", "value"=>"0.007083"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>5, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.043Z", "url"=>"http://127.0.0.1:56914/assets/preload.js"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b648 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Accept", "value"=>"*/*"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"204ef219872b381c29bb511177a55a212b7ae7176097d625f8662bcb68999de1\""}], "id"=>6, "method"=>"GET", "time"=>"2016-01-13T14:49:54.783Z", "url"=>"http://127.0.0.1:56914/assets/application.js"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b698 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"204ef219872b381c29bb511177a55a212b7ae7176097d625f8662bcb68999de1\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"7be437b2-962c-4488-958b-6244023fae39"}, {"name"=>"X-Runtime", "value"=>"0.007080"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:54 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>6, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.043Z", "url"=>"http://127.0.0.1:56914/assets/application.js"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b558 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"6c8daa71e5e8001a5d2aabfc94c9836d2f06f1d52e0b8a4b394b933a3a80fcb9\""}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>7, "method"=>"GET", "time"=>"2016-01-13T14:49:55.093Z", "url"=>"http://127.0.0.1:56914/assets/audioboom_bw_100x100.png"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b5a8 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"6c8daa71e5e8001a5d2aabfc94c9836d2f06f1d52e0b8a4b394b933a3a80fcb9\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"d01ccbcb-e5fb-4311-bc36-62aa6e4237dd"}, {"name"=>"X-Runtime", "value"=>"0.004501"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>7, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.244Z", "url"=>"http://127.0.0.1:56914/assets/audioboom_bw_100x100.png"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b468 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"be3a028048018f2a0a762dcc174ebf68f9f64acf1c8ba1776a2416da5ff92ed8\""}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>8, "method"=>"GET", "time"=>"2016-01-13T14:49:55.096Z", "url"=>"http://127.0.0.1:56914/assets/avatars/robot-2.svg"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b4b8 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"be3a028048018f2a0a762dcc174ebf68f9f64acf1c8ba1776a2416da5ff92ed8\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"1ab27430-b4cd-4a98-8fa5-a5596f36782e"}, {"name"=>"X-Runtime", "value"=>"0.003344"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>8, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.245Z", "url"=>"http://127.0.0.1:56914/assets/avatars/robot-2.svg"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b378 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"35c28330d8fbcb734639adef702738bf1f371e3b3ce76bebe612a3c759d608ed\""}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>9, "method"=>"GET", "time"=>"2016-01-13T14:49:55.096Z", "url"=>"http://127.0.0.1:56914/assets/icons/buttons/moshun_search_button_22.png"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b3c8 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"35c28330d8fbcb734639adef702738bf1f371e3b3ce76bebe612a3c759d608ed\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"6f543fa0-3052-49cb-811a-b26721a16d62"}, {"name"=>"X-Runtime", "value"=>"0.001715"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>9, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.245Z", "url"=>"http://127.0.0.1:56914/assets/icons/buttons/moshun_search_button_22.png"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b288 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"If-None-Match", "value"=>"\"e3870de89716b72cb61a4bba0e17c75783b361cdaba35ea96961c3070bd8ca18\""}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>10, "method"=>"GET", "time"=>"2016-01-13T14:49:55.139Z", "url"=>"http://127.0.0.1:56914/assets/fontawesome-webfont.woff?v=4.3.0"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b2d8 @data={"contentType"=>nil, "headers"=>[{"name"=>"Cache-Control", "value"=>"public, must-revalidate"}, {"name"=>"Etag", "value"=>"\"e3870de89716b72cb61a4bba0e17c75783b361cdaba35ea96961c3070bd8ca18\""}, {"name"=>"Vary", "value"=>"Accept-Encoding"}, {"name"=>"X-Request-Id", "value"=>"3647a551-5ad5-4786-ba07-bf03295666a4"}, {"name"=>"X-Runtime", "value"=>"0.006036"}, {"name"=>"Server", "value"=>"WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Connection", "value"=>"Keep-Alive"}], "id"=>10, "redirectURL"=>nil, "stage"=>"end", "status"=>304, "statusText"=>"Not Modified ", "time"=>"2016-01-13T14:49:55.245Z", "url"=>"http://127.0.0.1:56914/assets/fontawesome-webfont.woff?v=4.3.0"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b170 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>11, "method"=>"GET", "time"=>"2016-01-13T14:49:55.250Z", "url"=>"https://www.facebook.com/tr/?id=751278431592342&ev=PixelInitialized&dl=http%3A%2F%2F127.0.0.1%3A56914%2F&rl=&if=false&ts=1452696595249"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b1e8 @data={"bodySize"=>43, "contentType"=>"image/gif", "headers"=>[{"name"=>"Content-Type", "value"=>"image/gif"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Expires", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Last-Modified", "value"=>"Fri, 21 Dec 2012 00:00:01 GMT"}, {"name"=>"Cache-Control", "value"=>"no-cache, must-revalidate, max-age=0"}, {"name"=>"Server", "value"=>"proxygen"}, {"name"=>"Connection", "value"=>"keep-alive"}, {"name"=>"Content-Length", "value"=>"43"}], "id"=>11, "redirectURL"=>nil, "stage"=>"start", "status"=>200, "statusText"=>"OK", "time"=>"2016-01-13T14:49:55.341Z", "url"=>"https://www.facebook.com/tr/?id=751278431592342&ev=PixelInitialized&dl=http%3A%2F%2F127.0.0.1%3A56914%2F&rl=&if=false&ts=1452696595249"}>, 
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b1c0 @data={"contentType"=>"image/gif", "headers"=>[{"name"=>"Content-Type", "value"=>"image/gif"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Expires", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Last-Modified", "value"=>"Fri, 21 Dec 2012 00:00:01 GMT"}, {"name"=>"Cache-Control", "value"=>"no-cache, must-revalidate, max-age=0"}, {"name"=>"Server", "value"=>"proxygen"}, {"name"=>"Connection", "value"=>"keep-alive"}, {"name"=>"Content-Length", "value"=>"43"}], "id"=>11, "redirectURL"=>nil, "stage"=>"end", "status"=>200, "statusText"=>"OK", "time"=>"2016-01-13T14:49:55.341Z", "url"=>"https://www.facebook.com/tr/?id=751278431592342&ev=PixelInitialized&dl=http%3A%2F%2F127.0.0.1%3A56914%2F&rl=&if=false&ts=1452696595249"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33b058 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Accept", "value"=>"*/*"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}], "id"=>12, "method"=>"GET", "time"=>"2016-01-13T14:49:55.253Z", "url"=>"http://platform.twitter.com/oct.js?_=1452696595157"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b0d0 @data={"bodySize"=>856, "contentType"=>"application/javascript; charset=utf-8", "headers"=>[{"name"=>"Accept-Ranges", "value"=>"bytes"}, {"name"=>"Cache-Control", "value"=>"public, max-age=1800"}, {"name"=>"Content-Type", "value"=>"application/javascript; charset=utf-8"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Etag", "value"=>"\"28ef4c762f1a50be1072033111095d23\""}, {"name"=>"Last-Modified", "value"=>"Wed, 16 Dec 2015 21:36:40 GMT"}, {"name"=>"P3P", "value"=>"CP=\"CAO DSP LAW CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT\""}, {"name"=>"Server", "value"=>"ECS (lcy/1D1F)"}, {"name"=>"X-Cache", "value"=>"HIT"}, {"name"=>"Content-Length", "value"=>"856"}], "id"=>12, "redirectURL"=>nil, "stage"=>"start", "status"=>200, "statusText"=>"OK", "time"=>"2016-01-13T14:49:55.277Z", "url"=>"http://platform.twitter.com/oct.js?_=1452696595157"}>, 
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33b0a8 @data={"contentType"=>"application/javascript; charset=utf-8", "headers"=>[{"name"=>"Accept-Ranges", "value"=>"bytes"}, {"name"=>"Cache-Control", "value"=>"public, max-age=1800"}, {"name"=>"Content-Type", "value"=>"application/javascript; charset=utf-8"}, {"name"=>"Date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"Etag", "value"=>"\"28ef4c762f1a50be1072033111095d23\""}, {"name"=>"Last-Modified", "value"=>"Wed, 16 Dec 2015 21:36:40 GMT"}, {"name"=>"P3P", "value"=>"CP=\"CAO DSP LAW CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT\""}, {"name"=>"Server", "value"=>"ECS (lcy/1D1F)"}, {"name"=>"X-Cache", "value"=>"HIT"}, {"name"=>"Content-Length", "value"=>"856"}], "id"=>12, "redirectURL"=>nil, "stage"=>"end", "status"=>200, "statusText"=>"OK", "time"=>"2016-01-13T14:49:55.277Z", "url"=>"http://platform.twitter.com/oct.js?_=1452696595157"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33af40 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>13, "method"=>"GET", "time"=>"2016-01-13T14:49:55.284Z", "url"=>"https://analytics.twitter.com/i/adsct?p_id=Twitter&p_user_id=0&txn_id=l6nzy&tw_sale_amount=0&tw_order_quantity=0"}, @response_parts=[
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33afb8 @data={"bodySize"=>43, "contentType"=>"image/gif;charset=utf-8", "headers"=>[{"name"=>"cache-control", "value"=>"no-cache, no-store, must-revalidate, pre-check=0, post-check=0"}, {"name"=>"content-encoding", "value"=>"gzip"}, {"name"=>"content-type", "value"=>"image/gif;charset=utf-8"}, {"name"=>"date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"expires", "value"=>"Tue, 31 Mar 1981 05:00:00 GMT"}, {"name"=>"last-modified", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"pragma", "value"=>"no-cache"}, {"name"=>"server", "value"=>"tsa_b"}, {"name"=>"set-cookie", "value"=>"guest_id=v1%3A145269659564844040; Domain=.twitter.com; Path=/; Expires=Fri, 12-Jan-2018 14:49:55 UTC"}, {"name"=>"status", "value"=>"200 OK"}, {"name"=>"strict-transport-security", "value"=>"max-age=631138519"}, {"name"=>"x-connection-hash", "value"=>"1cb8fa4f61789f905e71e97ddffd36de"}, {"name"=>"x-content-type-options", "value"=>"nosniff"}, {"name"=>"x-frame-options", "value"=>"SAMEORIGIN"}, {"name"=>"x-response-time", "value"=>"7"}, {"name"=>"x-transaction", "value"=>"28d7b6b2a0218d86"}, {"name"=>"x-twitter-response-tags", "value"=>"BouncerCompliant"}, {"name"=>"x-xss-protection", "value"=>"1; mode=block"}], "id"=>13, "redirectURL"=>nil, "stage"=>"start", "status"=>200, "statusText"=>"OK", "time"=>"2016-01-13T14:49:55.743Z", "url"=>"https://analytics.twitter.com/i/adsct?p_id=Twitter&p_user_id=0&txn_id=l6nzy&tw_sale_amount=0&tw_order_quantity=0"}>, 
#<Capybara::Poltergeist::NetworkTraffic::Response:0x007f89ec33af90 @data={"contentType"=>"image/gif;charset=utf-8", "headers"=>[{"name"=>"cache-control", "value"=>"no-cache, no-store, must-revalidate, pre-check=0, post-check=0"}, {"name"=>"content-encoding", "value"=>"gzip"}, {"name"=>"content-type", "value"=>"image/gif;charset=utf-8"}, {"name"=>"date", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"expires", "value"=>"Tue, 31 Mar 1981 05:00:00 GMT"}, {"name"=>"last-modified", "value"=>"Wed, 13 Jan 2016 14:49:55 GMT"}, {"name"=>"pragma", "value"=>"no-cache"}, {"name"=>"server", "value"=>"tsa_b"}, {"name"=>"set-cookie", "value"=>"guest_id=v1%3A145269659564844040; Domain=.twitter.com; Path=/; Expires=Fri, 12-Jan-2018 14:49:55 UTC"}, {"name"=>"status", "value"=>"200 OK"}, {"name"=>"strict-transport-security", "value"=>"max-age=631138519"}, {"name"=>"x-connection-hash", "value"=>"1cb8fa4f61789f905e71e97ddffd36de"}, {"name"=>"x-content-type-options", "value"=>"nosniff"}, {"name"=>"x-frame-options", "value"=>"SAMEORIGIN"}, {"name"=>"x-response-time", "value"=>"7"}, {"name"=>"x-transaction", "value"=>"28d7b6b2a0218d86"}, {"name"=>"x-twitter-response-tags", "value"=>"BouncerCompliant"}, {"name"=>"x-xss-protection", "value"=>"1; mode=block"}], "id"=>13, "redirectURL"=>nil, "stage"=>"end", "status"=>200, "statusText"=>"OK", "time"=>"2016-01-13T14:49:55.743Z", "url"=>"https://analytics.twitter.com/i/adsct?p_id=Twitter&p_user_id=0&txn_id=l6nzy&tw_sale_amount=0&tw_order_quantity=0"}>], @error=nil>, 
#<Capybara::Poltergeist::NetworkTraffic::Request:0x007f89ec33ae78 @data={"headers"=>[{"name"=>"User-Agent", "value"=>"Mozilla/5.0 (Macintosh; PPC Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"}, {"name"=>"Referer", "value"=>"http://127.0.0.1:56914/"}, {"name"=>"Accept", "value"=>"*/*"}], "id"=>14, "method"=>"GET", "time"=>"2016-01-13T14:49:55.285Z", "url"=>"http://t.co/i/adsct?p_id=Twitter&p_user_id=0&txn_id=l6nzy&tw_sale_amount=0&tw_order_quantity=0"}, @response_parts=[], @error=nil>]

The visit call was made at 14:49:54, the timeout occurred at 14:50:26, which is when network_traffic was called.

twalpole commented 8 years ago

@jdelStrother You are correct, it does seem to wait for images to load, including images added to the document by inline scripts in the page. There's not much Poltergeist can do about external resources that timeout when trying to be loaded, it is a good reason for using the blacklist/whitelist functionality though

route commented 8 years ago

As another solution --load-images can be used

twalpole commented 8 years ago

I've created a branch that tracks the resources requested during a page load and will report the open requests if/when the page load times out - If some people could give it a try and let us know if it provides useful info and explains the failures being seen I'll finish up a full PR (tests, etc)

gem 'poltergeist', github: 'twalpole/poltergeist', branch: issue_713
jdelStrother commented 8 years ago

@twalpole seems useful - it successfully warned me about an outstanding Twitter tracking image.

dillonwelch commented 8 years ago

i started getting the EAGAIN error on another smaller repo. @twalpole I switched over to using your issue branch and got the following output the next time it failed:

Failures:

  1) user visits the UI route visits the index page
     Failure/Error: visit ui_path

     Capybara::Poltergeist::StatusFailError:
       Request to 'http://127.0.0.1:39316/ui' failed to reach server, check DNS and/or server status - Timed out with the following resources still waiting 
     # ./spec/features/user_visits_the_ui_route_spec.rb:3:in `block (2 levels) in <top (required)>'

Finished in 53.91 seconds (files took 1.52 seconds to load)
57 examples, 1 failure

This looks to me like there weren't actually any waiting resources? Thoughts?

twalpole commented 8 years ago

@oniofchaos Thats what it looks like to me too, which would imply a bug in PhantomJS where onLoadFinished isn't getting called.

dillonwelch commented 8 years ago

@twalpole any suggestions on what I can try next for debugging? Is this something I need to direct towards the PhantomJS team?

twalpole commented 8 years ago

@oniofchaos You can try it with the master branch of poltergeist and phantomjs 2.1.1 which was recently released -- if that doesn't fix it then it really does seem to be a phantomjs bug where onLoadFinished isn't being called. The issue is that they're going to need a reproducible test case to fry and figure out whats going on too.

dillonwelch commented 8 years ago

I'm using CircleCI and it looks like they are using phantomjs 1.9.8. I will try and force my builds to use 2.1.1 and report back.

dillonwelch commented 8 years ago

Looks like CircleCI only has support for up to 2.0.1

adamnbowen commented 8 years ago

@oniofchaos you can install PhantomJS 2.1.1 as part of your build in CircleCI. Here's how we're doing it (the cache_directories section just ensures that we don't re-download and install every single time the test suite runs):

dependencies:
  cache_directories:
    - phantomjs-2.1.1-linux-x86_64
  post:
    # Install PhantomJS 2.1.1:
    - if [[ ! -e phantomjs-2.1.1-linux-x86_64 ]]; then wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 && tar -xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 && sudo mv phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin; fi
rkichenama commented 8 years ago

It seems that rspec fails on the first test, even when randomized, so we shoehorned in an obligatrory test to spin it up before the actual suite. This seems to have cleared up the issue, but having to put in such a patch does not have the team morale high.

jdelStrother commented 8 years ago

We used to have fairly frequent first-test timeouts if tests were run after changing css/javascript, because during that first request, Rails would have to recompile the bundled assets. I added some code during test-startup that calls stylesheet_link_tag & javascript_link_tag for each of our assets, which seems to have fixed things.

metaskills commented 8 years ago

Been using this to get PhantomJS installed on CI boxes. https://github.com/colszowka/phantomjs-gem

sstgithub commented 8 years ago

Upgrading to PhantomJS 2.1.1 helped fix some timeout errors for us. They now have an official way to upgrade:

machine:
  pre:
    - sudo curl --output /usr/local/bin/phantomjs https://s3.amazonaws.com/circle-downloads/phantomjs-2.1.1
twalpole commented 8 years ago

From the final comments here it seems phantomjs 2.1.1 may have fixed this issue - we can reopen if not

jasonfb commented 8 years ago

I am seeing the same issue using Phantom JS 2.1.1 and Poltergeist 1.9.0. I have opened a new issue at https://github.com/teampoltergeist/poltergeist/issues/781 with complete links to most of the relevant source code.

Like others, when I turn debug mode to ON (true), the symptom is not present. @twalpole I am running it using your issue_713 branch now to see if I can figure out if there's some outstanding 3rd party request

jasonfb commented 8 years ago

@twalpole -- Interestingly, when run with debug: true on the issue_713 branch, it actually DOES show the symptom (on the main poltergeist branch it does not when debug is set to true)

twalpole commented 8 years ago

@jasonfb the issue_713 branch updates are included in 1.9.0

jasonfb commented 8 years ago

OK thanks. I think I get the same results.

Re-reading this thread, there is still something that I'd like to ask the collective 'room' , what strategy would I use to inspect my own network traffic . I see here that using pp page.driver.network_traffic I can get it, which I can & have tried from a test, but you guys mentioned a way to "report the open requests if/when the page load times out"

I see that I can use pp page.driver.network_traffic to do reporting, but how do I get to the part of rspec where I can hook into when the page times out? Is there a after(:failure) hook or something?

I'm not familiar with the internals of rspec or poltergeist

cc: @jdelStrother @twalpole

jasonfb commented 8 years ago

I think I figured that out. it seems to output with pp page.driver.network_traffic run just after my visit call: