Skip to content

Plugin reload limitations - #13007

Merged
SchrodingersGat merged 5 commits into
inventree:masterfrom
SchrodingersGat:plugin-reload-bug
Oct 13, 2026
Merged

SchrodingersGat merged 5 commits into
inventree:masterfrom
SchrodingersGat:plugin-reload-bug

Conversation

@SchrodingersGat

Copy link
Copy Markdown
Member

There are limitations to how far "auto plugin reload" can go, as the automatic reload functionality:

  • Cannot reload binary plugins
  • Does not reload any updated dependencies

This can result in circular plugin reload cycles, with different processes fighting over the plugin hash indefinitely.

This PR:

  • Improved auto-reload functionality
  • Adds documentation around plugin reload capabilities
  • Detects plugin reload cycles and reports an error if detected

@netlify

netlify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit bc24625
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6acdbdf5d6fa3bd46728f528

@SchrodingersGat SchrodingersGat added enhancement This is an suggested enhancement or new feature plugin Plugin ecosystem labels Oct 13, 2026
@SchrodingersGat SchrodingersGat added this to the 1.6.0 milestone Oct 13, 2026
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.52174% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.25%. Comparing base (e0f3d29) to head (bc24625).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #13007    +/-   ##
========================================
  Coverage   87.25%   87.25%            
========================================
  Files        1512     1512            
  Lines      104094   104315   +221     
  Branches    11760    11789    +29     
========================================
+ Hits        90827    91025   +198     
- Misses      13204    13223    +19     
- Partials       63       67     +4     
Flag Coverage Δ
backend 92.06% <96.52%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 92.68% <96.52%> (+0.01%) ⬆️
Backend General 94.52% <ø> (ø)
Frontend 79.41% <ø> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat
SchrodingersGat merged commit 788b291 into inventree:master Oct 13, 2026
48 checks passed
@SchrodingersGat
SchrodingersGat deleted the plugin-reload-bug branch October 13, 2026 09:46
lucaci32u4 added a commit to Alacrity-Education/InvenTree that referenced this pull request Oct 15, 2026
reload_plugins() re-populates the Django apps registry (registry._reload_apps)
while apps.ready is False, so the Apps.clear_cache() calls populate() makes
skip the per-model cache expiry. Relation trees and field caches built before
the reload then never learn about models registered during it.

Since inventree#13007 the plugin package is purged from sys.modules on every collect,
so a plugin's models module is imported inside populate() rather than by
AppMixin._reregister_contrib_apps() afterwards (which reloaded it with the
registry ready, expiring the caches as a side effect). After a reload, core
models no longer know the plugin's foreign keys: reverse accessors are
missing and on_delete cascades are not collected, so deleting a Group or a
User referenced by a plugin table fails on the database constraint.

Call apps.clear_cache() once the registry is populated again.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This is an suggested enhancement or new feature plugin Plugin ecosystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants