Opened 6 years ago

Closed 22 months 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


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.


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

Django version 1.2.1, using settings 'mayham.settings'
Development server is running at
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/", line 60, in inner_run
    run(addr, int(port), handler)
  File "/usr/local/lib/python2.6/site-packages/django/core/servers/", line 721, in run
  File "/usr/local/lib/python2.6/", line 224, in serve_forever
    r, w, e =[self], [], [], poll_interval)
select.error: (4, 'Interrupted system call')

Attachments (2)

patch-django_core_servers_basehttp_py (718 bytes) - added by rmboggs 5 years ago. (684 bytes) - added by julien 5 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 Changed 6 years ago by rmboggs

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

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

comment:2 Changed 5 years ago by mariarchi

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

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

comment:3 Changed 5 years ago by rmboggs@…

  • Resolution wontfix deleted
  • Status changed from closed to 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 Changed 5 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

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

Changed 5 years ago by rmboggs

comment:5 Changed 5 years ago by rmboggs

  • 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 Changed 5 years ago by julien

  • Severity set to Normal
  • Type set to Cleanup/optimization

Changed 5 years ago by julien

comment:7 follow-up: Changed 5 years ago by julien

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

comment:8 in reply to: ↑ 7 Changed 5 years ago by rmboggs

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 Changed 5 years ago by rmboggs

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 Changed 5 years ago by julien

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 (

comment:11 Changed 5 years ago by rmboggs

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

comment:12 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:13 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:14 Changed 3 years ago by aaugustin

  • Status changed from reopened to new

comment:15 Changed 3 years ago by unaizalakain

  • 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 Changed 3 years ago by timo

  • Patch needs improvement set

comment:17 Changed 2 years ago by giuliettamasina

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 Changed 22 months ago by timo

  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.
Back to Top