mORMot2 DailyDaily read of upstream commits

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.

Build2.4.16737 → 2.4.16753
Commits13
Lines+995 -375
Read4 min

12 of 12 entries · 13 commits upstream

Stories
# Entry Category Units
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.

Arnaud · 22:01 UTC · view the commit on GitHub →

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.

Public API

  • TWinIocp.Unsubscribebehaviour-changed — The var subscription pointer is atomically claimed and cleared before removal starts.

Arnaud Bouchez · 09:58 UTC · view the commit on GitHub →

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.

Public API

  • TWebSocketAsyncConnections with SendDelay=0behaviour-changed — The first queued outgoing connection now wakes the server loop immediately.

Arnaud Bouchez · 14:55 UTC · view the commit on GitHub →

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.

Arnaud Bouchez · 19:20 UTC · view the commit on GitHub →

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.

Arnaud Bouchez · 09:47 UTC · view the commit on GitHub →

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.

Arnaud · 21:33 UTC · view the commit on GitHub →

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.

Arnaud Bouchez · 14:56 UTC · view the commit on GitHub →

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.

Arnaud Bouchez · 14:54 UTC · view the commit on GitHub →

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.

Arnaud · 22:01 UTC · view the commit on GitHub →

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.

Arnaud Bouchez · 19:19 UTC · view the commit on GitHub →

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.

Arnaud Bouchez · 14:57 UTC · view the commit on GitHub →

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.

Arnaud Bouchez · 09:54 UTC · PR #571 · view the commit on GitHub →

Upstream activity commits per day · last 60 days
Commits977
Active days44/60
Busiest2026-09-30
Peak60
2026-08-15: 0 commits2026-08-16: 0 commits2026-08-17: 0 commits2026-08-18: 0 commits2026-08-19: 0 commits2026-08-20: 0 commits2026-08-21: 0 commits2026-08-22: 0 commits2026-08-23: 0 commits2026-08-24: 0 commits2026-08-25: 0 commits2026-08-26: 0 commits2026-08-27: 26 commits2026-08-28: 11 commits2026-08-29: 10 commits2026-08-30: 1 commit2026-08-31: 23 commits2026-09-01: 0 commits2026-09-02: 20 commits2026-09-03: 29 commits2026-09-04: 35 commits2026-09-05: 13 commits2026-09-06: 0 commits2026-09-07: 0 commits2026-09-08: 23 commits2026-09-09: 10 commits2026-09-10: 17 commits2026-09-11: 23 commits2026-09-12: 14 commits2026-09-13: 9 commits2026-09-14: 7 commits2026-09-15: 4 commits2026-09-16: 24 commits2026-09-17: 26 commits2026-09-18: 21 commits2026-09-19: 59 commits2026-09-20: 13 commits2026-09-21: 5 commits2026-09-22: 34 commits2026-09-23: 17 commits2026-09-24: 57 commits2026-09-25: 22 commits2026-09-26: 26 commits2026-09-27: 0 commits2026-09-28: 2 commits2026-09-29: 19 commits2026-09-30: 60 commits2026-10-01: 26 commits2026-10-02: 30 commits2026-10-03: 32 commits2026-10-04: 15 commits2026-10-05: 1 commit2026-10-06: 26 commits2026-10-07: 37 commits2026-10-08: 27 commits2026-10-09: 35 commits2026-10-10: 33 commits2026-10-11: 9 commits2026-10-12: 11 commits2026-10-13: 35 commits
2026-08-152026-10-13