Opened 19 months ago

Closed 19 months ago

Last modified 19 months 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: master
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:1 Changed 19 months ago by loic84

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

comment:2 Changed 19 months ago by loic84

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 Changed 19 months ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

I fail at man kqueue :(

comment:4 Changed 19 months ago by Loic Bistuer <loic.bistuer@…>

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

In 9ccde8cfafda03c961343b4523ac035428c4ff25:

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

comment:5 Changed 19 months ago by Aymeric Augustin <aymeric.augustin@…>

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