Opened 7 years ago

Closed 7 years ago

#27630 closed Bug (invalid)

Autoreload continuously reloads when not using pyinotify

Reported by: Michael Lauria Owned by: nobody
Component: Utilities Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In https://github.com/django/django/blob/master/django/utils/autoreload.py, the function code_changed uses st_mtime without taking into account floating point errors, which in some cases can cause runserver to reload over and over again.

For instance:

$ [os.stat(file).st_mtime for file in os.listdir(os.getcwd())[:3]]
[1464887244.822038, 1482518222.822038, 1464887244.822038]
$ [os.stat(file).st_mtime for file in os.listdir(os.getcwd())[:3]]
[1464887244.380515, 1482518222.380515, 1464887244.380515]
$ [os.stat(file).st_mtime for file in os.listdir(os.getcwd())[:3]]
[1464887244.1597567, 1482518222.1597567, 1464887244.1597567]

Change History (3)

comment:1 by Tim Graham, 7 years ago

Component: UncategorizedUtilities
Type: UncategorizedBug

It sounds like you're doing nothing on your computer and runserver is reloading over and over -- is that correct?

Could you add some more details? The code snippet doesn't help me to understand the issue. Thanks.

comment:2 by Michael Lauria, 7 years ago

Actually I think this is an issue with Docker and not Django. The issue is that the timestamps change a little every time in a mounted volume, like so:

Access: 2016-12-24 00:08:37.118410672 +0000
Modify: 2016-12-24 00:08:35.118410672 +0000
Change: 2016-12-24 00:08:35.118410672 +0000

Access: 2016-12-24 00:08:37.117298381 +0000
Modify: 2016-12-24 00:08:35.117298381 +0000
Change: 2016-12-24 00:08:35.117298381 +0000

comment:3 by Tim Graham, 7 years ago

Resolution: invalid
Status: newclosed

Okay, feel free to reopen with more details if Django is found to be at fault.

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