daniellansun commented on PR #3259: URL: https://github.com/apache/groovy/pull/3259#issuecomment-6963040877
@blackdrag Thank you for pointing this out. You were right: the earlier shape ran the user action while the write lock was still held, and the cursor only advanced as part of that call. On the current tip, `8e2d43ad7a`, both paths copy the element and advance the cursor under the lock, then release it before `action.accept`. `serveReplayed` does that under the read lock; a first-time pull does it under the write lock after `pullIntoReplay` has appended to `replay`. A throwing action has therefore already consumed the element for that cursor, and the buffer still holds it for other cursors. A callback can also re-enter the same queryable without upgrading a held read lock into the write lock. I added tests for concurrent readers and writers, for a re-entrant callback, and for an exception on both the first-pull path and `serveReplayed`. I would be grateful if you could take another look when you have time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
