'ResourceClosedError: This result object does not return rows. It has been closed automatically.' even with MySQL-python (1.2.5)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
New
|
Undecided
|
Unassigned |
Bug Description
In our Openstack CI, we met this issue from time to time and we installed the latest MySQL-python package
-------
# pip list|grep MySQL-python
MySQL-python (1.2.5)
-------
Detailed cinder TRACE log:
-------
2015-03-09 06:11:37.815 19433 CRITICAL cinder [req-dcc07bbd-
2015-03-09 06:11:37.815 19433 TRACE cinder Traceback (most recent call last):
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder sys.exit(main())
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder binary=
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder service_
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder *args, **kwargs)
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder context.
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder vol_entries = self.db.
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder sort_dirs=
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder return f(*args, **kwargs)
2015-03-09 06:11:37.815 19433 TRACE cinder File "/opt/stack/
2015-03-09 06:11:37.815 19433 TRACE cinder return query.all()
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder return list(self)
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder return self._execute_
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder close_with_
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder **kw)
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder close_with_
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder return self.transactio
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder conn = bind.contextual
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder **kwargs)
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder self.dispatch.
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder fn(*args, **kw)
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder connection.
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder return self.execute(
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder row = self.first()
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder self._non_result()
2015-03-09 06:11:37.815 19433 TRACE cinder File "/usr/local/
2015-03-09 06:11:37.815 19433 TRACE cinder "This result object does not return rows. "
2015-03-09 06:11:37.815 19433 TRACE cinder ResourceClosedE
2015-03-09 06:11:37.815 19433 TRACE cinder
2015-03-09 06:11:37.903 19476 INFO cinder.
Some idea cross my mind, I saw a test case "test_graceful_ fetch_on_ non_rows" in sqlalchemy/ test/sql/ test_query. py as below,
I am guessing whether in your cinder db there are records in table "volumes". Logs you posted looks like querying volumes in volume_get_all, this happens when cinder audit running periodically. Maybe when there are no volumes, we will see such exception logs.
def test_graceful_ fetch_on_ non_rows( self): db.connect( ) users.insert( ), user_id=1)
assert_ raises_ message(
exc.ResourceC losedError,
"This result object does not return rows. "
getattr( result, meth),
trans. rollback( )
"""test that calling fetchone() etc. on a result that doesn't
return rows fails gracefully.
"""
conn = testing.
for meth in ('fetchone', 'fetchall', 'first', 'scalar', 'fetchmany'):
trans = conn.begin()
result = conn.execute(
"It has been closed automatically.",
)