We were looking through the ZK server code and came across a possible bug
that occurs when shutting down the SyncRequestProcessor (it may also apply
to other RequestProcessors, we didn't investigate).

When shutdown() is called in server/SyncRequestProcessor.java, it adds the
requestOfDeath to the processor's queue and when the run loop reaches the
requestOfDeath in the queue it immediately stops the processor. However, if
the request processor is being bombarded by new requests, it only calls
flush when there are 1000 requests backed up to flush. If the requestOfDeath
is received when the toFlush buffer is partially full, the processor stops
immediately without flushing those remaining requests. These requests are
lost. This causes our test for Zab to break, so we thought it may also be a
problem for ZK as well. Is it?

If so, our proposed fix is:
(revision 736200)
(working copy)
@@ -77,6 +77,7 @@
                 if (si == requestOfDeath) {
+                    flush(toFlush);
                 if (si != null) {

Harvey Mudd Clinic Team

Reply via email to