mORMot2 DailyDaily read of upstream commits

Client-driven services stop racing their own release

The server now keeps each sicClientDriven implementation alive until its active method returns, closing a use-after-free race with _free_, timeouts and session garbage collection. HTTP request framing, DuckDB 2.0, PDF encryption and EMF rendering also receive concrete fixes. Teams running Delphi or FPC backends should prioritize this edition when they use stateful SOA services, DuckDB 2.0 or PDF generation.

TL;DR

  • sicClientDriven instances now retain an interface reference while ExecuteMethod is running, preventing concurrent release and use-after-free.
  • HTTP/1.1 requests without Content-Length no longer wait for EOF when Connection: close is present; HTTP/1.0 close-delimited bodies keep their legacy handling.
  • DuckDB 2.0 calls run with masked FPU exceptions, new logical types are decoded safely, and VARIANT result columns are returned as JSON text.
  • FPC no longer writes into literal PDF passwords during AES-256 setup, and EMF text recorded inside a GDI path follows that path's paint operation.
  • WinVerifyExeSignature, IsExeSignatureValid and TWinVerifyStatus moved from mormot.misc.pecoff to mormot.core.os.security.

Upgrade advice

Land on merged revision 50a0c6b536826827965d8f1571c4087f1b0d82a1, build 2.4.17677. Do not stop on daa87145 because cc485cc2 restores HTTP/1.0 close-delimited bodies, or on 45779260 because 027e139e adds usable VARIANT results. Upgrade promptly for sicClientDriven services, DuckDB 2.0, or FPC AES-256 PDF output. The raw payload records no later superseding fix.

Commits17
Lines+2304 -494
Read5 min

10 of 10 entries · 17 commits upstream

Stories
# Entry Category Units
1 High The PDF unit compiles again after a partial merge rollback The commit reverses 15 EMF renderer hunks accidentally reintroduced by the PDF feature-branch merge. It removes stale fInLined references and fNewPath resets, restores the null-pen and ended-path behavior from fixes #695 and #696, and restores EmfNullPenLines, EmfLineAfterEndedPath, the expected rendering hash and ScreenLogPixels := 96 in test.ui.pdf. Fixes mormot.ui.pdf+1 e95fbde4+181-60

ui: pdf - restore #696 and #695, lost in the merge of #690

Impact

The preceding merged PDF revision failed to compile at eleven fInLined references, so any Delphi or FPC project importing mormot.ui.pdf was blocked before runtime. This commit restores compilation and the intended EMF path behavior while keeping the AES-256 and PDF 2.0 additions from the branch.

Sven Harazim · 06:27 UTC · PR #696 · view the commit on GitHub →

2 High DuckDB VARIANT results are reissued as JSON instead of crashing After ExecuteStmt, TSqlDBDuckDBStatement recursively detects VARIANT in each logical type. It then rebuilds the SELECT with positional #n references and wraps affected columns in NULLIF(#n::JSON, 'null'::JSON), releases the first result, prepares the wrapper and executes it again. Positional references preserve duplicate column names, and SQL NULL remains null rather than JSON 'null'. Fixes mormot.db.raw.duckdb+2 027e139e+187-18

db: DuckDB 2.0 VARIANT columns are returned as JSON

Impact

SELECT statements containing top-level or nested VARIANT columns now return canonical JSON through ColumnUtf8 instead of an unsupported-type error, recursion or driver crash. A VARIANT NULL is exposed as SQL NULL. Multi-statement direct SQL still rejects VARIANT and tells the caller to cast it to JSON, so such calls need an explicit SQL cast.

Public API

  • DuckDBTypeHasVariantadded — Reports whether TDuckDBTypeInfo is VARIANT or contains a nested VARIANT.
  • DuckDBVariantSqladded — Builds the positional wrapper SELECT used to convert selected VARIANT columns to JSON.
  • TSqlDBDuckDBStatement VARIANT result handlingbehaviour-changed — VARIANT result columns are now exposed as JSON text, with VARIANT NULL mapped to SQL NULL.

tf · 16:44 UTC · view the commit on GitHub →

3 High Active sicClientDriven calls can no longer lose their instance TServiceFactoryServer.RetrieveInstance now accepts an optional Hold: PInterface and assigns the returned implementation to it while fInstances is locked. ExecuteMethod keeps that reference for the complete method call, so InstanceFreeOrGC observes RefCount greater than one and postpones destruction until a later DoInstanceGC pass. Fixes mormot.soa.server 927c2f6d+18-3

soa: hold the sicClientDriven instance during ExecuteMethod

Impact

A concurrent _free_ request, instance timeout or session GC could previously release a sicClientDriven implementation while its method still used self, causing a use-after-free. The fix changes no service contract and applies to both Delphi and FPC servers; direct callers of RetrieveInstance remain source-compatible because Hold defaults to nil.

