À regarderun correctif ou une fonctionnalité utileEverything reviewed cleanly.
Futex natif pour TOSLightLock et correction d'un interblocage ICU
Les commits du jour font évoluer en profondeur les primitives de synchronisation du cœur de mORMot 2. TOSLightLock s'appuie désormais sur le futex natif sous Linux et sur WaitOnAddress sous Windows 8+, avec un gain attendu en contention. Un interblocage de la bibliothèque ICU est corrigé, et le polling réseau asynchrone gagne un contrôle de borne.
En bref
- TOSLightLock utilise le futex natif sous Linux et WaitOnAddress sous Windows 8+.
- TIcuLibrary corrige un interblocage lors de la création d'un convertisseur partagé.
- TAsyncConnections corrige un dépassement de borne possible dans le polling.
- Les mécanismes d'attente active sont extraits vers l'unité core base.
Conseil de mise à jour
Teams pushing heavy multithreaded workloads on Linux or Windows 8+ should benefit from the TOSLightLock upgrade. The ICU deadlock fix is recommended for applications dealing with internationalization.
10 sur 10 entrées · 10 commits upstream
1
Élevée
Interblocage corrigé au chargement des convertisseurs ICU
Corrects the unlock logic in TIcuLibrary.SharedUcnvGet(). The previous code mistakenly released a converter-specific lock instead of the main library lock after populating the converter cache.
Correctifs
mormot.core.os
87dbb9fc+3-3
core: fix deadlock in TIcuLibrary
Impact
Évite les interblocages lorsque plusieurs threads demandent simultanément un convertisseur de texte à la bibliothèque ICU.
Mise à jour recommandée
Pull this commit if your server relies heavily on ICU internationalization functions.
Unités
2
Élevée
TOSLightLock uses WaitOnAddress on Windows 8+
Upgrades TOSLightLock on Windows to use the WaitOnAddress and WakeByAddressSingle API (introduced in Windows 8), moving away from Slim Reader/Writer (SRW) locks.
Performance
mormot.core.os+3
17a26fa9+106-124
core: TOSLightLock now uses WaitOnAddress/WakeByAddressSingle on Win8+
Impact
Faster lock acquisition on Windows 8 and newer, especially under high contention, by avoiding SRW lock overhead.
3
Élevée
TOSLightLock upgraded to use native futex on Linux
Replaces the underlying Linux implementation of TOSLightLock with a direct 32-bit futex syscall instead of a TRTLCriticalSection. It falls back to spin-and-wait on older kernels.
Performance
mormot.core.os
64d1d6db+106-23
core: TOsLightLock uses a futex on Linux
Impact
Significantly improves requests-per-second and threading stability on Linux backends. It is now as fast as TLightLock on the uncontended fast path.
Unités
4
Moyenne
Fixed TOSLightLock fallback on Android and Delphi POSIX
Restores the TRTLCriticalSection fallback for TOSLightLock on platforms without native futex or pthread_mutex support, like Android and Delphi POSIX. The previous commits inadvertently broke this fallback.
Correctifs
mormot.core.os+1
cabcd0ec+41-40
core: another pass of TOsLightLock
Impact
Applications running on Android or compiled with Delphi for POSIX will compile and run correctly again. No impact on Windows or FPC Linux.
5
Moyenne
Fixed late loading of Windows 8 synchronization API
Moves the runtime loading of API-MS-Win-Core-Synch-l1-2-0.dll to happen after the OS version has been properly populated into OSVersion32.
Correctifs
mormot.core.os
a426a84d+14-14
core: fixed API-MS-Win-Core-Synch-l1-2-0.dll loading
Impact
Resolves a bug where the new futex API was not initialized correctly on modern Windows versions because the version check failed at initialization time.
Unités
6
Moyenne
Fixed potential bounds error in asynchronous connections
Updates TAsyncConnections.ThreadPollingWakeupLocked to check for <= 0 instead of exactly 0 when inspecting spare events.
Correctifs
mormot.net.async
440d9e9d+3-3
net: fixed potential out of range in TAsyncConnections.ThreadPollingWakeupLocked;
Impact
Prevents potential out-of-range errors or negative event counters from causing issues in the async polling thread loop.
Unités
7
Faible
Published a raw DoPause procedure
Extracts the CPU pause logic (the pause opcode on x86, yield on ARM) into a globally available DoPause procedure in mormot.core.base.
Nouveautés
mormot.core.base
4cd5cff1+17-2
core: let publish a raw DoPause procedure
Impact
Developers can now explicitly call DoPause in custom spin loops to reduce CPU power consumption and cache traffic.
API publique
DoPauseadded — A cross-platform procedure that invokes CPU pause or yield instructions.
Unités
8
Faible
Moved NextSpin to mormot.core.base
Moves the adaptive spin-wait function NextSpin() and its associated SPIN_FACTOR and SPIN_COUNT constants from mormot.core.os into the lower-level mormot.core.base unit.
Sous le capot
mormot.core.base+1
268d8600+91-85
core: moved NextSpin() to mormot.core.base
Impact
No direct impact on application code. It allows simpler units without OS dependencies to use the adaptive spin logic.
9
Faible
Refactored TIcuLibrary internal locking fields
Changes the internal locking fields in TIcuLibrary from PtrUInt to cardinal to match the expected types for TLightLock primitives.
Sous le capot
mormot.core.os
1f1fe8df+17-12
core: fixed TIcuLibrary locking code
Impact
No impact on application code, internal refactoring only.
Unités
10
Faible
Updated TOSLightLock usage comments
Updates code comments referencing TOSLightLock across several units to reflect the new Windows 8+ and Linux futex behaviors.
Entretien
mormot.core.mvc+3
043d364d+6-6
core: fixed TOSLightLock usage comments in code
Impact
No impact on application code, internal refactoring only.