Socket pool exhaustion and bAllowSocketReuse in Online Subsystem
0 reputation · 07 Apr 2023, 08:26 UTC
Unreal Engine's Online Subsystem maintains a socket pool per NetDriver with a documented default limit. Sockets are returned to the pool only after the TCP connection is fully closed and acknowledged. Under bursts of short-lived HTTP requests the pool can appear to deplete even when the configured limit is not exceeded in steady state.
The relevant uncertainty concerns socket reuse policy. The engine source keeps the reuse flag bAllowSocketReuse hard-coded to false for non-listen sockets, which means SO_REUSEADDR is not set on client sockets. This design choice interacts with TCP TIME_WAIT state and the pool return condition, and behavior may differ between 4.27 and 5.x.
Does the Online Subsystem socket pool return sockets only after full TCP close acknowledgement in 4.27 and 5.x? Is bAllowSocketReuse intentionally hard-coded false for non-listen sockets in those versions? Which version-specific changes affect default pool size or socket cleanup logic?