cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fedor Bobin <>
Subject Deadlock in AbstractCommitLogSegmentManager, pull requests with fix
Date Fri, 07 Jul 2017 05:57:28 GMT

I found possible deadlock in AbstractCommitLogSegmentManager. The root
cause is incorrect use of LockSupport.park/unpark pair. Unpark should be
invoked only if caller is sure that thread was parked in appropriate place.
Otherwice permission given by calling unpark can be consumed by other
structures (for example - inside ReadWriteLock).


I suggest simplest solution: change LockSupport to Semaphore.

Also I suggest another solution with SynchronousQueue-like structure to
move available segment from Manager Thread to consumers. With theese
changes code became more clear and


We can not use j.u.c.SynchronousQueue because we need to support shutdown
and there is only way to terminate SynchronousQueue.put is to call
Thread.interrupt(). But C* uses nio and it does not
expect ClosedByInterruptException during IO operations. Thus we can not
interrupt Manager Thread.
I implemented o.a.c.u.c.Transferer that supports shutdown and restart
(needed for tests).

Also I modified o.a.c.d.c.SimpleCachedBufferPool to support waiting for
free space.

Please feel free to ask any questions.

Thank you.

Feodor Bobin

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message