question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

http_compress=True results in ProtocolError(('Connection aborted.', BadStatusLine("''",)))

See original GitHub issue
es = Elasticsearch(hosts=['http://localhost:9200'], http_compress=True)
res = es.index(index="test-index", doc_type='testtype', body={'text': 'test'})

raises

  File "tst.py", line 16, in main
    res = es.index(index="test-index", doc_type='testtype', body=doc)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/client/utils.py", line 76, in _wrapped
    return func(*args, params=params, **kwargs)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 319, in index
    _make_path(index, doc_type, id), params=params, body=body)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 318, in perform_request
    status, headers_response, data = connection.perform_request(method, url, params, body, headers=headers, ignore=ignore, timeout=timeout)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 181, in perform_request
    raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.', BadStatusLine("''",))) caused by: ProtocolError(('Connection aborted.', BadStatusLine("''",)))

If I disable http_compress, it works as expected.

Env:

elasticsearch-6.3.1
urllib3-1.23
elasticsearch-oss  6.4.2
http.compression: true
Ubuntu 18.04.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
itayBcommented, Jul 2, 2019

I think that a workaround might be to choose a different transport layer (but I didn’t check if it really compressing requests) : Elasticsearch(hosts=[{"host": "localhost", "port": 9200}], connection_class=RequestsHttpConnection, http_compress=True)

Note that it requires requests installation: pip install requests

1reaction
akhilmathew001commented, Jun 25, 2019

I am also facing the same issue as described by @itayB. With http_compress = True it’s not working and without that param, it’s working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python requests.exception.ConnectionError - Stack Overflow
The problem was with the url. This connection was meant to be established over https and I was using http in the python...
Read more >
1248167 – [RHCI] Connection aborted BadStatusLIne during ...
This error occurs when the upstream server returns an HTTP status line (e.g. 'HTTP/1.1 200 OK') that can't be parsed by Python's httplib....
Read more >
connection aborted bad statusline - Google Groups
urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",)). During handling of the above exception, another exception occurred:.
Read more >
ConnectionError: ('Connection aborted.', BadStatusLine
It is telling you there was a bad status line, and what the bad status line contents was. (Used to be you couldn't...
Read more >
('Connection aborted.', BadStatusLine("''",)) - Bugzilla@Mozilla
Intermittent ConnectionError: ('Connection aborted.', BadStatusLine("''",)).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found