Code

Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#4953 closed (duplicate)

Starting a subprocess causes incomplete requests in dev server

Reported by: John Shaffer <jshaffer2112@…> Owned by: nobody
Component: django-admin.py runserver Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If you open a subprocess in your view, the request will not be completely sent to the browser. Using subprocess.Popen(process, close_fds=True) will bypass this problem, but close_fds is unimplemented on Windows.

With the following view, the redirect is never received if using the dev server. The dev server will still be active and will continue to serve requests, but any requests to the hang view will not complete. When using mod_python, the redirect will work.

import subprocess
from django import http

def hang(request):
    proc = subprocess.Popen('python')
    return http.HttpResponseRedirect('/')

#3712 might be related.

Attachments (0)

Change History (4)

comment:1 follow-up: Changed 7 years ago by Ramiro Morales

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

IMVHO, having to cope with this kind of specific scenario is very well outside of the scope of the development server. If the mod_python setup works then it may be better to set up a apache+mod_python developent environment.

comment:2 in reply to: ↑ 1 Changed 7 years ago by John Shaffer <jshaffer2112@…>

  • Component changed from Uncategorized to django-admin.py runserver
  • Owner changed from jacob to adrian

Replying to Ramiro Morales:

IMVHO, having to cope with this kind of specific scenario is very well outside of the scope of the development server. If the mod_python setup works then it may be better to set up a apache+mod_python developent environment.

It really depends on the nature of the fix. If it involves many changes, then it probably is not worth applying. But if it's a small change, then there is likely no reason not to apply it.

I'll post again when I have time to try to narrow down the cause, and if I'm able to produce a fix.

comment:3 Changed 7 years ago by PhiR

  • Resolution set to duplicate
  • Status changed from new to closed

dup of #3712 which is invalid.

comment:4 Changed 5 years ago by anonymous

This doesn't seem to be a dup of #3712 or #9286.
Those call p.communicate() once the process is created this one does not.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.