Commit 4c3a7945 authored by Nils Goroll's avatar Nils Goroll

Flush until it's all down the drain

VSLQ_Flush() vtx_force()s all incomplete transactions to be ready and calls
vslq_process_ready().

vslq_process_ready() retires vtxes until the callback returns with non zero,
so if our dispatch callback does return with an error, flushing will stop,
so we may end up with a non-empty ready list in vslq after calling flush
just once.

To ensure that we flushed everything and vtx_retire()d all vtxes
(which may contain refs to chunk_t_bufs living in malloc()ed memory),
we need to keep on flushing until we know the bowl is empty.
parent b3868a44
......@@ -893,7 +893,8 @@ CHILD_Main(int readconfig)
if (flush && !term) {
LOG_Log0(LOG_NOTICE, "Flushing transactions");
take_free();
VSLQ_Flush(vslq, dispatch, NULL);
do {}
while (VSLQ_Flush(vslq, dispatch, NULL) != DISPATCH_RETURN_OK);
flush = 0;
if (EMPTY(config.varnish_bindump) && status != DISPATCH_CLOSED
&& status != DISPATCH_OVERRUN && status != DISPATCH_IOERR)
......@@ -929,7 +930,8 @@ CHILD_Main(int readconfig)
if (term && status != DISPATCH_EOF && flush && vslq != NULL) {
LOG_Log0(LOG_NOTICE, "Flushing transactions");
take_free();
VSLQ_Flush(vslq, dispatch, NULL);
do {}
while (VSLQ_Flush(vslq, dispatch, NULL) != DISPATCH_RETURN_OK);
}
WRK_Halt();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment