From: Ludovic Henry Date: Sat, 17 Dec 2016 14:42:18 +0000 (-0500) Subject: [threadpool] Remove assertion on RequestWorkerThread failure (#4167) X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=d4e61db1fefd1bbd82c8af3852a56c463644fb96 [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. --- 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; }