Bug #13883
openThread pool exhaustion due to the same session being expired multiple times
0%
Description
If a Wt::WApplication
(unintentionally) performs a long running operation while its session is being expired, WebController::expireSessions
may try to expire the same session multiple times from different threads. As WebController::expireSessions
waits (indefinitely) for the session lock being granted, all available threads to handle incoming requests (i.e. 10 by default) may be exhausted relatively fast.
Even if this "long running" operation only takes a couple of seconds, it may already drastically slow down other requests on a busy server, as expireSessions
is called every 5 seconds AND (if WebController::autoExpire_ == true) after every request.
Possible solutions are:
- Only execute
expireSessions
on a single (fixed) thread. - Instead of waiting indefinitely for the session lock being granted, just try to take the session lock of the expiring session and skip sessions for which the lock could not be granted instantaneously. Once the "long running" operation has finished, the next call to
expireSessions
will automatically expire the session (if it was not already done before the "long running" operation started).
A combination of both may also be useful to minimize the time spend to expire old sessions.
No data to display