Act nowcan affect a running systemThe PDF regression-suite merge commit needs no separate entry. Its functional framework-facing conditional work is covered by the two non-merge UI commits. No superseded_by links or new removal timetable beyond the HASUIPDF rename are present in the raw payload; version bookkeeping files were ignored.
Zero-delay WebSockets wake correctly and IOCP unsubscribe turns atomic
Network backends receive several concrete concurrency fixes: zero-delay WebSocket frames wake the async server, connected tunnel sockets follow the processing path, and Windows IOCP subscriptions can be claimed for removal only once. TSynLog thread-slot recycling is also finalized so a slot is not published for reuse before its per-log naming bits are cleared. UI users should review the new HAS_UI_PDF conditional and the removal of HASUIPDF, while the PDF changes themselves are mainly test and platform-selection work.
TL;DR
- TWebSocketAsyncConnections now wakes the main async-server thread when SendDelay=0 and the outgoing queue changes from empty to non-empty.
- TWinIocp.Unsubscribe atomically changes the caller's subscription pointer to nil, preventing concurrent removers from processing the same object.
- TTunnelLocal now distinguishes a bound listening socket from an already connected socket, restoring the connected processing path.
- TSynLog clears per-log thread-name bits before returning a thread number to the reusable-slot pool.
- HASUIPDF is replaced by HAS_UI_PDF, alongside new NO_UI, NO_UI_VCL and NO_UI_PDF project controls.
Upgrade advice
Take build 2.4.16753 for async WebSockets, TTunnelLocal, Windows IOCP or high-churn TSynLog workloads; it includes the complete fixes in this payload. Recompile UI/PDF projects and replace any application-level HASUIPDF checks with HAS_UI_PDF. Review NO_UI, NO_UI_VCL and NO_UI_PDF only if you need to exclude those subsystems. The raw payload reports no later successor for these commits within this edition.
12 of 12 entries · 13 commits upstream
1
High
Logging slots are published for reuse only after name bits are cleared
TSynLog.NotifyThreadEnded in mormot.core.log now clears fThreadNameLogged under SynLogGlobalLock before it locks SynLogThreads.Safe and appends the thread number to IndexReleased. The bitmap index expression is also written directly as num - 1.
Fixes
mormot.core.log
68f8a3cb+16-17
core: fixed another paranoid race in TSynLog.NotifyThreadEnded
Impact
Another thread cannot acquire a recycled number and set its name bit before the terminating thread clears the old bit. High-churn Delphi/FPC services keep thread-name emission consistent instead of losing the new owner's marker.
Upgrade recommended
Use build 2.4.16753 rather than stopping at the earlier logging-lock commit in this edition.
Units
2
High
Windows IOCP unsubscribe claims the caller pointer atomically
TWinIocp.Unsubscribe in mormot.net.sock.windows copies the subscription pointer locally, then uses LockedExc to replace the caller's var parameter with nil only if it still matches. All shutdown, receive and free operations use the claimed local pointer.
Fixes
mormot.net.sock.windows
76d9d035+9-9
net: made TWinIocp.Unsubscribe atomic
Impact
Concurrent callers cannot both pass the non-nil test and unsubscribe or free the same IOCP subscription. Windows async servers avoid duplicate shutdown work and a potential use-after-free on that path.
Upgrade recommended
Upgrade Windows IOCP servers where connection shutdown and owner cleanup may race.
Public API
TWinIocp.Unsubscribebehaviour-changed — The var subscription pointer is atomically claimed and cleared before removal starts.
3
High
Zero-delay WebSocket frames now wake the async server immediately
TWebSocketAsyncConnections.NotifyOutgoing records whether fOutgoingHandle was empty before adding the connection. When the first item arrives and Connection.fProcess.Settings^.SendDelay is zero, it calls a new THttpAsyncConnections.WakeupServerMainThread helper that signals fExecuteEvent.
Fixes
mormot.net.async+1
a7195425+15-2
net: fixed TWebSocketAsyncConnections with SendDelay=0
Impact
With SendDelay=0, an outgoing frame no longer waits for an unrelated socket event or idle pass before the main async loop sends it. This restores the intended immediate-delivery behavior for Delphi/FPC WebSocket servers.
Upgrade recommended
Upgrade servers configured with SendDelay=0 and retest server-originated frames while inbound traffic is idle.
Public API
TWebSocketAsyncConnections with SendDelay=0behaviour-changed — The first queued outgoing connection now wakes the server loop immediately.
4
High
Connected local tunnels no longer enter the listening accept path
TTunnelLocal in mormot.net.tunnel renames its internal fSocketCreated flag to fSocketBound and sets it only after NewSocket performs a bind for port zero. TTunnelLocalThread.DoExecute enters its accept loop only when that bound flag is present.
Fixes
mormot.net.tunnel
9cb2c9bc+5-5
net: fixed TTunnelLocal socket flag
Impact
A tunnel opened by connecting to an existing local address now proceeds directly to stProcessing instead of trying accept on a connected socket. Bound ephemeral-port tunnels keep their listening behavior.
Upgrade recommended
Upgrade TTunnelLocal deployments that connect to a configured non-zero local port, and retest both directions of the tunnel.
Units
5
Medium
UI compile controls are renamed and CountOccurrences becomes public
mormot.defines replaces HASUIPDF with HAS_UI_PDF and introduces HAS_UI, HAS_UI_VCL_LCL plus project switches NO_UI, NO_UI_VCL and NO_UI_PDF. mormot.core.unicode adds public CountOccurrences for non-overlapping RawUtf8 matches; mormot.core.text also corrects the parameter name passed by UInt32DigitsToUtf8.
Breaking changes
mormot.core.text+3
fe0b21d2+59-18
core: new CountOccurrences() function
Impact
Application or package conditionals that test HASUIPDF stop selecting their PDF branch until renamed. Projects gain explicit ways to exclude all UI, the Delphi VCL path or only PDF; CountOccurrences is available to both Delphi and FPC callers.
Migration required
Search project sources, package files and build defines for HASUIPDF and replace it with HAS_UI_PDF; then rebuild each UI and headless target.
Public API
HASUIPDFremoved — Replace project checks with HAS_UI_PDF.HAS_UI / HAS_UI_VCL_LCL / HAS_UI_PDFadded — Describe enabled UI capabilities after project-level exclusions.NO_UI / NO_UI_VCL / NO_UI_PDFadded — Project-level switches to disable all UI, VCL/LCL use, or PDF support.CountOccurrencesadded — Counts non-overlapping SubStr matches in a RawUtf8 Text value.
6
Medium
Thread-name bitmap cleanup is brought under the global log lock
TSynLog.NotifyThreadEnded in mormot.core.log wraps access to SynLogFamily and each fGlobalLog.fThreadNameLogged bitmap with SynLogGlobalLock. Its existing SynLogThreads.Safe work is initially nested inside that protection.
Fixes
mormot.core.log
6539d93d+24-19
core: fixed a paranoid race in TSynLog.NotifyThreadEnded
Impact
A terminating thread no longer modifies per-family name bitmaps concurrently with log-family lifecycle operations. The later 68f8a3c commit completes the ordering before the slot is reusable.
Upgrade recommended
Take the edition head so this lock addition is paired with the final slot-publication ordering in 68f8a3c.
Units
7
Medium
Async maintenance ticks use one monotonic clock scale
mormot.net.async records fLastOperationMS before ProcessWaitingWrite can re-enter idle processing, then refreshes it afterward. The non-IOCP callback cadence now derives tix from GetTickCount64 shr 16 instead of GetTickSec shr 6, matching the surrounding millisecond tick logic.
Fixes
mormot.net.async
f50a5e53+6-4
net: fixed async internal ticks computation
Impact
Async socket maintenance avoids recursive work on the same tick and uses a consistent approximately 65-second callback bucket. This primarily affects POSIX poll backends; public APIs are unchanged.
Upgrade recommended
Upgrade busy async servers, especially POSIX poll deployments with queued large writes or periodic callbacks.
Units
8
Low
Reusable fixed-size hash and temporary buffer types expand to 4096 bits
mormot.core.base adds THash1024, THash2048 and THash4096 with pointer aliases, plus TTemp128 and TTemp256. Existing fixed arrays in SHA-512, CPU sets, SSPI, ISO, DHCP and TFTP code are replaced with the equivalent named types without changing their byte sizes.
New features
mormot.core.base+7
487c21e6+29-21
core: new THash1024..4096 and TTemp128..512 types
Impact
Application code gains standard 128-, 256- and 512-byte binary and stack-buffer declarations. Existing records keep the same storage layout, so the internal substitutions do not change wire formats.
Public API
THash1024 / PHash1024 / THash2048 / PHash2048 / THash4096 / PHash4096added — Named byte arrays and pointer aliases for 128-, 256- and 512-byte values.TTemp128 / TTemp256added — Fixed AnsiChar temporary buffers of 128 and 256 bytes.
9
Low
Exception log context now includes the numeric thread slot
mormot.core.log formats regular exception context as [#number name], omitting each component when unavailable. _GetCurrentThreadName is simplified without changing its lock, and TDebugFile.AddLog calls DebugFileGet directly.
New features
mormot.core.log
93da31e1+24-15
core: refined exception logging entry
Impact
Exception rows become easier to correlate with other TSynLog entries, but parsers that expect only a name inside the brackets may need review. Exception handling and public APIs are unchanged.
Worth a look
Public API
TSynLog exception row formatbehaviour-changed — Regular exception context now includes #ThreadNumber before the optional thread name.
Units
10
Low
TMultiLightLock uses explicit 32-bit flags and native thread identifiers
mormot.core.os changes private TMultiLightLock.Flags from PtrUInt to cardinal and ThreadID from pointer to TThreadID. Its operations consequently use LockedExc32 and LockedDec32, while zero replaces nil for the thread identifier.
Under the hood
mormot.core.os
aa0c8213+13-13
core: simplified TMultiLightLock
Impact
Lock ownership and re-entrant count semantics remain the same, with a fixed 32-bit atomic counter on all targets. Source users access only public methods, so no application change is expected after recompilation.
Units
11
Low
TCachedValue now always stores the refresh that finishes last
TCachedValue.Cache in mormot.core.os removes the TixShr = Tix32 condition before assigning Value after the callback. Its public parameter layout is only reformatted, and mormot.core.os.security clarifies that a shift of eight means a 256-second certificate-store cache.
Under the hood
mormot.core.os+1
a697074f+6-7
core: minor TCachedValue.Cache change
Impact
If refresh callbacks from different cache intervals overlap, the result that completes last is retained even when another caller has advanced Tix32. Typical file and certificate-store cache calls keep the same API and expiry interval.
12
Low
PDF regression tests are isolated behind the new UI capability names
mormot.ui.pdf and the integration test runner replace HASUIPDF with HAS_UI_PDF, while mormot.defines adds HAS_UI_LCL for FPC. test.ui.pdf is reorganized, uses mormot.lib.z for its fixture, and keeps a void unit implementation when PDF UI support is absent.
Tests
mormot.defines+1
cf21f26e+202-232
ui: more refactoring of #571 test.ui.pdf process
Impact
Non-UI test builds no longer need to initialize VCL/LCL or include the PDF test unit. Framework PDF runtime behavior is not changed by this follow-up; it completes the conditional rename from the previous commit.
Public API
HAS_UI_LCLadded — Defined for FPC when UI support is enabled.