Auto-reload causes all DB queries to fail in debug mode

Bug #1398390 reported by Roman Prykhodchenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Committed
High
Roman Prykhodchenko

Bug Description

The problem is that web.py tries reloading modules at some point and while it does that it expects that modules could be reloaded in any order without raising any errors.

Unfortunately for Nailgun that condition is not satisfied in at least one place. That place is SQLAlchemy models which are placed in different modules. If web.py tries to reload any model’s module, say notifications.py, before reloading base module, Notifications will try registering itself in the old Base’s MetaData which already contain info about the appropriate table and that causes errors like "Table 'notifications' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.” That problem happens on every request that touches database.

Tags: db nailgun
Changed in fuel:
status: New → Confirmed
Changed in fuel:
assignee: nobody → Fuel Python Team (fuel-python)
Revision history for this message
Ihor Kalnytskyi (ikalnytskyi) wrote :

The issue doesn't occur in production env, so I propose to fix it in 6.1.

Changed in fuel:
milestone: 6.0 → 6.1
Revision history for this message
Roman Prykhodchenko (romcheg) wrote :

@Igor: It breaks CI after run_test.sh was fixed: https://review.openstack.org/#/c/137702/

Changed in fuel:
milestone: 6.1 → 6.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (master)

Fix proposed to branch: master
Review: https://review.openstack.org/138564

Changed in fuel:
assignee: Fuel Python Team (fuel-python) → Roman Prykhodchenko (romcheg)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-web (master)

Reviewed: https://review.openstack.org/138564
Committed: https://git.openstack.org/cgit/stackforge/fuel-web/commit/?id=80f69722a8f23a8bab754942d372e56d3a3f8ece
Submitter: Jenkins
Branch: master

commit 80f69722a8f23a8bab754942d372e56d3a3f8ece
Author: Roman Prykhodchenko <email address hidden>
Date: Tue Dec 2 23:34:13 2014 +0100

    Disable auto-reload

    Auto-reload seems to cause problems with sqlalchemy MetaData
    because it assumes that load order does not make any difference.

    This patch disables implecit auto-reload in debug mode and allows
    to turn it on using the AUTO_RELOAD configuration parameter.

    Developer documention should be updated.

    DocImpact
    Closes-bug: #1398390
    Change-Id: I1fac49eaa519d443e42e0b27c0742cb59dcedad4

Changed in fuel:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.