azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

httplib throws BadStatusLine error

Open themaxx75 opened this issue 11 years ago • 4 comments

Started getting the below error this morning. Could that be caused by issues on Azure?

  File "/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/storage/tableservice.py", line 268, in query_entities
    response = self._perform_request(request)
  File "/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/storage/storageclient.py", line 143, in _perform_request
    resp = self._filter(request)
  File "/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/storage/tableservice.py", line 491, in _perform_request_worker
    return self._httpclient.perform_request(request)
  File "/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/http/httpclient.py", line 215, in perform_request
    resp = connection.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1045, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 409, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 373, in _read_status
    raise BadStatusLine(line)
BadStatusLine: ''

themaxx75 avatar Dec 18 '14 20:12 themaxx75

Running the same function, it will also randomly freeze while querying entities in table storage. This freezing is unrecoverable. In a loop that should last for one minute at most, I had to interupt it, and this is where it sits.

/vagrant/webapps_root/mamba/tasks.py in hunter_cm_versions()
   1839         while entities_delay > datetime.datetime.utcnow():
   1840             entities = tableservice.query_entities(
-> 1841                 'WebSites', "PartitionKey eq 'website'")
   1842             break
   1843

/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/storage/tableservice.pyc in query_entities(self, table_name, filter, select, top, next_partition_key, next_row_key)
    266             request, self.use_local_storage)
    267         request.headers = _update_storage_table_header(request)
--> 268         response = self._perform_request(request)
    269
    270         return _convert_response_to_feeds(response, _convert_xml_to_entity)

/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/storage/storageclient.pyc in _perform_request(self, request, text_encoding)
    141                 return self._batchclient.insert_request_to_batch(request)
    142             else:
--> 143                 resp = self._filter(request)
    144
    145             if sys.version_info >= (3,) and isinstance(resp, bytes) and \

/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/storage/tableservice.pyc in _perform_request_worker(self, request)
    489                                            self.account_key)
    490         request.headers.append(('Authorization', auth))
--> 491         return self._httpclient.perform_request(request)

/home/vagrant/venv/webapps/local/lib/python2.7/site-packages/azure/http/httpclient.pyc in perform_request(self, request)
    213                     pass
    214
--> 215             resp = connection.getresponse()
    216             self.status = int(resp.status)
    217             self.message = resp.reason

/usr/lib/python2.7/httplib.pyc in getresponse(self, buffering)
   1043         response = self.response_class(*args, **kwds)
   1044
-> 1045         response.begin()
   1046         assert response.will_close != _UNKNOWN
   1047         self.__state = _CS_IDLE

/usr/lib/python2.7/httplib.pyc in begin(self)
    407         # read until we get a non-100 response
    408         while True:
--> 409             version, status, reason = self._read_status()
    410             if status != CONTINUE:
    411                 break

/usr/lib/python2.7/httplib.pyc in _read_status(self)
    363     def _read_status(self):
    364         # Initialize with Simple-Response defaults
--> 365         line = self.fp.readline(_MAXLINE + 1)
    366         if len(line) > _MAXLINE:
    367             raise LineTooLong("header line")

/usr/lib/python2.7/socket.pyc in readline(self, size)
    474             while True:
    475                 try:
--> 476                     data = self._sock.recv(self._rbufsize)
    477                 except error, e:
    478                     if e.args[0] == EINTR:

/usr/lib/python2.7/ssl.pyc in recv(self, buflen, flags)
    339                     "non-zero flags not allowed in calls to recv() on %s" %
    340                     self.__class__)
--> 341             return self.read(buflen)
    342         else:
    343             return self._sock.recv(buflen, flags)

/usr/lib/python2.7/ssl.pyc in read(self, len)
    258
    259         try:
--> 260             return self._sslobj.read(len)
    261         except SSLError, x:
    262             if x.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs:

KeyboardInterrupt:

themaxx75 avatar Dec 19 '14 17:12 themaxx75

I just verified that all our table service SDK tests are passing on Python 2.7, using a West US storage account.

To see if there are (or the history of) outages, you can check this page: http://azure.microsoft.com/en-us/status/

If you still have the problem, and it's not something that changed on your end, maybe it's an issue they are not aware of, or an issue with that particular storage account you used? You could try creating another storage account, in a different region.

If you think it's an issue with the SDK, then please post some minimal repro code so we can try it out on our end.

huguesv avatar Dec 19 '14 17:12 huguesv

Thanks for the reply. I will be on vacation in the next weeks, so I'll try posting more details then. In the meantime, I'm working around it by putting a timeout on a function that fetches the table storage.

For context, I'm simply fetching results from table storage, by doing: entities = tableservice.query_entities('WebSites', "PartitionKey eq 'website'") It's a this point that once in a while, it will never return. The code uses 3 different storage accounts on 2 different subscriptions. The issue exists while running inside Azure and outside in my test environment.

If I see the issue persisting in my log, I will open a ticket with Azure support. Though it would be interesting to know if the SDK is hanging.

Thanks again.

themaxx75 avatar Dec 19 '14 21:12 themaxx75

Closing due to inactivity, seems OK. Please feel free to open a new bug otherwise!

lmazuel avatar Dec 22 '15 19:12 lmazuel