You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I happened to run across this in code inspection (actually just searching GitHub for occurrences of notifyAll()) to see if I can spot bugs around them in a few minutes, as part of some other silly exercise), so I figured I’d point it out here in case it matters.
The (sole?) purpose of org.kaazing.net.impl.util.BlockingQueueImpl appears to be to add interrupt and end of stream capability to j.u.c.ArrayBlockingQueue. However, in the implementation, a done() or reset() call may leave threads blocked on a take() or put() until actual contents is added or removed to/from the queue. For example, if done() or reset() are executed right before a thread executes this line of code (but after that thread entered the take() method), the notifyAll() calls in done() or reset(), and the done indication, will have no effect and the thread can remain blocked until further contents arrives on the queue.
A similar situation can happen in the put() implementation here.
The text was updated successfully, but these errors were encountered:
giltene
changed the title
org.kaazing.net.impl.util.BlockingQueueImpl : take() and put() can miss done() or clear() and remain blocking
org.kaazing.net.impl.util.BlockingQueueImpl : take() and put() can miss done() or reset() and remain blocking
Jan 10, 2021
I happened to run across this in code inspection (actually just searching GitHub for occurrences of notifyAll()) to see if I can spot bugs around them in a few minutes, as part of some other silly exercise), so I figured I’d point it out here in case it matters.
The (sole?) purpose of org.kaazing.net.impl.util.BlockingQueueImpl appears to be to add interrupt and end of stream capability to j.u.c.ArrayBlockingQueue. However, in the implementation, a done() or reset() call may leave threads blocked on a take() or put() until actual contents is added or removed to/from the queue. For example, if done() or reset() are executed right before a thread executes this line of code (but after that thread entered the take() method), the notifyAll() calls in done() or reset(), and the done indication, will have no effect and the thread can remain blocked until further contents arrives on the queue.
A similar situation can happen in the put() implementation here.
The text was updated successfully, but these errors were encountered: