From 9f92caf40eac395bd7446ef0fdb6432ea9b7ba4f Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Fri, 31 Jul 2015 21:19:35 +0300
Subject: [PATCH] iproto: don't hold fibers in the iproto fiber cache forever

---
 src/box/iproto.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/box/iproto.cc b/src/box/iproto.cc
index cb60c01883..8e09976b31 100644
--- a/src/box/iproto.cc
+++ b/src/box/iproto.cc
@@ -111,7 +111,7 @@ struct IprotoRequestGuard {
 
 struct iproto_task;
 
-enum { IPROTO_REQUEST_QUEUE_SIZE = 2048, };
+enum { IPROTO_REQUEST_QUEUE_SIZE = 2048, IPROTO_FIBER_CACHE_IDLE_TIMEOUT = 3 };
 
 /**
  * Implementation of an input queue of the box request processor.
@@ -617,7 +617,11 @@ iproto_tx_queue_fiber(va_list ap)
 	}
 	/** Put the current fiber into a queue fiber cache. */
 	rlist_add_entry(&i_queue->fiber_cache, fiber(), state);
-	fiber_yield();
+	bool timed_out = fiber_yield_timeout(IPROTO_FIBER_CACHE_IDLE_TIMEOUT);
+	if (timed_out) {
+		rlist_del_entry(fiber(), state);
+		return;
+	}
 	goto restart;
 }
 
-- 
GitLab