Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#22991 closed Bug (fixed)

Development server not reloading with *.pyc files and without inotify

Reported by: lorinkoz@… Owned by: nobody
Component: Core (Management commands) Version: 1.7-rc-1
Severity: Release blocker Keywords:
Cc: anubhav9042@…, cmawebsite@…, Stephen Burrows Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm on Windows, not sure when this started to happen but the development server is not restarting/reloading anymore when I change code in models.py. I'm not using pynotify.

Change History (14)

comment:1 Changed 9 years ago by Tim Graham

Cc: anubhav9042@… added
Summary: Development server reloadingDevelopment server not reloading on Windows
Type: UncategorizedBug

Anubhav, can you reproduce this? If so, could you bisect the regression?

comment:2 Changed 9 years ago by Tim Graham

#23020 reports the same issue on Mac OS X, but I have no problems on Linux.

comment:3 Changed 9 years ago by Collin Anderson

I can confirm it doesn't work and bisected it to 1bb8ccdb9e70bee35759f2ada4d661481852ab95 (Fixed pyinotify performance regression)

comment:4 Changed 9 years ago by Tim Graham

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:5 Changed 9 years ago by Collin Anderson

Summary: Development server not reloading on WindowsDevelopment server not reloading with *.pyc files and without inotify

Ok, I can reproduce it on Ubuntu 12.04 by uninstalling python-inotify (pyinotify) and turning off sys.dont_write_bytecode (PYTHONDONTWRITEBYTECODE). It's happening on all platforms, so I'll mark #23020 as a duplicate.

comment:6 Changed 9 years ago by Collin Anderson

Needs tests: set

*.pyc filenames are ending up in _cached_filenames, and then being returned from the cache without being converted from .pyc to .py. This change caches the *.py filenames instead.
https://github.com/django/django/pull/2913

I also noticed an inconsistency with _error_files. It's not clear if or when those should be added to _cached_filenames and if and when inotify needs to start watching them.

I would appreciate someone else writing a test case.

comment:7 Changed 9 years ago by Collin Anderson

Has patch: set

comment:8 Changed 9 years ago by Collin Anderson

Cc: cmawebsite@… added

comment:9 Changed 9 years ago by Collin Anderson

_error_files handles cases from #9589 and #8413. I bet those have also regressed.

comment:10 Changed 9 years ago by Stephen Burrows

Cc: Stephen Burrows added

comment:11 Changed 9 years ago by Collin Anderson

I actually can't reproduce any _error_files issues. It seems that nowadays, either the framework fully stops the process on models.py and admin.py errors before the autoreloader starts (would be nice to fix someday), or in other files, like views.py, it can handle re-importing the bad files without needing to reload.

Last edited 9 years ago by Collin Anderson (previous) (diff)

comment:12 Changed 9 years ago by Claude Paroz

Needs tests: unset

I've slightly adapted the PR from Collin and added a one-line test in https://github.com/django/django/pull/2918

comment:13 Changed 9 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In 4e424084e6d796f7ed5f215330cd0b98287c1300:

Fixed #22991 -- Prevented *.pyc files in autoreload monitoring

This fixes a regression introduced in 6d302f639.
Thanks lorinkoz at gmail.com for the report, Collin Anderson
for the initial patch and Simon Charette for the review.

comment:14 Changed 9 years ago by Claude Paroz <claude@…>

In f2011e21a2d803ab6328852c3af4a4bf6701b11d:

[1.7.x] Fixed #22991 -- Prevented *.pyc files in autoreload monitoring

This fixes a regression introduced in 6d302f639.
Thanks lorinkoz at gmail.com for the report, Collin Anderson
for the initial patch and Simon Charette for the review.
Backport of 4e424084e from master.

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