Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Before http://drupal.org/node/391340#comment-1517272 I was querying the table for a given consumer ID. Since that, we are relying on the SQL engine to only allow one thread to UPDATE a given row. So... why do we need a consumer id at all? The answer is, we do not.
Comment | File | Size | Author |
---|---|---|---|
#20 | 602306-20_cleanup.patch | 766 bytes | alex_b |
#13 | queue-followup.patch | 848 bytes | David Strauss |
#6 | queue_simplify.patch | 6.06 KB | chx |
#4 | queue_simplify.patch | 4.46 KB | chx |
queue_simplify.patch | 3.69 KB | chx | |
Comments
Comment #1
David StraussThis came out of an argument between chx and me about the necessity of the sequences API. :-)
Comment #2
David StraussTagging.
Comment #3
David StraussNeeds to remove remaining mentions of consumer_id.
Comment #4
chx CreditAttribution: chx commentedDone.
Comment #6
chx CreditAttribution: chx commentedComment #7
Dries CreditAttribution: Dries commentedLooks good, tests pass, committed, moving on!
Comment #8
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis doesn't work, and lead to an infinite loop, slowing down the test infrastructure big time.
Comment #9
Damien Tournoud CreditAttribution: Damien Tournoud commentedOh... that's because we are selecting an item that is already claimed:
Maybe we are missing a expire = 0 condition here?
[edit] or add a ->condition('expire', $item->expire) to the update query above.
Comment #10
David StraussIt's not infinite; old items do get cleaned up. It's just woefully non-optimal. We do need an "expire = 0" condition in the initial range query for any hope at efficiency.
Comment #11
David StraussWell, not even woefully non-optimal. Successfully run tasks delete their entries after running. This just breaks concurrent lock acquisition.
Comment #12
Damien Tournoud CreditAttribution: Damien Tournoud commentedIt leads to an infinite loop on the server: the SELECT picks up an item with a expire <> 0, and the UPDATE tries to set the expire time of an item with expire = 0. That makes no sense.
Comment #13
David StraussQuick fix to the "expire" issue (which is probably indicative of problems elsewhere).
Comment #14
Damien Tournoud CreditAttribution: Damien Tournoud commentedHop, let's save the test bot, please.
Comment #15
David StraussJust a quick note on why this went into an infinite loop:
The test for the queue attempts to fetch two items before "processing" and deleting either. After acquiring a lock on the first item, it attempts to fetch a second. The existing code in HEAD then tried to acquire a new lock on the existing, locked item. This was impossible because the existing lock wouldn't be released until later in the same thread. The code also loops whenever it finds and item but can't acquire the lock.
Incidentally, this bug affected two types of operations. It effectively serialized any attempt at multithreaded operation. More importantly, it caused an infinite loop whenever a single thread attempted to acquire more than one item before processing and deleting any. It's not clear that the second situation occurs anywhere in core except the tests, but it is a possibly optimal use case under conditions where it's more efficient to process multiple items at once in one thread than go through serialized acquire-process-delete cycles.
Comment #16
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!
Comment #17
dwwThis is still broken. I just checked out clean HEAD again this morning, cleared my DB, reinstalled D7, and my site can't fetch available update data at all. If I revert this patch, everything is fine. Can we please not "simplify" working APIs in the name of obscure performance gains? ;)
If this patch stays, class SystemQueue still has a protected $consumerId; that needs to go, too...
Comment #18
dwwBtw, just tried again, and it's completely reproducible. Fresh install, default profile, visit admin/reports/available. Watch infinite loop. Revert this patch, try again, see your available updates report.
I have *NO* idea why the update tests are passing, but they are. :( That's a separate issue. ;)
I really don't have time today to debug this since I'm on a rampage to get #538660: Move update manager upgrade process into new authorize.php file (and make it actually work) finished. For now, I'm just going to leave this patch reverted in my workspace so I can finish plugin manager...
Comment #19
dwwUgh, sorry for the false alarm. Too much hacking, not enough sleep. ;) I just discovered that I had left #601600: First view of updates report without cached release data reports bogus results for projects running HEAD applied to my copy of cvs_deploy, which is what was causing the loop, not a failure to drain the queue as it first appeared. Something unholy was going on as I reverted this patch which is what made me think this was the culprit. Apologies.
Anyway, still needs work for:
If this patch stays, class SystemQueue still has a protected $consumerId; that needs to go, too...
but totally minor and can be done post 10/15...
Comment #20
alex_b CreditAttribution: alex_b commentedThis patch removes the stray $consumerId that dww pointed out in #17.
Comment #21
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!