Jason918 commented on PR #16125: URL: https://github.com/apache/pulsar/pull/16125#issuecomment-1186699630
> > > The data array is mutated and read under 2 separate locks which doesn't seem right. > > > > > > @lhotari All guarded by `headLock`? > > @Jason918 it's not the case that everything is guarded by `headLock`. for example, `put` isn't guarded by `headLock`. There's a thread safety issue in `GrowableArrayBlockingQueue` since the `data` array is mutated and read under 2 separate locks. @lhotari The `data` array object mutation only happens in the code path `put() -> expandArray()`, where `put()` acquires the `tailLock`, and `expandArray()` acquires the `headLock`. So the `data` array object should be thread safe if you acquires either `tailLock` or `headLock` before accessing the object. -- 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]
