Skip to content
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

Firefox WebDriver crashes with httplib.BadStatusLine #2524

Closed
royragsdale opened this issue Jul 26, 2016 · 26 comments
Closed

Firefox WebDriver crashes with httplib.BadStatusLine #2524

royragsdale opened this issue Jul 26, 2016 · 26 comments

Comments

@royragsdale
Copy link

Meta -

OS: Linux (Debian Jessie)
Selenium Version: 2.53.6 (python bindings)
Browser: Firefox
Browser Version: 47.0.1

Expected Behavior -

Selenium will successfully navigate to a page (http://taobao.com). When manually navigated in the browser this completes sucessfully.

Actual Behavior -

The webdriver and browser crash with httplib.BadStatusLine.

Steps to reproduce -

from selenium import webdriver                                                  

driver = webdriver.Firefox()                                                    
driver.get("http://taobao.com")                                                 
driver.close() 
Traceback (most recent call last):
  File "test_firefox.py", line 4, in <module>
    driver.get("http://taobao.com")
  File "python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
    self.execute(Command.GET, {'url': url})
  File "python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File "python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
    return self._request(command_info[0], url, body=data)
  File "/python2.7/site-packages/selenium/webdriver/remote/remote_connection.py", line 433, in _request
    resp = self._conn.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1073, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 415, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 379, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''

@sri85
Copy link
Contributor

sri85 commented Jul 26, 2016

This issue is also reproducible on MAC with firefox version 47.0 and selenium version 2.52

@HelioGuilherme66
Copy link

Can't reproduce in my system:

$ cat taobao.py
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://taobao.com")
driver.close()
$ python taobao.py
$ date
Ter Jul 26 19:36:01 WEST 2016 # This current time == GMT+1
$ python --version
Python 2.7.10
$ uname -a
Linux new-host 4.4.14-200.fc22.x86_64 #1 SMP Fri Jun 24 21:19:33 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux
$ firefox --version
Mozilla Firefox 45.1.0 # This is latest Firefox ESR
$ pip list
(...)
selenium (2.53.2)
(...)

On Tue, Jul 26, 2016 at 7:00 PM, Sripathi Pai [email protected]
wrote:

This issue is also reproducible on MAC with firefox version 47.0 and
selenium version 2.52


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2524 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACu9xkPqWU6_tuLa5cjfIGD8QO3XnCZgks5qZktIgaJpZM4JVYMY
.

@royragsdale
Copy link
Author

Additional version information, for what it's worth:

$ python --version
Python 2.7.9
$ uname -a
Linux localhost 3.14.0 #1 SMP PREEMPT Wed Jul 6 18:18:53 PDT 2016 x86_64 GNU/Linux
$ firefox --version
Mozilla Firefox 47.0.1
$ pip list |grep selenium
selenium (2.53.6)

I'll try with the firefox-esr and see if that works then report back.

@royragsdale
Copy link
Author

royragsdale commented Jul 26, 2016

Unfortunately, @HelioGuilherme66 even when using the ESR release (45.2.0) I still have this error.

test_firefox.py is the same code I referenced above

$ firefox --version
Mozilla Firefox 45.2.0
$ python test_firefox.py 
Traceback (most recent call last):
  File "test_firefox.py", line 4, in <module>
    driver.get("http://taobao.com")
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
    self.execute(Command.GET, {'url': url})
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
    return self._request(command_info[0], url, body=data)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 433, in _request
    resp = self._conn.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1073, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 415, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 379, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''

Also tried with selenium==2.53.2 to further match your configuration and it still crashed.

@HelioGuilherme66
Copy link

Looks like the problem is with httplib.py.
I have upgraded selenium to 2.53.6 and still runs OK. Differences in Python
2.7.9 vs 2.7.10?

File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py",
line 433, in _request

resp = self._conn.getresponse()

File "/usr/lib/python2.7/httplib.py", line 1073, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 415, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 379, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''

@royragsdale
Copy link
Author

I've tried across a number of other configuration and in some cases it works fine, but I'm having difficulty pinning down what is broken on this one system (only major difference I haven't isolated is the kernel version). I would be happy to continue trying to help trouble shoot this bug if anyone has any other ideas, otherwise feel free to close this since it is inconsistently reproducible.

To summarize

The original system still fails (even with 2.7.10), tested the following configurations:
Debian Jessie
Linux localhost 3.14.0 #1 SMP PREEMPT Wed Jul 6 18:18:53 PDT 2016 x86_64 GNU/Linux
Mozilla Firefox 47.0.1 + (python 2.7.9 or 2.7.10)
Mozilla Firefox 45.2.0 + python 2.7.9

On a fresh testing VM everything seems to work without issue (including python 2.7.9)
Debian Stretch
Linux vagrant 4.6.0-1-amd64 #1 SMP Debian 4.6.4-1 (2016-07-18) x86_64 GNU/Linux
Mozilla Firefox 45.2.0 + (python 2.7.9, 2.7.10, 2.7.12)

On another system everything also seems to work without issue (python 2.7.9)
Debian Jessie
Linux tower 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux
Mozilla Firefox 45.2.0 + python 2.7.9

@Ekkstein
Copy link

Ekkstein commented Aug 1, 2016

I was just about to post that I got the same problem on my mac running Firefox 47 and Selenium 2.53.6. While checking the Firefox version (graphically) I updated to Firefox 47.0.1. Now, I don't know if it really had anything to do with it, but suddenly it works. No clue!

@generalconsensus
Copy link

generalconsensus commented Aug 1, 2016

@AutomatedTester
Copy link
Member

If the browser is crashing, and by crashing I mean it is no longer open (the true meaning of a crash), then there is a bigger problem than Selenium just not doing things. Can you see if you can replicate this with Selenium 3.0 beta?

@HardenDev
Copy link

HardenDev commented Aug 18, 2016

I've also encountered the issue with selenium 2.53.6 / Firefox 47.0.1/Python 2.7.6, do you guys have anything that can fix this or something workaround about this?

@makeapp007
Copy link

@HardenDev I had the same environment and met the same bug as yours. I solved this bug through updating firefox to 48.0. It worked perfectly on selenium 2.53.6 / Firefox 48.0 /Python 2.7.6.

@zqy16
Copy link

zqy16 commented Nov 11, 2016

@royragsdale I also have the same issue with python 2.7.11/Chrome 54.0.2840.87 m/selenium 3.0.1,do you have something to solve?thanks a lot.

@royragsdale
Copy link
Author

@zqy16 unfortunately I never did pin down a good solution.

@macdonjo
Copy link

macdonjo commented Nov 28, 2016

I can reproduce it on my server, but not on my Mac. Instead using PhantomJS as the driver, instead of Firefox.

Mac: OSX El Capitan 10.11.6
Server: CentOS 7.2.1511
Both have PhantomJS version: 2.1.1
Python Mac: Python 2.7.11
Python Server: 2.7.5
Both have Selenium version: 2.53.0

@zqy16
Copy link

zqy16 commented Dec 2, 2016

@royragsdale ,i use Chrome 52.0.2743.82 m (64-bit),and the problem solved.

@andrewgtp
Copy link

I had the same error on OSX 10.10, Chrome 55, Selenium 3.0.2. I grabbed the latest chromedriver 2.27 and its working now: https://chromedriver.storage.googleapis.com/index.html?path=2.27

@macdonjo
Copy link

macdonjo commented Jan 7, 2017

@andrewgtp @zqy16 please stop suggesting Chrome as a bug patch to Firefox.

@cgoldberg
Copy link
Contributor

@alexbegun that sounds like a completely different issue... not sure why you hijacked this thread

@lagin
Copy link

lagin commented Apr 3, 2017

Can not reproduce it.
Windows 10
Python 2.7/3.4
Selenium 3.3.1
Firefox 52.0.2
geckodriver 0.15.0

@bofinbabu
Copy link

@cgoldberg
Copy link
Contributor

@bofinbabu
fwiw, selenium doesn't use the http2 package.

@webjunkie01
Copy link

I also experienced the same issue and found out that my server was running out of memory.

@lmtierney
Copy link
Member

Closing as this cannot be reproduced on newer versions. Please open a new issue with a reproducible test scenario of the issue is experienced again.

@zvolsky
Copy link

zvolsky commented Jul 19, 2018

Need newer versions? CentOS (in VirtualBox on Debian/buster), Py 2.7.5, Selenium 3.13.0, GeckoDriver 0.21.0, Mozilla Firefox 61.0.1

@zvolsky
Copy link

zvolsky commented Jul 19, 2018

https://stackoverflow.com/questions/1767934/why-am-i-getting-this-error-in-python-httplib
exception httplib.BadStatusLine: Raised if a server responds with a HTTP status code that we don’t understand.
In my case I try driver.get() to python.org:
http://python.org and https://www.python.org both work well,
http://www.python.org and https://python.org both fail with BadStatusLine.

@alirezastack
Copy link

It seems that problem happens when my server has low memory. On my MAC everything seems working great by the same code happens to fail on a server with 1GB of RAM and 1 CPU Core.

Linux: Debian 9 -> 4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) x86_64 GNU/Linux
Selenium: 3.13.0
Geckodriver: 0.21.0
Firefox-ESR: 60.0

Does any one else have the sample problem when their server specification is low?

@lock lock bot locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests