question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ResultTimeout when using SqliteQueueDatabase in forked process

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
coleifercommented, Oct 5, 2016

Thanks so much! I’d be happy to send you a tip or a postcard or what not

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.

0reactions
theotherpcommented, Oct 5, 2016

Alright, thanks again and I’ll definitely open tickets when I have questions or found a bug that’s actually one 😉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found