I'm using Ruby 2.1.0, watir-webdriver, rspec, taza, and PhantomJS 1.9.8. The OS is Linux tester 3.2.0-4-686-pae #1 SMP Debian 3.2.65-1+deb7u1 i686 GNU/Linux
.
I run PhantomJS via Watir::Browser.new
and supply the following command line parameters: --ignore-ssl-errors=true --ssl-protocol=any --debug=true --cookies-file=/tmp/cookies.txt
.
There's a single spec file that fails intermittently (I'd say, likely to fail than pass) at the very beginning: Connection refused - connect(2) for "127.0.0.1" port 8910
. In the meantime, netstat -tulpan
shows this:
...
tcp 0 0 127.0.0.1:43695 127.0.0.1:8910 TIME_WAIT -
tcp 0 0 127.0.0.1:43723 127.0.0.1:8910 TIME_WAIT -
tcp 0 0 127.0.0.1:43743 127.0.0.1:8910 TIME_WAIT -
tcp 0 0 127.0.0.1:43677 127.0.0.1:8910 TIME_WAIT -
tcp 0 0 127.0.0.1:43740 127.0.0.1:8910 TIME_WAIT -
...
Around 90 ports in total. They remain open after rspec
has quit. I'm puzzled of the intermittent nature of this failure. Have anyone else encountered the same problem? Any advice, recommendation, link etc. are much appreciated. Thank you.
UPD: I took a closer look and discovered that at some point in time PhantomJS starts dropping connections that income from webdriver: -> [SYN], <- [RST, ACK]. The process remains in memory, but since PhantomJS doesn't keep any error log, I absolutely have no idea what's the cause.