From d4e61db1fefd1bbd82c8af3852a56c463644fb96 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 17 Dec 2016 09:42:18 -0500 Subject: [PATCH] [threadpool] Remove assertion on RequestWorkerThread failure (#4167) We observed that this assertion would sometimes be triggered on CI in case of intensive load. This would be possible because we wouldn't necessarily decrease the outstanding_request in a new worker. To decrease resource usage, we also want to limit the amount of new worker we request. --- mono/metadata/threadpool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c index 07db889f26c..bef76e57815 100644 --- a/mono/metadata/threadpool.c +++ b/mono/metadata/threadpool.c @@ -801,18 +801,18 @@ ves_icall_System_Threading_ThreadPool_RequestWorkerThread (void) tpdomain->outstanding_request ++; g_assert (tpdomain->outstanding_request >= 1); - mono_refcount_inc (threadpool); + domains_unlock (); COUNTER_ATOMIC (threadpool, counter, { - if (!(counter._.starting < 32767 /* G_MAXINT16 */)) - g_error ("%s: counter._.starting = %d, but should be < 32767", __func__, counter._.starting); + if (counter._.starting == 16) + return TRUE; counter._.starting ++; }); - mono_threadpool_worker_enqueue (threadpool->worker, worker_callback, NULL); + mono_refcount_inc (threadpool); - domains_unlock (); + mono_threadpool_worker_enqueue (threadpool->worker, worker_callback, NULL); return TRUE; } -- 2.25.1