Public API

  • TServiceFactoryServer.RetrieveInstancesignature-changed — Adds the optional Hold: PInterface = nil parameter; existing calls remain valid.

TobiasKnoke · 18:28 UTC · view the commit on GitHub →

4 High FPC AES-256 PDF setup no longer writes into literal passwords TPdfEncryptionAes256.AttachDocument replaces FillCharFast(pointer(usr)^, ...) and the equivalent owner-password wipe with FillZero(RawByteString(...)). Under FPC, StringToUtf8 may return the caller's AnsiString literal directly; FillZero clears only a uniquely referenced writable string and skips constants. Fixes mormot.ui.pdf f11fac11+3-4

ui: pdf - AES-256 on FPC: no wipe of a constant password

Impact

Every tested FPC target previously raised an access violation when EncryptionAes256 or Pdf20File received literal passwords such as 'owner'; Delphi passed. FPC PDF producers can now use AES-256 and PDF 2.0 with constant passwords without writing into read-only memory. The change does not alter the encrypted document format.

Sven Harazim · 07:14 UTC · view the commit on GitHub →

5 High DuckDB 2.0 no longer trips FPC exceptions or recursive decoding The DuckDB wrappers surround open, query, prepare, execute, result fetching and Appender EndRow, Flush and Close with SetFpuFlags and ResetFpuFlags because DuckDB worker threads inherit the caller's FPU mask. The type map adds TIMESTAMPTZ_NS as ftDate and GEOMETRY as ftBlob/WKB. Unknown logical types now raise ESqlDBDuckDB instead of bouncing between DuckDBVectorValueToText and DuckDBVectorValueToJson until stack overflow. Compiler & platform mormot.db.raw.duckdb+2 45779260+126-29

db: DuckDB 2.0 support - masked FPU exceptions and new column types

Impact

FPC configurations with the default unmasked exceptions no longer raise EInvalidOp merely by opening or using DuckDB 2.0. TIMESTAMPTZ_NS and GEOMETRY columns become readable with their expected mORMot field types, and unsupported types fail explicitly instead of crashing through stack exhaustion. Delphi also receives the new type mappings, while existing supported types keep their behavior.

Public API

  • DUCKDB_TYPE_GEOMETRY, DUCKDB_TYPE_VARIANT, DUCKDB_TYPE_TIMESTAMP_TZ_NSadded — Adds the DuckDB 2.0 logical type identifiers 40, 41 and 42 to mormot.db.raw.duckdb.

tf · 07:48 UTC · view the commit on GitHub →

6 Medium Windows Authenticode verification moves to the OS security unit TWinVerifyStatus, WinVerifyExeSignature and IsExeSignatureValid move unchanged from the Windows section of mormot.misc.pecoff to mormot.core.os.security, together with the WinVerifyTrust records, constants and implementation. mormot.misc.pecoff keeps the cross-platform GetExeSignature and IsExeSigned PE parsing functions and removes its FPC PACKRECORDS workaround. Breaking changes mormot.core.os.security+1 9f798fe6+188-193

os: moved WinVerifyExeSignature() to mormot.core.os.security

Impact

Windows code that imported only mormot.misc.pecoff to call the verification functions will no longer compile until mormot.core.os.security is added to uses. Function signatures and runtime verification behavior are unchanged. Code using GetExeSignature or IsExeSigned remains on mormot.misc.pecoff, and non-Windows builds do not gain the Windows-only API.

Migration required

Search for TWinVerifyStatus, WinVerifyExeSignature and IsExeSignatureValid. Add mormot.core.os.security to the uses clause of each Windows unit that references them; keep mormot.misc.pecoff when GetExeSignature or IsExeSigned is also used.

Public API

  • mormot.misc.pecoff.TWinVerifyStatus/WinVerifyExeSignature/IsExeSignatureValidremoved — The Windows-only verification type and functions are no longer declared by mormot.misc.pecoff.
  • mormot.core.os.security.TWinVerifyStatus/WinVerifyExeSignature/IsExeSignatureValidadded — The same Windows-only public declarations now live in mormot.core.os.security.

tf · 08:41 UTC · view the commit on GitHub →

7 Medium EMF text inside a GDI path now follows the path paint operation TPdfEnum records EMR_EXTTEXTOUTA/W encountered between BeginPath and EndPath in a separate fPathText stream. FillPath, StrokePath and StrokeAndFillPath replay that text afterward with PDF text render modes 0, 1 or 2 and the selected brush or pen; AbortPath drops it. PathTextOut also adds opaque backgrounds, ETO_OPAQUE rectangles, underline and strike-out geometry to the path while ETO_CLIPPED contributes no text. Fixes mormot.ui.pdf+1 fb61df56+359-7

