Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#21545 closed Bug (fixed)

runserver goes into an infinite loop after first request on OSX.

Reported by: loic84 Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following snippet causes an infinite loop and its customary 100% CPU usage:

events = kqueue.control([], 1)
# After a request, reload the set of watched files.
if len(events) == 1 and events[0].ident == watcher.fileno():
    continue

This is because the event isn't currently cleared, so once the condition becomes True, it remains so indefinitely.

Change History (5)

comment:2 by loic84, 11 years ago

If someone with a mac would like to test that's actually doing the right thing, https://gist.github.com/7752939 would help.

  1. kqueue_code_changed should print each time a reload is performed.
  2. update_watch should print after each request (handler for the request_finished signal).
  3. request_finished should print after update_watch, indicating that the signal handler did wake up the kqueue.

Most importantly, request_finished should print only once after the request, and not repeat itself indefinitely.

comment:3 by Aymeric Augustin, 11 years ago

Triage Stage: UnreviewedAccepted

I fail at man kqueue :(

comment:4 by Loic Bistuer <loic.bistuer@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 9ccde8cfafda03c961343b4523ac035428c4ff25:

Fixed #21545 -- autoreload kqueue events weren't cleared which caused an infinite loop.

comment:5 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In 643180b5d253e2cbc9cfccccafa5b1e35dcf5583:

Merge pull request #2016 from loic/ticket21545

Fixed #21545 -- autoreload kqueue events weren't cleared which caused an infinite loop.

Note: See TracTickets for help on using tickets.
Back to Top