#1386 new defect

KeyError: 'file' if the local file is removed after selection and before Submit

Reported by: zooko Owned by: daira
Priority: normal Milestone: soon
Component: code-frontend-web Version: 1.8.2
Keywords: http upload error easy Cc: joepie91
Launchpad Bug:

Description (last modified by daira)

I left a large upload running through the WUI overnight. In the morning it was still running, but I accidentally hit the "private browsing" key in Firefox 4 and then hit it again. This seems to have aborted the upload (which was probably still transferring the file from the web browser to the tahoe-lafs gateway and had probably not even begun to upload from the tahoe-lafs gateway to the tahoe-lafs servers). So, I clicked the Upload button again, and to my surprise I got this traceback:

2011-03-31 05:39:07-0600 [HTTPChannel,21,127.0.0.1] Unhandled Error
        Traceback (most recent call last):
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 297, in addCallback
            callbackKeywords=kw)
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 286, in addCallbacks
            self._runCallbacks()
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 542, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/Users/owhielaclient/tahoe-lafs/support/lib/python2.6/site-packages/Nevow-0.10.0-py2.6.egg/nevow/appserver.py", line 163, in gotPageContext
            pageContext.tag.renderHTTP, pageContext
        --- <exception caught here> ---
          File "/Library/Python/2.6/site-packages/Twisted-10.2.0-py2.6-macosx-10.6-universal.egg/twisted/internet/defer.py", line 133, in maybeDeferred
            result = f(*args, **kw)
          File "/Users/owhielaclient/tahoe-lafs/src/allmydata/web/common.py", line 302, in renderHTTP
            return m(ctx)
          File "/Users/owhielaclient/tahoe-lafs/src/allmydata/web/directory.py", line 202, in render_POST
            d = self._POST_upload(ctx) # this one needs the context
          File "/Users/owhielaclient/tahoe-lafs/src/allmydata/web/directory.py", line 307, in _POST_upload
            contents = req.fields["file"]
          File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/cgi.py", line 520, in __getitem__
            raise KeyError, key
        exceptions.KeyError: 'file'

I'll attach the debugging output that the gateway returned to my browser.

Attachments (1)

Exception.html (9.7 KB) - added by zooko at 2011-03-31T12:14:32Z.

Download all attachments as: .zip

Change History (9)

Changed at 2011-03-31T12:14:32Z by zooko

comment:1 Changed at 2011-03-31T12:43:07Z by zooko

Oh, I see something. I had unplugged the external hard drive that holds the file itself. So apparently if you have selected a file in FF4, and then unmount the filesystem that holds that file, and then click the submit button, then it submits a POST request with no 'file' key so that we get this exception from directory.py line 307. On the other hand if you click the submit button without selecting a file at all then you get the error response "upload requires a name" from directory.py line 315.

comment:2 Changed at 2011-03-31T12:43:47Z by zooko

  • Keywords error added

comment:3 Changed at 2011-07-27T16:15:29Z by davidsarah

  • Keywords easy added
  • Milestone changed from undecided to 1.10.0
  • Owner set to davidsarah
  • Status changed from new to assigned

comment:4 Changed at 2012-01-15T15:23:20Z by zooko

  • Summary changed from KeyError: 'file' to KeyError: 'file' if the local file is removed after selection and before Submit

comment:5 Changed at 2012-04-01T04:10:24Z by davidsarah

  • Milestone changed from 1.11.0 to 1.10.0

comment:6 Changed at 2012-04-01T04:10:56Z by davidsarah

  • Priority changed from major to normal

comment:7 Changed at 2012-12-13T17:14:30Z by davidsarah

  • Milestone changed from 1.10.0 to 1.11.0

comment:8 Changed at 2013-07-06T19:41:56Z by daira

  • Cc joepie91 added
  • Description modified (diff)
  • Owner changed from davidsarah to daira
  • Status changed from assigned to new

joepie91 hit a bug that seems to be related, although it happens for the 'view' rather than 'upload' form:

(16:37:52) joepie91: anyway, when I entered a tahoe URI into "Tahoe-URI to view" in the web interface (while trying to debug pytahoe stuff for Skindred) I ran across a HTTP 500 error

http://sebsauvage.net/paste/?03067551c3dad496#bbEEGUTHGpOycW6LJYY+YKAmslalIWARLjE+tYuWfdg=

Note that the exception in that paste is thrown from the same place in the cgi module as in attachment:Exception.html .

Note: See TracTickets for help on using tickets.