- Issue created by @dalin
- 🇩🇪Germany mrshowerman Munich
I have the same issue. All our projects' logs are flooded with errors like this.
- Assigned to mrshowerman
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 3:32pm 23 March 2023 - 🇩🇪Germany mrshowerman Munich
Looks like the queue worker does not check whether an item actually exists before calling
removeItem()
. - Status changed to Needs work
over 1 year ago 5:34pm 23 March 2023 - 🇨🇦Canada dalin Guelph, 🇨🇦, 🌍
If the deltas can/will get out of order from what we initially expected, why work with deltas at all? Shouldn't we remove the ID regardless of its delta? We could use
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21TypedData...I posted a similar comment on 🐛 Race condition when using queue Needs review
- 🇨🇦Canada dalin Guelph, 🇨🇦, 🌍
Actually, I think it's better to keep this issue just about catching exceptions, and providing a useful error message in Watchdog. Fixing the race condition should be in 🐛 Race condition when using queue Needs review which is a better place to start since it has tests.
- 🇩🇪Germany mrshowerman Munich
I totally agree. I tried to address this in a new patch for 🐛 Race condition when using queue Needs review and also included the sanity check originally posted here.
Since we have two issues working on the same piece of code, maybe we should postpone this one here in favour of 3346341? - 🇩🇪Germany mrshowerman Munich
🐛 Race condition when using queue Needs review is in.
@dalin, I think we can close this as a duplicate now, what do you think? - 🇨🇦Canada dalin Guelph, 🇨🇦, 🌍
@mrshowerman
I think this issue should stay open. I don't see any try/catch statements in the codebase. - 🇩🇪Germany mrshowerman Munich
My point is: do you still get the error messages mentioned in the issue summary? They should have gone after updating to beta6.
- 🇨🇦Canada dalin Guelph, 🇨🇦, 🌍
@mrshowerman
There are a few places in the codebase that could throw an exception. Here's some examples:- https://git.drupalcode.org/project/entity_reference_purger/-/blob/1.0.x/...
- https://git.drupalcode.org/project/entity_reference_purger/-/blob/1.0.x/...
- https://git.drupalcode.org/project/entity_reference_purger/-/blob/1.0.x/...
If I brought this up in my IDE it would probably tell me there are even more uncaught exceptions.
Let's say that our code in hook_node_delete is running. We're processing the deletion of a node that is referenced by 50 other nodes. An exception is thrown when processing the first node. Currently code execution will stop, and the other 49 nodes won't be processed. What should we do instead? Maybe just skip it and continue on through the list of nodes.