#8622: Exceptions in UploadHandler cause hang
-------------------------------------------+--------------------------------
          Reporter:  kmtracey              |         Owner:  nobody
            Status:  new                   |     Milestone:  1.0   
         Component:  File uploads/storage  |       Version:  SVN   
        Resolution:                        |      Keywords:        
             Stage:  Unreviewed            |     Has_patch:  0     
        Needs_docs:  0                     |   Needs_tests:  0     
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Comment (by vung):

 `request.POST` is computed the first time it is accessed and cached in
 `request._post`; if `request._post` is missing, the `request.POST`
 accessor starts parsing POST data.

 Parsing POST data means that a django.http.!MultiPartParser is
 instantiated and starts reading from the socket.

 If an exception is raised in the meantime, `request._post` is not set and
 any access to request.POST will trigger again the parsing.

 This second parsing happens when the exception is handled, in
 django.core.handlers.base.!BaseHandler.handle_uncaught_exception, which
 calls repr(request), etc.

 A second !MultiPartParser is instantiated and since the first parser
 already consumed some bytes this second one will never get the chance to
 read up to content_length, so it will block waiting for content -- the
 exact place is django.http.!LimitBytes.read()

 I made a small test which reproduces the problem (no solution, though)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8622#comment:5>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to