ui: pdf - EMF text in a GDI path is painted with the path

Impact

Converted EMF previously drew path text immediately in the text color: aborted paths still showed it, StrokePath filled it, and FillPath ignored the brush color. Generated PDFs now follow observed Windows GDI behavior for those cases. The change affects document appearance only when EMF text is recorded inside a GDI path; normal PDF text remains unchanged on Delphi and FPC.

Sven Harazim · 07:11 UTC · view the commit on GitHub →

8 Medium HTTP/1.1 avoids the close-body timeout without breaking HTTP/1.0 GetRequest now sets a missing Content-Length to zero for keep-alive requests, HTTP/1.1 requests, and GET. An HTTP/1.0 non-GET request using connection close keeps ContentLength negative so the existing read-until-close path can receive its body. Fixes mormot.net.server cc485cc2+4-1

net: keep the read-until-close body for HTTP/1.0 requests only

Impact

Python urllib and similar HTTP/1.1 clients can send empty POST or DELETE requests with Connection: close without stalling the mORMot server until timeout. Legacy HTTP/1.0 clients that delimit a non-GET body by closing the socket continue to work. No application API changes are required on Delphi or FPC.

Public API

  • THttpServerSocket.GetRequestbehaviour-changed — Missing length means an empty body for HTTP/1.1, while HTTP/1.0 non-GET may still read until close.

Joel · 10:58 UTC · view the commit on GitHub →

9 Medium Missing request length is first treated as an empty body THttpServerSocket.GetRequest changes any negative Http.ContentLength to zero after parsing the headers. This prevents DELETE or empty POST requests sent with Connection: close and no Content-Length from entering the read-until-EOF path and waiting until the socket timeout. Fixes mormot.net.server daa87145+1-3

net: request without Content-Length has an empty body, also with Connection: close

Impact

The change removes the observed HTTP/1.1 hang, but on this intermediate revision it also suppresses valid HTTP/1.0 non-GET bodies delimited by connection close. The next commit in the edition corrects that scope, so production servers should not stop on this SHA.

Public API

  • THttpServerSocket.GetRequestbehaviour-changed — A request without Content-Length is initially treated as bodyless regardless of Connection: close.

big_rid · 10:19 UTC · view the commit on GitHub →

10 Low The service-instance hold avoids a per-call compiler finalizer ExecuteMethod replaces the local managed IInterface variable with a pointer that owns the same interface reference. HandleCleanup releases it in its existing finally block, and the two early exits clear it explicitly. This preserves the lifetime fix while avoiding an extra compiler-generated try..finally on every service call. Performance mormot.soa.server dc3195e9+8-2

soa: release the hold reference manually in ExecuteMethod

Impact

Service behavior and the public signature are unchanged from the preceding fix. Delphi and FPC backends keep the protection against concurrent release with less managed-variable overhead in the hot ExecuteMethod path; no application change is required.

Stefan Diestelmann · 22:00 UTC · view the commit on GitHub →

Upstream activity commits per day · last 60 days
Commits1007
Active days49/60
Busiest2026-09-30
Peak60
2026-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: 12 commits2026-10-11: 2 commits2026-10-12: 40 commits2026-10-13: 31 commits2026-10-14: 23 commits2026-10-15: 16 commits2026-10-16: 27 commits2026-10-17: 0 commits2026-10-18: 0 commits2026-10-19: 0 commits2026-10-20: 0 commits2026-10-21: 0 commits2026-10-22: 3 commits2026-10-23: 6 commits2026-10-24: 29 commits2026-10-25: 7 commits2026-10-26: 25 commits2026-10-27: 4 commits2026-10-28: 8 commits2026-10-29: 17 commits2026-10-30: 20 commits2026-10-31: 0 commits2026-11-01: 0 commits2026-11-02: 16 commits2026-11-03: 32 commits2026-11-04: 15 commits2026-11-05: 32 commits2026-11-06: 26 commits2026-11-07: 19 commits2026-11-08: 2 commits2026-11-09: 29 commits2026-11-10: 17 commits2026-11-11: 8 commits2026-11-12: 38 commits2026-11-13: 39 commits2026-11-14: 9 commits2026-11-15: 6 commits2026-11-16: 21 commits2026-11-17: 30 commits2026-11-18: 37 commits2026-11-19: 28 commits2026-11-20: 31 commits2026-11-21: 0 commits2026-11-22: 0 commits2026-11-23: 1 commit2026-11-24: 6 commits2026-11-25: 3 commits2026-11-26: 3 commits2026-11-27: 0 commits2026-11-28: 0 commits
2026-09-302026-11-28