glance api is tracebacking with "error: [Errno 32] Broken pipe"

Bug #1342080 reported by Joe Gordon
48
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Medium
Sabari Murugesan
python-glanceclient (Ubuntu)
Fix Released
Medium
Unassigned
Trusty
Triaged
Medium
Unassigned
Utopic
Won't Fix
Medium
Unassigned
Vivid
Triaged
Medium
Unassigned
Wily
Fix Released
Medium
Unassigned

Bug Description

127.0.0.1 - - [15/Jul/2014 10:55:39] code 400, message Bad request syntax ('0')
127.0.0.1 - - [15/Jul/2014 10:55:39] "0" 400 -
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/eventlet/greenpool.py", line 80, in _spawn_n_impl
    func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 584, in process_request
    proto.__init__(socket, address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 342, in handle
    self.handle_one_request()
  File "/usr/lib/python2.7/dist-packages/eventlet/wsgi.py", line 247, in handle_one_request
    if not self.parse_request():
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 286, in parse_request
    self.send_error(400, "Bad request syntax (%r)" % requestline)
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 395, in send_response
    self.send_header('Server', self.version_string())
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 401, in send_header
    self.wfile.write("%s: %s\r\n" % (keyword, value))
  File "/usr/lib/python2.7/socket.py", line 324, in write
    self.flush()
  File "/usr/lib/python2.7/socket.py", line 303, in flush
    self._sock.sendall(view[write_offset:write_offset+buffer_size])
  File "/usr/lib/python2.7/dist-packages/eventlet/greenio.py", line 307, in sendall
    tail = self.send(data, flags)
  File "/usr/lib/python2.7/dist-packages/eventlet/greenio.py", line 293, in send
    total_sent += fd.send(data[total_sent:], flags)
error: [Errno 32] Broken pipe

http://logs.openstack.org/62/100162/3/check/check-tempest-dsvm-full/77badd4/logs/screen-g-api.txt.gz?level=INFO#_2014-07-15_10_55_39_729

Seen all over the gate. Seeing stacktraces like thi

Tags: api oil
Revision history for this message
Kashyap Chamarthy (kashyapc) wrote :
Revision history for this message
Kashyap Chamarthy (kashyapc) wrote :

Err, the above comment is meant to read as "Last 48 hour", and it's 500 hits.

Revision history for this message
Bob Ball (bob-ball) wrote :
Revision history for this message
Erno Kuvaja (jokke) wrote :

Seems to be still going on.

Changed in glance:
status: New → Confirmed
tags: added: api
Revision history for this message
Yang Yu (yuyangbj) wrote :

I also see this bug, what OS did you use? Ubuntu 12.04?

Changed in glance:
assignee: nobody → Sabari Murugesan (smurugesan)
Revision history for this message
Sabari Murugesan (smurugesan) wrote :

The traceback can be attributed both to python-glanceclient & 'request' library.

python-glanceclient: During chunked http image upload, we create a chunk for EOF while reading image file. Glance-api treats this as the end of chunked transmission and sends a 201 response. But the 'requests' library also sends the last-chunk for which the server tries to respond with 400 but tracebacks because the client has already closed the socket. I have uploaded a patch to correct the behavior in python-glanceclient.

'requests': httplib checks chunk_size in request.body before sending over socket. If it's empty it assumes end-of-transmission and does not send to the server. But 'requests' doesn't seem to do so. I am planning to provide a pull-request to 'requests'.

Revision history for this message
Sabari Murugesan (smurugesan) wrote :

Forgot to mention, either of the fix will solve the issue.

Revision history for this message
Sabari Murugesan (smurugesan) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/142952

Changed in glance:
status: Confirmed → In Progress
Feilong Wang (flwang)
Changed in glance:
importance: Undecided → Medium
affects: glance → python-glanceclient
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-glanceclient (master)

Reviewed: https://review.openstack.org/142952
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=e3600ad7beb7cb4a067038d750e530a64fd1e93a
Submitter: Jenkins
Branch: master

commit e3600ad7beb7cb4a067038d750e530a64fd1e93a
Author: Sabari Kumar Murugesan <email address hidden>
Date: Thu Dec 18 16:52:07 2014 -0800

    Fix broken-pipe seen in glance-api

    When file size is an exact multiple of chunk_size, glance client
    is processing EOF in image-data as a chunk and sends to
    glance-api. The server treats this as the end of chunked
    transmission and sends a http response.

    When the actual last chunk is sent by the 'requests' library, the
    server sends a 400 response and tracebacks with broken pipe
    as the client has already closed the socket.

    Closes-Bug: #1342080
    Change-Id: Icdbff838450db1c252ddc919a230a7d3ca16765f

Changed in python-glanceclient:
status: In Progress → Fix Committed
Revision history for this message
Sabari Murugesan (smurugesan) wrote :

FYI: Also submitted a pull request to 'requests' library https://github.com/kennethreitz/requests/pull/2388. This will help other such clients sending empty chunks.

Louis Taylor (kragniz)
Changed in python-glanceclient:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-glanceclient (Ubuntu):
status: New → Confirmed
Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Still seeing this in Ubuntu Vivid with python-glanceclient=1:0.15.0-0ubuntu1, any chance to get this backported?

tags: added: oil
Revision history for this message
James Page (james-page) wrote :

Fixed in 0.16.0 - marking fix released for Wily (has 0.19.0).

Changed in python-glanceclient (Ubuntu Wily):
status: Confirmed → Fix Released
Changed in python-glanceclient (Ubuntu Vivid):
importance: Undecided → Medium
Changed in python-glanceclient (Ubuntu Utopic):
importance: Undecided → Medium
Changed in python-glanceclient (Ubuntu Trusty):
importance: Undecided → Medium
status: New → Triaged
Changed in python-glanceclient (Ubuntu Utopic):
status: New → Triaged
Changed in python-glanceclient (Ubuntu Vivid):
status: New → Triaged
Changed in python-glanceclient (Ubuntu Wily):
importance: Undecided → Medium
Revision history for this message
Rolf Leggewie (r0lf) wrote :

utopic has seen the end of its life and is no longer receiving any updates. Marking the utopic task for this ticket as "Won't Fix".

Changed in python-glanceclient (Ubuntu Utopic):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.