[SOLVED ]Elasticsearch-py scroll-id http.client.BadStatusLine: ''

Hello,

Name: elasticsearch
Version: 2.3.0
Location: /usr/lib/python3.4/site-packages
Requires: urllib3

When i use scan/scroll with a large result (>1M), i have this error :

GET http://localhost:9200/_search/scroll?scroll=1m [status:N/A request:2.608s]
...
http.client.BadStatusLine: ''

After my research, this bug is already fixed here

My scroll_id make 2316 chars

If i check "elasticsearch/client/init.py", i see line 681

return self.transport.perform_request('GET', '/_search/scroll',
params=params, body=body)

So, its another bug or its the same ?

Thank for help

I think is not the same bug. I test different scroll_id with same length, and sometime works, sometime not.

The Full error message

GET http://localhost:9200/_search/scroll?scroll=2m [status:N/A request:4.500s]

Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 321, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3.4/site-packages/urllib3/util/retry.py", line 222, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3.4/site-packages/urllib3/packages/six.py", line 309, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 321, in _read_status
raise BadStatusLine(line)
urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",))
GET http://localhost:9200/_search/scroll?scroll=2m [status:N/A request:5.014s]
Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 376, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 321, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.4/site-packages/elasticsearch/connection/http_urllib3.py", line 94, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3.4/site-packages/urllib3/util/retry.py", line 222, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3.4/site-packages/urllib3/packages/six.py", line 309, in reraise
raise value.with_traceback(tb)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 378, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
response.begin()
File "/usr/lib/python3.4/http/client.py", line 351, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.4/http/client.py", line 321, in _read_status
raise BadStatusLine(line)
urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",))

I fixed this bug.

The cause is ES_HEAD_SIZE by default to small.