python API DeadlockWrap error

Questions about the WURFL Cloud service.
easystreet
Posts: 5
Joined: Fri Mar 13, 2015 11:16 am

python API DeadlockWrap error

Postby easystreet » Fri Mar 13, 2015 11:37 am

I am running a flask python app via a uwsgi server and occasionally getting the error below. Restarting the uwsgi server solves the issue. At first I thought it was because I was running 4 uwsgi processes, so I changed it to a single process. But the error occurred again. Before I start digging into the issue, I am curious if this is something anyone else has seen before?

Code: Select all

[pid: 1082|app: 0|req: 7712/7712] 127.0.0.1 () {34 vars in 573 bytes} [Fri Mar 13 11:53:38 2015] GET /L/lrnonl => generated 0 bytes in 1 msecs (HTTP/1.0 500) 0 headers in 0 bytes (0 switches on core 0)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/alec/easystreet/python/ims/leadassignment/wurfl_middleware.py", line 38, in __call__
    capabilities=["is_smartphone", "is_tablet", "device_os"])
  File "/usr/local/lib/python2.7/dist-packages/wurfl_cloud-1.0.1-py2.7.egg/wurfl_cloud/__init__.py", line 69, in __call__
    device = self._get_device(user_agent, headers, capabilities)
  File "/usr/local/lib/python2.7/dist-packages/wurfl_cloud-1.0.1-py2.7.egg/wurfl_cloud/__init__.py", line 105, in _get_device
    device = self.cache.get_device(user_agent)
  File "/usr/local/lib/python2.7/dist-packages/wurfl_cloud-1.0.1-py2.7.egg/wurfl_cloud/cache/interface.py", line 50, in get_device
    device_id = self._from_backend(user_agent)
  File "/usr/local/lib/python2.7/dist-packages/wurfl_cloud-1.0.1-py2.7.egg/wurfl_cloud/cache/interface.py", line 34, in _from_backend
    data = self.get(key).decode("utf8")
  File "/usr/local/lib/python2.7/dist-packages/wurfl_cloud-1.0.1-py2.7.egg/wurfl_cloud/cache/file_cache.py", line 36, in get
    if (int(self.db[key + "_expiration"]) - time.time() <= 0):
  File "/usr/lib/python2.7/bsddb/__init__.py", line 270, in __getitem__
    return _DeadlockWrap(lambda: self.db[key])  # self.db[key]
  File "/usr/lib/python2.7/bsddb/dbutils.py", line 68, in DeadlockWrap
    return function(*_args, **_kwargs)
  File "/usr/lib/python2.7/bsddb/__init__.py", line 270, in <lambda>
    return _DeadlockWrap(lambda: self.db[key])  # self.db[key]
bsddb.db.DBRunRecoveryError: (-30973, 'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: Invalid argument')
Thanks,
Alec

Elliotfehr

Re: python API DeadlockWrap error

Postby Elliotfehr » Fri Mar 13, 2015 1:26 pm

Alec,

Are you able to provide me with your configuration file for the WURFL cloud client (with your API key obfuscated)?

Thank you,

Elliot

easystreet
Posts: 5
Joined: Fri Mar 13, 2015 11:16 am

Re: python API DeadlockWrap error

Postby easystreet » Fri Mar 13, 2015 2:00 pm

{
"api": {
"version": "v1",
"key": "xxxx:xxxx",
"server": "api.wurflcloud.com"
},
"http": {
"timeout": 1000,
"compression": true
},
"cache": {
"type": "file",
"file": "/tmp/cloud_cache.db",
"expiration": 86400
},
"misc": {
"report_interval": 60
}
}

Elliotfehr

Re: python API DeadlockWrap error

Postby Elliotfehr » Tue Mar 17, 2015 12:58 pm

Hello,

Are you able to try deleting the cache `/tmp/cloud_cache.db` and restart the application? This is most likely due to the cache file being corrupted.

Thank you,

Elliot

easystreet
Posts: 5
Joined: Fri Mar 13, 2015 11:16 am

Re: python API DeadlockWrap error

Postby easystreet » Tue Mar 17, 2015 1:19 pm

Yes, I used a new database file on 3/14 and haven't had the error since then. But before I deleted the file I had previously fixed the problem by restarting the service, and to my best recollection this has happened 3 or 4 times over a couple months. I suppose I thought the file wasn't corrupt because the restart worked. Would you recommend periodically purging the file, or do you think the corruption was a unique event? My main concern is if this might happen again.

I still have the original file if you want me to send it.

Thanks,
Alec

Elliotfehr

Re: python API DeadlockWrap error

Postby Elliotfehr » Tue Mar 17, 2015 2:07 pm

Alec,

the corruption of the database should be a unique event. Certainly feel free to let me know if you run into this issue again after purging the cache.

Thank you,

Elliot

easystreet
Posts: 5
Joined: Fri Mar 13, 2015 11:16 am

Re: python API DeadlockWrap error

Postby easystreet » Wed Apr 01, 2015 10:54 am

It just happened again. I deleted the cache file and restarted my service. It does not appear to be a unique event.

Thanks,
Alec

Elliotfehr

Re: python API DeadlockWrap error

Postby Elliotfehr » Thu Apr 02, 2015 9:05 am

Alec,

Thank you for letting me know. We are currently working on a solution and I will let you know as soon as it is ready.

Thank you,

Elliot


Who is online

Users browsing this forum: No registered users and 15 guests