Opened 14 years ago

Closed 10 years ago

#14273 closed Cleanup/optimization (worksforme)

Development server does not shutdown cleanly

Reported by: rmboggs Owned by: nobody
Component: Core (Other) Version: 1.2
Severity: Normal Keywords: runserver
Cc: unai@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I am able to run the development server for testing but when I hit Ctrl-C to stop it, the error below is thrown. It is occurring in versions 1.2.1, 1.2.2, and 1.2.3. It's not preventing usage that I can see but it is a bit of an eyesore.

Thanks,
Ryan

$: python manage.py runserver
Validating models...
0 errors found

Django version 1.2.1, using settings 'mayham.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
^CUnhandled exception in thread started by <function inner_run at 0x872cc8b4>
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 60, in inner_run
    run(addr, int(port), handler)
  File "/usr/local/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 721, in run
    httpd.serve_forever()
  File "/usr/local/lib/python2.6/SocketServer.py", line 224, in serve_forever
    r, w, e = select.select([self], [], [], poll_interval)
select.error: (4, 'Interrupted system call')

Attachments (2)

patch-django_core_servers_basehttp_py (718 bytes ) - added by rmboggs 14 years ago.
14273.dev-server-shutdown.diff (684 bytes ) - added by Julien Phalip 14 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 by rmboggs, 14 years ago

Sorry, should have specified. This occurred on OpenBSD current using either Python 2.6.5 and 2.6.6.

comment:2 by mariarchi, 14 years ago

Resolution: wontfix
Status: newclosed

It's not a bug.
By pressing ctrl+c while the system call is executed (select.select) you're indeed interrupting it, which django tells you.

comment:3 by rmboggs@…, 14 years ago

Resolution: wontfix
Status: closedreopened

Yes, I am interrupting it because django is telling me to hit CONTROL-C to quit the development server. No offense intended but it seems like a bug to me if an error occurs while following django's directions.

If I am understanding right, this error is just an eyesore. CONTROL-C quits the dev server like it is suppose to but just displays that error. It works normally for Linux systems but on OpenBSD, the error appears.

comment:4 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

Yes - it is just an eyesore. And yes, it should be cleaned up.

comment:5 by rmboggs, 14 years ago

Has patch: set

The attached patch catches this specific issue but raises anything else. It worked during my tests on OpenBSD and should be good across the board. Please commit patch if acceptable. If not, please let me know what else is needed so I can make the appropriate corrections.

comment:6 by Julien Phalip, 14 years ago

Severity: Normal
Type: Cleanup/optimization

by Julien Phalip, 14 years ago

comment:7 by Julien Phalip, 14 years ago

I think the attached patch is a bit better. Could you test it under OpenBSD?

in reply to:  7 comment:8 by rmboggs, 14 years ago

Replying to julien:

I think the attached patch is a bit better. Could you test it under OpenBSD?

Yeah, I'll give it a try today...

comment:9 by rmboggs, 14 years ago

I just tried the patch you provided on the latest snapshot of OpenBSD and it is not catching the exception. It's unfortunate because that patch did look cleaner than the one I provided.

Is there anything else that I can do to clean up the patch I provided to get it committed?

comment:10 by Julien Phalip, 14 years ago

Could you track down which exception is actually raised, if any, on OpenBSD? Maybe try placing a breakpoint in a plain try/except statement using pdb (http://docs.python.org/release/2.5.2/lib/module-pdb.html).

comment:11 by rmboggs, 14 years ago

Well, the exception that is raised is in the original description of this ticket. It looks like it originates in Python's SocketServer.py. I'll start digging around there unless there is a better suggestion...

comment:12 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:13 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:14 by Aymeric Augustin, 12 years ago

Status: reopenednew

comment:15 by Unai Zalakain, 11 years ago

Cc: unai@… added

Could you please try out with Django 1.4 or newer? Only to confirm that a patch is still needed.

comment:16 by Tim Graham, 11 years ago

Patch needs improvement: set

comment:17 by Markus Amalthea Magnuson, 10 years ago

I can't reproduce this in Django 1.5.5 running on OpenBSD 5.5.

Doing Ctrl-C just gets be back to prompt, no traceback, just as in e.g. Mac OS.

comment:18 by Tim Graham, 10 years ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top