Unpredictable upload failures

Bug #1767988 reported by Jesper Öqvist
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
launchpadlib
New
Undecided
Unassigned

Bug Description

I have a script that automates the process of uploading files for a new release in a project I maintain. It has worked fine in the past, for numerous releases, but it has now become unpredictable and often fails with this error:

Traceback (most recent call last):
  File "./shipit.py", line 409, in lp_upload_file
    file_type=FILE_TYPES[file_type])
  File "/usr/local/lib/python2.7/dist-packages/lazr/restfulclient/resource.py", line 607, in __call__
    extra_headers=extra_headers)
  File "/usr/local/lib/python2.7/dist-packages/lazr/restfulclient/_browser.py", line 431, in _request
    raise error
BadRequest: HTTP Error 400: Bad Request
Response headers:
---
connection: close
content-length: 61
content-type: text/plain;charset=utf-8
date: Mon, 30 Apr 2018 09:36:00 GMT
server: zope.server.http (HTTP)
status: 400
strict-transport-security: max-age=15552000
vary: Accept
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-launchpad-revision: 13849
x-lazr-notifications: []
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-xss-protection: 1; mode=block
---
Response body:
---
signature_content: Cannot upload files larger than 1024 bytes
---

The files I try to upload are all larger than 1K and smaller than 4MB, and I can manually upload them to the release without problem. The signature content is only 522 bytes. I've tried this both on staging.launchpad.net and the production site.

This is the call in my script that fails:

                        release_file = release.add_file(
                                filename=filename,
                                description=description,
                                file_content=open('build/' + filename, 'rb').read(),
                                signature_content=open('build/' + signature_fn, 'rb').read(),
                                signature_filename=signature_fn,
                                content_type=content_type,
                                file_type=FILE_TYPES[file_type])

Revision history for this message
Jesper Öqvist (jesper-oqvist) wrote :

My launchpadlib version is 1.10.6, installed with pip.

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.