glance-api failed to start with pypy

Bug #1538117 reported by Yongfeng Du
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Yongfeng Du

Bug Description

I'm trying to run glance with pypy, and found one compatibility problem.

The error message:
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m return cls(app)^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/api/middleware/cache_manage.py", line 34, in __init__^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m resource = cached_images.create_resource()^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/api/cached_images.py", line 125, in create_resource^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m return wsgi.Resource(Controller(), deserializer, serializer)^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/api/cached_images.py", line 35, in __init__^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m self.cache = image_cache.ImageCache()^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/image_cache/__init__.py", line 61, in __init__^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m self.init_driver()^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/image_cache/__init__.py", line 83, in init_driver^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m self.configure_driver()^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/image_cache/__init__.py", line 92, in configure_driver^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m self.driver.configure()^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/image_cache/drivers/sqlite.py", line 107, in configure^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m self.initialize_db()^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/image_cache/drivers/sqlite.py", line 114, in initialize_db^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m factory=SqliteConnection)^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/pypy-4.0.1-src-pxwang-20160106/lib_pypy/_sqlite3.py", line 154, in connect^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m check_same_thread, factory, cached_statements)^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m File "/home/ubuntu/testenv/site-packages/glance/image_cache/drivers/sqlite.py", line 65, in __init__^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00m sqlite3.Connection.__init__(self, *args, **kwargs)^M
^[[01;31m2016-01-26 06:02:27.091 TRACE glance ^[[01;35m^[[00mTypeError: __init__() got multiple values for keyword argument 'timeout'^

Yongfeng Du (dolpherdu)
Changed in glance:
assignee: nobody → Yongfeng Du (dolpherdu)
Revision history for this message
Yongfeng Du (dolpherdu) wrote :

Cause:
glance/image_cache/drivers/sqlite.py:
class SqliteConnection(sqlite3.Connection):

    """
    SQLite DB Connection handler that plays well with eventlet,
    slightly modified from Swift's similar code.
    """

    def __init__(self, *args, **kwargs):
        self.timeout_seconds = kwargs.get('timeout', DEFAULT_SQL_CALL_TIMEOUT)
        kwargs['timeout'] = 0
        sqlite3.Connection.__init__(self, *args, **kwargs)

If there is no timeout key in kwargs, it will create a new one, caused the above failure.
Although this is a pypy compatibility issue, glance could be enhanced to avoid this.

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.