avkhozov / Minion-Backend-MongoDB

MongoDB backend for Minion
https://metacpan.org/release/Minion-Backend-MongoDB
1 stars 2 forks source link

MongoDB::NetworkTimeout: Timed out while waiting for socket to become ready for reading #6

Open ravelanded opened 2 years ago

ravelanded commented 2 years ago

If you enqueue at the same time a bunch of complex jobs (simulate with sleep 1) driver disconnects:

MongoDB::NetworkTimeout: Timed out while waiting for socket to become ready for reading

Output from mongod log:

{"t":{"$date":"2022-07-22T17:26:06.526+03:00"},"s":"W", "c":"QUERY", "id":20478, "ctx":"conn5098","msg":"getMore command executor error","attr":{"error":{"code":237,"codeName":"CursorKilled","errmsg":"operation was interrupted"},"stats":{"stage":"COLLSCAN","filter":{"$and":[{"queue":{"$eq":"default"}},{"_id":{"$gte":{"$oid":"62dab366b47f6cb578a01208"}}}]},"nReturned":0,"works":134,"advanced":0,"needTime":131,"needYield":0,"saveState":3,"restoreState":2,"isEOF":0,"direction":"forward","docsExamined":128},"cmd":{"getMore":9116968115045765046,"collection":"minion.notifications","maxTimeMS":5000}}}

We have hotfixed it as a temporary solution by removing tailable_await and max_await_time_ms in in _await function

EmilianoBruni commented 2 years ago

May you submit a script to reproduce iussue?

ravelanded commented 2 years ago

So the output is following in worker:

$ perl worker.pl
This is a complex task.n
This is a complex task.n
This is a complex task.n
This is a complex task.n
This is a complex task.n
This is a complex task.n
This is a complex task.n
This is a complex task.n
This is a complex task.n
This is a complex task.n
MongoDB::NetworkTimeout: Timed out while waiting for socket to become ready for reading

enqueue+worker.zip