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)
Change History (20)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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 , 14 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
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 , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Yes - it is just an eyesore. And yes, it should be cleaned up.
by , 14 years ago
Attachment: | patch-django_core_servers_basehttp_py added |
---|
comment:5 by , 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 , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Cleanup/optimization |
by , 14 years ago
Attachment: | 14273.dev-server-shutdown.diff added |
---|
follow-up: 8 comment:7 by , 14 years ago
I think the attached patch is a bit better. Could you test it under OpenBSD?
comment:8 by , 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 , 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 , 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 , 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:14 by , 12 years ago
Status: | reopened → new |
---|
comment:15 by , 11 years ago
Cc: | added |
---|
Could you please try out with Django 1.4 or newer? Only to confirm that a patch is still needed.
comment:16 by , 11 years ago
Patch needs improvement: | set |
---|
comment:17 by , 11 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 , 10 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Sorry, should have specified. This occurred on OpenBSD current using either Python 2.6.5 and 2.6.6.