-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Net::ReadTimeout during browser launch (Watir and selenium/standalone-chrome) #198
Comments
I too am noticing this problem, though I'm not using Jenkins, I'm just using the images provided by this repo. Here's the error and trace I'm receiving:
For additional note, here's the relevant contents of the Options file mentioned in that trace: 5 def driver()
6 return @driver ||= (lambda {
7 driver = Selenium::WebDriver.for(
8 :remote,
9 :desired_capabilities => :chrome,
10 )
11 driver.manage.timeouts.implicit_wait = 10 # seconds
12 return driver
13 }).call;
14 end |
Yes it has nothing to do with Jenkins, sorry for the redundancy in my post. The trace looks absolutely same for me. I use |
@jizel i met this issue as well, it happens from time to time, and no any regular condition, looks like the browser driver dead, or network issue, setting page level or element level waiting time didn't work as well. could you share your current code to fix this issue temporarily |
@timsheng, What I do is simply to rescue the exception and call my browse method recursively (you might get the exception several times in a row). I have a global counter of recursive calls to prevent forever recursion. This is my browse method (the important bit): begin
yield self.browser(browser_type)
rescue Net::ReadTimeout
STDOUT.puts 'Net::ReadTimeout during browser launch. Trying to launch the browser again'.red
self.close
sleep 5
@read_timeouts += 1
unless @read_timeouts > 2
browse(browser_type=browser_type, selected_language = 'en-US', continue = true, &block)
end
end |
Im using cucumber with ruby and selenium and Im having the same issue when running in Jenkins. For ruby I use rvm with ruby 2.3.0. I started seeing this error in Chrome 52 with Chromedriver 2.15, which was very old from Chromedriver-Helper gem. These are my gems
It kept failing after upgrading Chromedriver 2.23 and then after upgrading Chrome to 53. However something weird happens. It starts failing, and keeps doing it for a day, then fixes itself for, about half a day. (The job runs every 15 min). Then fails again for a day. Also if I restart the machine, it starts passing again for about a day. The error I get is
|
@gustavoriveray I am experiencing the same issue as you, with nearly the same set up of Cucumber, Ruby (rvm 2.3.0), Selenium WebDriver (chrome) running on Jenkins..Although I have run the same exact test with Firefox as the browser and it works fine..Cannot get it to work with chromedriver 2.24.417424 and Chrome 53 |
I reinstalled Chrome @kevin-andres and it seems to have solve the problem, for some reason, it has been running passing for about a week now |
@gustavoriveray Glad to hear that. Are you running your Jenkins on Linux? If so, did you use do the installation with: |
mac, and I don't install it on run time each time. It is just there |
+1 |
@earnold It turns out that Chrome crashes if you try to run it on Docker. (I'm guessing you're having the same issue as me, trying to run Chrome/chromedriver on Jenkins CI w/ docker). It's caused by the shared memory on the container being too small by default for Chrome to run. There are a couple of known solutions to working around this, but basically /dev/shm is too small. I followed those steps, and was able to get my Selenium WebDriver tests to finally pass using Chrome. |
@kevin-andres Thanks for the guidance! It took some doing, but I also need to set |
yes, this has to do with how small docker containers are. they are designed to be extremely minimal. running browsers (especially chrome) is a hefty task. unfortunately - as far as i know, there is nothing we can do on these containers regarding this. please see this comment the best thing to do is to share the hosts memory. considering this, i will be closing this issue. if there are solutions that are offered in the README.md files specific to the nodes, pull requests are gladly accepted! |
i tried the /dev/shm solution on the container (both by trying to mount /dev/shm from host, or by trying the switch) and it still happens |
Is there a solution for this? We recently started encountering this one after using driver 2.27 and Chrome 55 |
We came up with a following monkey-patch until we can upgrade to Selenium 3.x. Problem is gone for now: # NOTE: this is to fix random Chrome shutdown failure on CI
# Should be fixed in selenium >= 3.0.0
class Selenium::WebDriver::Chrome::Service
alias_method :original_stop, :stop
def stop
original_stop
rescue Net::ReadTimeout
end
end |
@krasnoukhov can you please share/explain how your patch is being used? Where should it be added? Thanks. |
Having this issue with cucumber firefox selenium xvfb, for me it happens on any page redirect, first page loads fine but when you move to other page i have subject error all the time |
it is not docker issue in my case it was problem with --port arg on chromedriver as it fails SILENTLY with bind problem if port already in use |
@piotrmasior How did you solve the port failures? |
It appeared that latest firefox works with gekodriver which in its turn
works badly with latest selenium onCI hesdless, same with chromedriver but
a bit better, still reverting to older version of selenium ehich works
directly with browser solved problem for me, its version <3 selenium i
think, hope helps to someone
11.04.2017 5:08 пользователь "Paul Schroeder" <notifications@github.com>
написал:
… @piotrmasior <https://github.com/piotrmasior> How did you solve the port
failures?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#198 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AUU6cU3YeMVb6GvTCrHvF4j_6Ee4MgUEks5rupo4gaJpZM4IBD0S>
.
|
I have tried expanding the size of /dev/shm but still it is not working for me :( I'm trying to run headless test with selenium ruby bindings and chrome drivers on Digital Ocean Ubuntu 14.04. Chrome driver version is 2.29 and and google-chrome version is 57.0 But whener I try to start a new session with these commands
Net::ReadTimeout: Net::ReadTimeout I tried the same on a docker container on my local machine and still I am facing the same issue. I can run it successfully on my local machine(without using docker container) and AWS server as well. Please help me to fix this :( |
@aakashgupta96 : https://github.com/leonid-shevtsov/headless is incompatible with docker-selenium, please open that issue in leonid-shevtsov/headless repo or drop it altogether, i.e. drop |
@krasnoukhov do you've any samples in your repo ? would be much helpful |
For whatever it's worth, if you run tests as root (I know, I know) Chromium will block with an error asking for I solved it with:
|
I'm not using docker-selenium, but I got a similar issue and dmitrym0's response fixed it. I added I'm also running docker with the I'm using a custom Dockerfile based on the official Ruby Dockerfile and then installing Chromedriver and Chrome. Something like the following which runs the command in docker and then gets rid of the container when it's done. My cucumber (ruby) configuration looks like,
|
This issue still exists. You can recreate it by using this script:
Note that one viable solution (that others mention above) has been provided and I have also added suggested switches (i.e. no-sandbox) as some suggested. Even with 15 browsers this script will sometimes make it all the way through without failure so you may need to run it more than once to create the error. |
Still having this issue and not sure how other users are solving this. I've tried the no-sandbox method and that doesn't appear to work. |
Try using different version of chromedriver or geckodriver, usually its.more downgraded version |
Hi,
I am using Watir/docker-selenium/Jenkins combo for automation and I've been experiencing an issue with selenium/standalone-chrome image for quite some time.
When launching new browser in Ruby (yield self.browser(browser_type='chrome')) I get a Net::ReadTimeout error very often.
What I do is to rescue it and launch the browser again so my test suite is not affected. Altough that works as workaround it doesn't solve the problem and - happening really often (10-20 times out of 200 scenarios) - it slows the whole suite down .
This is not an issue for selenium/standalone-firefox, neither for any chrome browser outside docker. It also has nothing to do with client.timeout which is set to 3 minutes in my case - it fails immediately.
Though this issue (http://stackoverflow.com/questions/34003347/how-to-get-concurrent-tests-to-run-with-chrome-in-jenkins) may induce otherwise it does not happen only for multiple users, it happens for single chrome user as well.
It is also independent of Jenkins environment, it happens when running directly on the CentOS VM too.
Thanks.
The text was updated successfully, but these errors were encountered: