ResultTimeout when using SqliteQueueDatabase in forked process
See original GitHub issueI tried your new SqliteQueueDatabase which appears to be awesome and exactly what I needed to get rid of some ugly database is locked errors. Unfortunately I can’t get it to work inside a forked process. I use os.fork() to run my program as a daemon process. The next time I try to access to the database I get:
Traceback (most recent call last):
File "/home/user/app/nzbhydra/libs/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/user/app/nzbhydra/libs/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/user/app/nzbhydra/nzbhydra/web.py", line 338, in wrapped_function
return f(*args, **kwargs)
File "/home/user/app/nzbhydra/libs/webargs/core.py", line 368, in wrapper
return func(*new_args, **kwargs)
File "/home/user/app/nzbhydra/nzbhydra/web.py", line 667, in internalapi_search
searchResult = startSearch(search_request)
File "/home/user/app/nzbhydra/nzbhydra/web.py", line 631, in startSearch
results = search.search(search_request)
File "/home/user/app/nzbhydra/nzbhydra/search.py", line 225, in search
oldSearchResultsCount = SearchResult.select().where(SearchResult.firstFound < (datetime.date.today() - datetime.timedelta(days=keepFor))).count()
File "/home/user/app/nzbhydra/libs/peewee.py", line 3086, in count
return self.aggregate(convert=False) or 0
File "/home/user/app/nzbhydra/libs/peewee.py", line 3079, in aggregate
return self._aggregate(aggregation).scalar(convert=convert)
File "/home/user/app/nzbhydra/libs/peewee.py", line 2850, in scalar
row = self._execute().fetchone()
File "/home/user/app/nzbhydra/libs/playhouse/sqliteq.py", line 92, in fetchone
self._wait()
File "/home/user/app/nzbhydra/libs/playhouse/sqliteq.py", line 51, in _wait
raise ResultTimeout('results not ready, timed out.')
I realize this use case / problem is somewhat obscure but would be happy for any help. Thank you.
Edit: I’m currently trying to write a script that reproduces this but, of course, haven’t been able so far.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Python Peewee SqliteQueueDatabase table does not get ...
I've run into this problem and it seems that the read query completes before create_tables() does. My fix is to throw in back-to-back ......
Read more >Playhouse, extensions to Peewee
SqliteQueueDatabase is designed to simplify things by sending all write queries through a single, long-lived connection. The benefit is that you get the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the offer, the best thanks you can give me is to continue creating issues. In this case there wasn’t a bug, technically, but I’m sure other people will have the same question and hopefully find our discussion.
Alright, thanks again and I’ll definitely open tickets when I have questions or found a bug that’s actually one 😉