From 3fd6efb40fb4b81874cd1d48a1b529a175383e55 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 5 Jun 2003 22:42:07 +0000 Subject: [PATCH] rx-avoid-leaking-nwaiting-20030605 thanks to kolya@mit.edu for suggesting moving rather than adding the decrement and confirming sanity. basically if a call ended up call->error it was possible to queue_Remove() it, drop the call, and not rx_nWaiting--; result should be observed as rxdebug reporting waitprocs when threads were idle. --- src/rx/rx.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rx/rx.c b/src/rx/rx.c index 27f47c518..e2cdc4127 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -1466,6 +1466,13 @@ struct rx_call *rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * MUTEX_EXIT(&rx_serverPool_lock); MUTEX_ENTER(&call->lock); + if (call->flags & RX_CALL_WAIT_PROC) { + call->flags &= ~RX_CALL_WAIT_PROC; + MUTEX_ENTER(&rx_stats_mutex); + rx_nWaiting--; + MUTEX_EXIT(&rx_stats_mutex); + } + if (call->state != RX_STATE_PRECALL || call->error) { MUTEX_EXIT(&call->lock); MUTEX_ENTER(&rx_serverPool_lock); @@ -1479,10 +1486,6 @@ struct rx_call *rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * rxi_SendAck(call, 0, 0, RX_ACK_DELAY, 0); CLEAR_CALL_QUEUE_LOCK(call); - call->flags &= ~RX_CALL_WAIT_PROC; - MUTEX_ENTER(&rx_stats_mutex); - rx_nWaiting--; - MUTEX_EXIT(&rx_stats_mutex); break; } else { -- 2.39.5