From 362d55032845c3c2993eed018ecafb87a1b83cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Thu, 13 Jul 2017 17:08:50 +0100 Subject: [PATCH] Do not crash when closing both client and upstream --- servers/lloadd/operation.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/servers/lloadd/operation.c b/servers/lloadd/operation.c index 425cf02265..01b4dc3c3d 100644 --- a/servers/lloadd/operation.c +++ b/servers/lloadd/operation.c @@ -581,6 +581,15 @@ operation_abandon( Operation *op ) CONNECTION_LOCK_DECREF(c); unlock: + /* + * FIXME: the dance in operation_destroy_from_upstream might be slower than + * optimal as we've done some of the things above already. However, we want + * to clear o_upstream from the op if it's dying, but witnessing and + * navigating the race to do that safely is too complex to copy here. + */ + if ( !c->c_live ) { + operation_destroy_from_upstream( op ); + } UPSTREAM_UNLOCK_OR_DESTROY(c); done: