Worth a looka fix or feature you may want
THttpServer thread-pool lifecycle callbacks restored
THttpServer now forwards its thread-start callback to the internal worker pool. This restores both OnHttpThreadStart and OnHttpThreadTerminate for pooled workers, which matters to applications that allocate and release per-thread state.
TL;DR
- TSynThreadPoolTHttpServer now copies THttpServer.fOnThreadStart before creating its worker threads.
- Pooled THttpServer workers once again run the paired start and termination callbacks; request processing and public signatures are unchanged.
Upgrade advice
Land on build 18239 at cb0cf6a7a53b9c8d3b3b9ab3f63509b4e23126ba. It contains the lifecycle-callback fix, and the payload lists no later same-routine fix in superseded_by.
1 of 1 entries · 3 commits upstream
1
Medium
THttpServer pooled workers now receive start and termination notifications
In mormot.net.server, TSynThreadPoolTHttpServer.Create now copies fServer.fOnThreadStart into the pool's fOnThreadStart field, alongside the existing fOnThreadTerminate copy. TSynThreadPoolWorkThread.Execute can therefore call the configured start handler and set StartNotified; TSynThread.DoTerminate then permits the matching termination handler to run.
Fixes
mormot.net.server
40e03307+1-0
net: THttpServer OnThreadStart/OnThreadTerminate events were never called for its thread pool
Impact
Before this fix, Delphi and FPC applications using the socket-based THttpServer thread pool did not receive OnHttpThreadStart for pooled workers. Because StartNotified remained unset, OnHttpThreadTerminate was skipped as well, so per-thread initialization and cleanup such as TRest.EndCurrentThread could be missed. Applications without these handlers, and non-pooled server implementations, keep their existing behaviour.
Upgrade recommended
Upgrade to build 18239 and verify that each pooled THttpServer worker produces one paired OnHttpThreadStart and OnHttpThreadTerminate call during server startup and shutdown.
Public API
THttpServerGeneric.OnHttpThreadStartbehaviour-changed — The existing event now fires for TSynThreadPoolTHttpServer workers instead of being silently skipped.THttpServerGeneric.OnHttpThreadTerminatebehaviour-changed — The existing event now follows a successful pooled-worker start notification because StartNotified is set.
Units
Earlier editions
- LDAP bounds checks and nullable SOA metadata3
- Chunked HTTP trailers no longer desynchronize persistent connections6
- JOP batch processing cleanup, no backend changes1
- Shutdown races and forged ZIP inputs are blocked31
- HTTP decompression gains output limits and clearer rejection responses28
- Async HTTP and Windows IOCP fix connection and response handling37
- FastCGI proxying and ZIP GCM arrive; macOS ARM64 service calls recover30
- ZIP encryption lands with metadata and authentication safeguards21
- Older FPC builds compile again while JOP keeps URL fragments intact6
- Windows parent lookups stop leaking handles while JOP parsing hardens9
- Proxy and command-line APIs move while process and preprocessor fixes settle39
- TOTP validation changes contract amid database and lifecycle fixes38