hello,

(not sure if this is a glib question, or a linux kernel question, any
helpful hints appreciated...)

i have a server-side program that is responsible for managing hundreds
(increasing daily) of IoT connections, where this program listens for a
connection request and then spawns a separate thread to manage the incoming
real-time data feed using g_thread_try_new().

i have placed a 30 second timeout on the socket and when this is breached,
the socket is closed and the thread is exited using g_thread_exit().

however, with so many connections coming and going over all time,
eventually, spawning a new thread results in g_thread_try_new() failing
with the error: "Error creating thread: Resource temporarily unavailable".
i have upped the max threads per process to 95K, but this is just a
stop-gap measure that merely delays the onset of this problem.

my question: is g_thread_exit() guaranteed to reduce the kernel resource
pool counter by 1?  my experience seems to suggest that it does not, so my
next question is: how to avoid the problem (i.e., not receive this false
error) when the total number of threads existing at any given moment does
not exceed max threads per process?

or is it the (unfortunate) reality that the max threads per program
represents the total number of threads over all time, exited or not?

thanks in advance for any pointers to a solution...

richard
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to