Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
fff1fc6
Added failure path in case of Event Enqueue fails
Santhosha-bk Nov 21, 2025
6c0fd3a
Bump actions/checkout from 5.0.1 to 6.0.0 (#5615)
dependabot[bot] Nov 24, 2025
53e0e99
Build for Android Arm/Arm64 in CI (#5620)
kitlith Nov 25, 2025
92f6736
Bump submodules/openssl from `af76e77` to `47a47e0` (#5619)
dependabot[bot] Nov 25, 2025
51aabfb
Document Stateless Retry Key Generation (#5258)
anrossi Nov 26, 2025
3f321b6
Fix QTIP port selection (#5626)
guhetier Nov 26, 2025
e001860
Bump submodules/openssl from `47a47e0` to `fb08eb8` (#5628)
dependabot[bot] Dec 2, 2025
570f2c2
Bump github/codeql-action from 4.31.4 to 4.31.6 (#5629)
dependabot[bot] Dec 2, 2025
1a346f9
Bump actions/setup-dotnet from 5.0.0 to 5.0.1 (#5630)
dependabot[bot] Dec 2, 2025
3b04ceb
Bump docker/metadata-action from 5.9.0 to 5.10.0 (#5631)
dependabot[bot] Dec 2, 2025
0905dbb
Fix validateGlobalParam test on ADO pipelines (#5600)
guhetier Dec 3, 2025
3f4896a
Fix the Key update test (#5604)
guhetier Dec 4, 2025
b0ce510
Fail test passes when a test succeeds only after a retry (#5636)
guhetier Dec 4, 2025
91cf758
Update Connection detailed reference counts to use ref counting APIs …
anrossi Dec 4, 2025
71f0118
Fix GCC multichar warning with push/pop pragma (#5632) (#5639)
EclipseAditya Dec 5, 2025
980f202
Bump submodules/openssl from `fb08eb8` to `94394a6` (#5641)
dependabot[bot] Dec 8, 2025
4e84609
Fix some flakyness in QuicTestOperationPriority (#5640)
guhetier Dec 8, 2025
0b1071e
Add logging for spinquic tests. (#5643)
ProjectsByJackHe Dec 9, 2025
9393615
Bump submodules/openssl from `94394a6` to `17411f0` (#5658)
dependabot[bot] Dec 15, 2025
1fb8fec
Fix Rust connection callback context cleanup and add regression test …
LindonAliu Dec 15, 2025
4c0f21f
Bump submodules/googletest from `1b96fa1` to `065127f` (#5657)
dependabot[bot] Dec 15, 2025
3bb7b41
Update Ubuntu 24.04 Dockerfile (#5662)
anrossi Dec 15, 2025
33840a8
Add verbose logs to some test passes to catch schannel timeout issue …
guhetier Dec 16, 2025
e1b2957
Synchronize rust test certificate creation (#5667)
guhetier Dec 16, 2025
28117e6
Revert "Added failure path in case of Event Enqueue fails"
Santhosha-bk Dec 16, 2025
9502616
Adding WCP as backup mechanism
Santhosha-bk Dec 16, 2025
bf7f834
delete dpdk source file (#5661)
mtfriesen Dec 16, 2025
6c04c5b
Fix invalid handle access for RegistrationCloseCleanup Events (#5673)
ProjectsByJackHe Dec 17, 2025
5173539
Fix spurious failure in Handshake/WithHandshakeArgs1.ResumeRejection …
guhetier Dec 17, 2025
7f4d7f9
Bump rust-toolchain from 1.91.1 to 1.92.0 (#5659)
dependabot[bot] Dec 17, 2025
2f12996
Use ProcDump instead of WER to collect user mode crash dumps (#5665)
ProjectsByJackHe Dec 18, 2025
45f73a5
[DeepTest] Add Unit Test cases for Cubic Congestion Control (#5653)
saikat107 Dec 18, 2025
de83cc3
New packaging pipeline + Improve current PR based one (#5682)
liveans Dec 18, 2025
f290989
Add ref count tracking to CXPLAT_WORKER_POOL (#5655)
anrossi Dec 19, 2025
9639f53
Added new keys for OpenSUSE 16 and SLES16 + Added validation for RHEL…
gaurav2699 Dec 19, 2025
639e92f
Implement a generic test ioctl for kernel mode tests (#5650)
guhetier Dec 21, 2025
9117f56
Update SECURITY.md to remove email reporting option (#5701)
anrossi Jan 5, 2026
9724fc0
Add debug object tracker (stream only) (#5703)
mtfriesen Jan 7, 2026
1506ae6
double wait time in drop test (#5704)
mtfriesen Jan 7, 2026
2466d60
Set minimum .NET SDK version via global.json (#5702)
mtfriesen Jan 7, 2026
9576b08
Add Datapath Cleanup Logs (#5687)
anrossi Jan 8, 2026
aeb7658
Add more objects to the debug tracker (#5706)
mtfriesen Jan 8, 2026
99d5fcf
Bump codecov/codecov-action from 5.5.1 to 5.5.2 (#5696)
dependabot[bot] Jan 8, 2026
6790602
Bump actions/download-artifact from 6.0.0 to 7.0.0 (#5699)
dependabot[bot] Jan 8, 2026
3fd93da
Bump actions/upload-artifact from 5.0.0 to 6.0.0 (#5698)
dependabot[bot] Jan 8, 2026
bb77903
Bump shogo82148/actions-setup-perl from 1.36.0 to 1.37.0 (#5697)
dependabot[bot] Jan 8, 2026
7c2dd61
Bump submodules/openssl from `17411f0` to `cbdb33e` (#5700)
dependabot[bot] Jan 8, 2026
2c7ff2b
Bump actions/checkout from 6.0.0 to 6.0.1 (#5695)
dependabot[bot] Jan 8, 2026
a981494
Bump submodules/googletest from `065127f` to `9156d4c` (#5692)
dependabot[bot] Jan 9, 2026
521f091
Minor cleanups of temporary changes from previous PRs (#5646)
guhetier Jan 12, 2026
29a5b2d
Docs: CA cert files are only supported in OpenSSL. (#5684)
Myriachan Jan 12, 2026
817841a
Bump submodules/googletest from `5554fca` to `ff6133a` (#5711)
dependabot[bot] Jan 13, 2026
c31d6a6
Bump submodules/openssl from `cbdb33e` to `e13e673` (#5710)
dependabot[bot] Jan 13, 2026
53c1f7f
Fix race between causing spurious failure in the ConnectTcp datapath …
guhetier Jan 14, 2026
f1b22c1
Fix static build with CMAKE_DEBUG_POSTFIX (#5656)
Maiyu27 Jan 14, 2026
7d4f45b
Migrate a batch of test to the new IOCTL pattern (#5714)
guhetier Jan 14, 2026
43959b6
Persists the virtual buffer size when switching to app owned buffers …
guhetier Jan 16, 2026
a20eb81
Bump submodules/openssl from `e13e673` to `5e41f2f` (#5726)
dependabot[bot] Jan 20, 2026
44277dc
Bump ubuntu from `104ae83` to `aa6efdd` in /.docker/ubuntu-22.04 (#5724)
dependabot[bot] Jan 20, 2026
3523540
Bump submodules/googletest from `ff6133a` to `8508785` (#5725)
dependabot[bot] Jan 20, 2026
3ea2981
Add dependabot groups for Actions and Submodules (#5731)
mtfriesen Jan 21, 2026
b7cd364
Bump the actions group with 2 updates (#5735)
dependabot[bot] Jan 22, 2026
fa48399
update ETW to disambiguate datapath sends (#5741)
ProjectsByJackHe Jan 24, 2026
727fb1f
Bump the actions group with 2 updates (#5746)
dependabot[bot] Jan 26, 2026
29c54c1
Bump rust-toolchain from 1.92.0 to 1.93.0 (#5744)
dependabot[bot] Jan 26, 2026
a813157
Bump submodules/openssl from `5e41f2f` to `081b08b` (#5745)
dependabot[bot] Jan 27, 2026
6ede309
Treat SEC_E_INTERNAL_ERROR as SEC_E_NO_CREDENTIAL when querying certi…
guhetier Jan 27, 2026
f2b221f
Make test callback handler thread safe (#5740)
guhetier Jan 27, 2026
55d4959
Adding WCP as backup mechanism
Santhosha-bk Jan 28, 2026
723c6db
Bump ubuntu from `c35e29c` to `cd1dba6` in /.docker/ubuntu-24.04 (#5734)
dependabot[bot] Jan 28, 2026
4dd2ae2
Continue migrating tests to new IOCTL (#5723)
guhetier Jan 28, 2026
85d4a4a
Bump ubuntu from `aa6efdd` to `c7eb020` in /.docker/ubuntu-22.04 (#5732)
dependabot[bot] Jan 28, 2026
d19a4f7
Increase the timeout in test helper SendFrame (#5736)
guhetier Jan 29, 2026
d664bfc
Bump submodules/openssl from `081b08b` to `d82e8d7` (#5760)
dependabot[bot] Feb 2, 2026
68fca52
Document why new CID are sent on connection partition change (#5764)
guhetier Feb 3, 2026
514f048
Bump submodules/googletest from `8508785` to `56efe39` (#5758)
dependabot[bot] Feb 4, 2026
d491e84
Add an RDMA dev doc for WIP (#5762)
ProjectsByJackHe Feb 4, 2026
cd94771
Fix false hash table clashes in raw datapath creation (#5747)
ProjectsByJackHe Feb 4, 2026
6765f86
Ensure async task completes before sending packets (#5765)
guhetier Feb 4, 2026
d52d60a
Bump the actions group with 2 updates (#5761)
dependabot[bot] Feb 4, 2026
601f351
Add linker options for hotpatching on x64 kernel driver (#5437)
toribioa Feb 4, 2026
f672aaa
Add linker options for hotpatching on ARM64 kernel driver (#5444)
toribioa Feb 4, 2026
b1736c6
Migrate the remaining test to the common IOCTL and cleanup the old pa…
guhetier Feb 4, 2026
bd5c5ee
Ignore all Ubuntu Docker dependabot updates (#5776)
ProjectsByJackHe Feb 6, 2026
6c284c8
Add automation to reverse mirror PRs (#5775)
mtfriesen Feb 6, 2026
f2b02bb
Bump github/codeql-action from 4.32.0 to 4.32.2 in the actions group …
dependabot[bot] Feb 9, 2026
1bc85c6
Bump submodules/googletest from `56efe39` to `5a9c3f9` (#5778)
dependabot[bot] Feb 9, 2026
e636e6e
Bump submodules/openssl from `d82e8d7` to `19bccb9` (#5779)
dependabot[bot] Feb 9, 2026
dbfcce1
Do not use bitflags in an attempt to solve flakyness on ValidateAlpns…
guhetier Feb 11, 2026
ed14762
Remove unsupported win32 and ARM configs from kernel solution (#5788)
guhetier Feb 14, 2026
3cc7911
Revert "Remove unsupported win32 and ARM configs from kernel solution…
guhetier Feb 17, 2026
e8667f0
Update setup perl action (#5796)
guhetier Feb 17, 2026
090953f
Bump submodules/googletest from `5a9c3f9` to `77f6bd3` (#5791)
dependabot[bot] Feb 18, 2026
3f1d8ec
Bump the actions group with 2 updates (#5794)
dependabot[bot] Feb 18, 2026
a374deb
Bump rust-toolchain from 1.93.0 to 1.93.1 (#5793)
dependabot[bot] Feb 18, 2026
b7d6fe6
Bump submodules/openssl from `19bccb9` to `5b203b3` (#5792)
dependabot[bot] Feb 18, 2026
72c4d31
[DeepTest] Install and compute code coverage for ubuntu (#5782)
saikat107 Feb 20, 2026
9565a77
Bump submodules/googletest from `850cb69` to `e990711` (#5803)
dependabot[bot] Feb 23, 2026
3b73647
Bump submodules/openssl from `04b26ea` to `862356b` (#5804)
dependabot[bot] Feb 23, 2026
2c2f078
Bump github/codeql-action from 4.32.3 to 4.32.4 in the actions group …
dependabot[bot] Feb 23, 2026
116a7ad
Add the `/utf-8` flag to the compiler options (#5811)
masa-koz Feb 25, 2026
1d1bf32
Fix memory leak in ServerSendIp error paths (#5802)
MarkedMuichiro Feb 25, 2026
0746263
[Mirror #14815372] Bump ubuntu from `cd1dba6` to `d1e2e92` in /.docke…
mtfriesen Feb 25, 2026
26c3dfa
Enable LTTng logging with sanitizers and fix TlsTest leak (#5816)
leikong Feb 26, 2026
15007ff
Bump the actions group with 2 updates (#5829)
dependabot[bot] Mar 2, 2026
8b00da3
Bump submodules/openssl from `862356b` to `9a19abc` (#5828)
dependabot[bot] Mar 2, 2026
aa0b573
Bump submodules/googletest from `e990711` to `73a63ea` (#5827)
dependabot[bot] Mar 2, 2026
3b71c17
[Mirror #14878183] Bump ubuntu from `c7eb020` to `3ba65aa` in /.docke…
mtfriesen Mar 2, 2026
d87376c
Fix CIBIR_ID GetParam copies one fewer byte than reported BufferLengt…
Copilot Mar 2, 2026
ec046ee
Fix copy-paste bugs in settings.c for TlsServerMaxSendBuffer (#5823)
Copilot Mar 2, 2026
56fe046
Update copilot instructions (#5831)
guhetier Mar 2, 2026
80309ab
Fix UBSan error: match QuicConnRecvResumptionTicket signature to call…
leikong Mar 4, 2026
6c26eab
fix(forwarder): null-check allocations and fix resource leaks in quic…
MarkedMuichiro Mar 4, 2026
832d0a5
Fix ASAN leaks in casted_clog_bytearray with stdout logging (#5800)
Copilot Mar 4, 2026
adfed92
Disable the scorecard analysis run temporarily (#5808)
guhetier Mar 4, 2026
ac1b4d5
Added support for custom OpenSSL selection (#5799)
toxicteddy00077 Mar 4, 2026
9b5b9df
Cleanups after migrating to a single IOCTL to invoke tests in kernel …
guhetier Mar 4, 2026
161c5ba
Update DotNet SDK version from 10.0.101 to 10.0.103 (#5846)
guhetier Mar 5, 2026
45a46f3
Consolidate .NET SDK versions to 10.0.x across all GitHub workflows (…
Copilot Mar 6, 2026
acf0b8f
Add rust build link dependencies (#5854)
guhetier Mar 10, 2026
814cb70
Bump the actions group with 6 updates (#5852)
dependabot[bot] Mar 10, 2026
40a6ebe
Bump submodules/googletest from `73a63ea` to `a35bc76` (#5849)
dependabot[bot] Mar 10, 2026
2afbd5b
Bump rust-toolchain from 1.93.1 to 1.94.0 (#5851)
dependabot[bot] Mar 10, 2026
5cffb35
Bump submodules/openssl from `9a19abc` to `1281c39` (#5850)
dependabot[bot] Mar 10, 2026
d9a2cf5
Fix reentrant assert failures in session resumption with custom execu…
leikong Mar 12, 2026
7bd862e
Use zero-init pools (#5855)
ProjectsByJackHe Mar 13, 2026
d4605fb
Bump actions/download-artifact from 8.0.0 to 8.0.1 in the actions gro…
dependabot[bot] Mar 16, 2026
acbb2af
Bump submodules/googletest from `a35bc76` to `94be250` (#5862)
dependabot[bot] Mar 16, 2026
fff66e9
[DeepTest] CUBIC Congestion Control Test Suite Enhancement (#5685)
saikat107 Mar 16, 2026
1913f3b
Bump submodules/openssl from `1281c39` to `7301e1f` (#5863)
dependabot[bot] Mar 16, 2026
cf857c2
[Mirror #15050561] Bump ubuntu from `d1e2e92` to `0d39fcc` in /.docke…
mtfriesen Mar 18, 2026
f63627f
set reverse mirror PRs to auto-merge (#5869)
mtfriesen Mar 18, 2026
3b694fa
[Mirror #15062763] Bump ubuntu from `3ba65aa` to `445586e` in /.docke…
mtfriesen Mar 18, 2026
4da9cff
[Mirror #15077103] Bump ubuntu from `0d39fcc` to `186072b` in /.docke…
mtfriesen Mar 19, 2026
3cb76b0
Upgrade .NET SDK to 10.0.104 (#5878)
guhetier Mar 20, 2026
0071278
[Mirror #15088764] Bump ubuntu from `445586e` to `ce4a593` in /.docke…
mtfriesen Mar 20, 2026
773451c
Bump the actions group with 4 updates (#5886)
dependabot[bot] Mar 25, 2026
bb5f142
Bump submodules/openssl from `7301e1f` to `7d3cc5b` (#5884)
dependabot[bot] Mar 25, 2026
5c04709
Bump submodules/googletest from `94be250` to `f38004c` (#5885)
dependabot[bot] Mar 25, 2026
21e7483
Fix SAL annotation placement on function templates (#5895)
guhetier Mar 26, 2026
f93efb7
Fix QuicOperationFree using CXPLAT_FREE on pool-allocated QUIC_RECV_C…
Copilot Mar 27, 2026
c0b1389
Added WCP only for shutdownSqe
Santhosha-bk Mar 31, 2026
8e8214a
Added failure path in case of Event Enqueue fails
Santhosha-bk Nov 21, 2025
b70222b
Revert "Added failure path in case of Event Enqueue fails"
Santhosha-bk Dec 16, 2025
1ed53a4
Adding WCP as backup mechanism
Santhosha-bk Dec 16, 2025
a22a6d2
Adding WCP as backup mechanism
Santhosha-bk Jan 28, 2026
a358899
Merge branch 'santhoshab/IOCPChange' of https://github.com/microsoft/…
Santhosha-bk Mar 31, 2026
0b65087
Merge branch 'santhoshab/IOCPChange' of https://github.com/microsoft/…
Santhosha-bk Mar 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions src/platform/datapath_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1021,10 +1021,20 @@ CxPlatSocketContextUninitialize(
//
epoll_ctl(*SocketContext->DatapathPartition->EventQ, EPOLL_CTL_DEL, SocketContext->SocketFd, NULL);

CXPLAT_FRE_ASSERT(
CxPlatEventQEnqueue(
if (!CxPlatEventQEnqueue(
SocketContext->DatapathPartition->EventQ,
&SocketContext->ShutdownSqe));
&SocketContext->ShutdownSqe)) {
int Errno = errno;
QuicTraceEvent(
DatapathErrorStatus,
"[data][%p] ERROR, %u, %s.",
SocketContext->Binding,
Errno,
"CxPlatEventQEnqueue failed (Shutdown)");

// Queue can’t run the completion, so do it inline to finish teardown.
CxPlatSocketContextUninitializeEventComplete(&SocketContext->ShutdownSqe.Cqe);
Comment thread
Santhosha-bk marked this conversation as resolved.
Outdated
}
}
}

Expand Down Expand Up @@ -2183,10 +2193,20 @@ SocketSend(
CxPlatLockRelease(&SocketContext->TxQueueLock);
if (SendPending) {
if (FlushTxQueue) {
CXPLAT_FRE_ASSERT(
CxPlatEventQEnqueue(
if (!CxPlatEventQEnqueue(
SocketContext->DatapathPartition->EventQ,
&SocketContext->FlushTxSqe));
&SocketContext->FlushTxSqe)) {
int Errno = errno;
QuicTraceEvent(
DatapathErrorStatus,
"[data][%p] ERROR, %u, %s.",
SocketContext->Binding,
Errno,
"CxPlatEventQEnqueue failed (FlushTx)");

// Run the completion inline to keep draining sends.
CxPlatSocketContextFlushTxEventComplete(&SocketContext->FlushTxSqe.Cqe);
}
}
return;
}
Expand Down
17 changes: 14 additions & 3 deletions src/platform/datapath_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,20 @@ CxPlatSocketContextUninitialize(
&SocketContext->IoSqe,
EVFILT_READ,
EV_DELETE);
CxPlatEventQEnqueue(
SocketContext->DatapathPartition->EventQ,
&SocketContext->ShutdownSqe);
if (!CxPlatEventQEnqueue(
SocketContext->DatapathPartition->EventQ,
&SocketContext->ShutdownSqe)) {
int Errno = errno;
QuicTraceEvent(
DatapathErrorStatus,
"[data][%p] ERROR, %u, %s.",
SocketContext->Binding,
Errno,
"CxPlatEventQEnqueue failed (Shutdown)");

// Queue can’t run the completion, so run it inline.
CxPlatSocketContextUninitializeEventComplete(&SocketContext->ShutdownSqe.Cqe);
}
}
}

Expand Down
13 changes: 12 additions & 1 deletion src/platform/datapath_raw_xdp_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,18 @@ CxPlatXdpExecute(
XdpPartitionShutdown,
"[ xdp][%p] XDP partition shutdown",
Partition);
CxPlatEventQEnqueue(Partition->EventQ, &Partition->ShutdownSqe);
if (!CxPlatEventQEnqueue(Partition->EventQ, &Partition->ShutdownSqe)) {
QuicTraceEvent(
LibraryErrorStatus,
"[xdp] ERROR, %u, %s.",
errno,
"CxPlatEventQEnqueue failed (Shutdown)");
//
// The event queue can’t deliver the shutdown SQE, so run the completion
// inline to drop the reference.
//
CxPlatPartitionShutdownEventComplete(&Partition->ShutdownSqe.Cqe);
}
return FALSE;
}

Expand Down
13 changes: 12 additions & 1 deletion src/platform/datapath_raw_xdp_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,18 @@ CxPlatXdpExecute(
Queue->TxXsk = NULL;
Queue = Queue->Next;
}
CxPlatEventQEnqueue(Partition->EventQ, &Partition->ShutdownSqe);
if (!CxPlatEventQEnqueue(Partition->EventQ, &Partition->ShutdownSqe)) {
QuicTraceEvent(
LibraryErrorStatus,
"[ xdp] ERROR, %u, %s.",
GetLastError(),
"CxPlatEventQEnqueue failed (Shutdown)");
//
// Manually drop the partition’s ref since the completion callback
// won’t fire without the SQE being queued.
//
CxPlatDpRawRelease((XDP_DATAPATH*)Partition->Xdp);
}
return FALSE;
}

Expand Down
104 changes: 89 additions & 15 deletions src/platform/platform_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ typedef struct QUIC_CACHEALIGN CXPLAT_WORKER {
BOOLEAN StoppingThread : 1;
BOOLEAN StoppedThread : 1;
BOOLEAN DestroyedThread : 1;
BOOLEAN EventQClosed : 1;
#if DEBUG // Debug flags - Must not be in the bitfield.
BOOLEAN ThreadStarted;
BOOLEAN ThreadFinished;
Expand Down Expand Up @@ -218,14 +219,47 @@ CxPlatWorkerPoolInitWorker(
return TRUE;
}

void
CxPlatWorkerCleanupEventQueue(
_In_ CXPLAT_WORKER* Worker
)
{
if (!Worker->InitializedEventQ) {
return;
}

if (Worker->InitializedUpdatePollSqe) {
CxPlatSqeCleanup(&Worker->EventQ, &Worker->UpdatePollSqe);
Worker->InitializedUpdatePollSqe = FALSE;
}
if (Worker->InitializedWakeSqe) {
CxPlatSqeCleanup(&Worker->EventQ, &Worker->WakeSqe);
Worker->InitializedWakeSqe = FALSE;
}
if (Worker->InitializedShutdownSqe) {
CxPlatSqeCleanup(&Worker->EventQ, &Worker->ShutdownSqe);
Worker->InitializedShutdownSqe = FALSE;
}

Worker->EventQClosed = TRUE;
CxPlatEventQCleanup(&Worker->EventQ);
Worker->InitializedEventQ = FALSE;
}

void
CxPlatWorkerPoolDestroyWorker(
_In_ CXPLAT_WORKER* Worker
)
{
if (Worker->InitializedThread) {
Worker->StoppingThread = TRUE;
CxPlatEventQEnqueue(&Worker->EventQ, &Worker->ShutdownSqe);
if (!CxPlatEventQEnqueue(&Worker->EventQ, &Worker->ShutdownSqe)) {
QuicTraceEvent(
LibraryError,
"[ lib] ERROR, %s.",
"CxPlatEventQEnqueue(shutdown) Manually closing the event queue.");
CxPlatWorkerCleanupEventQueue(Worker);
}
CxPlatThreadWait(&Worker->Thread);
CxPlatThreadDelete(&Worker->Thread);
#if DEBUG
Expand All @@ -236,18 +270,9 @@ CxPlatWorkerPoolDestroyWorker(
} else {
// TODO - Handle synchronized cleanup for external event queues?
}
if (Worker->InitializedUpdatePollSqe) {
CxPlatSqeCleanup(&Worker->EventQ, &Worker->UpdatePollSqe);
}
if (Worker->InitializedWakeSqe) {
CxPlatSqeCleanup(&Worker->EventQ, &Worker->WakeSqe);
}
if (Worker->InitializedShutdownSqe) {
CxPlatSqeCleanup(&Worker->EventQ, &Worker->ShutdownSqe);
}
if (Worker->InitializedEventQ) {
CxPlatEventQCleanup(&Worker->EventQ);
}

CxPlatWorkerCleanupEventQueue(Worker);

if (Worker->InitializedECLock) {
CxPlatLockUninitialize(&Worker->ECLock);
}
Expand Down Expand Up @@ -498,7 +523,19 @@ CxPlatWorkerPoolAddExecutionContext(
CxPlatLockRelease(&Worker->ECLock);

if (QueueEvent) {
CxPlatEventQEnqueue(&Worker->EventQ, &Worker->UpdatePollSqe);
if (!CxPlatEventQEnqueue(&Worker->EventQ, &Worker->UpdatePollSqe)) {
QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
GetLastError(),
"CxPlatEventQEnqueue failed (updatepoll)");

//
// The event queue isn’t able to deliver the SQE, so execute the
// completion inline to move the pending contexts into the active list.
//
CxPlatUpdateExecutionContexts(Worker);
}
}
}

Expand All @@ -509,7 +546,19 @@ CxPlatWakeExecutionContext(
{
CXPLAT_WORKER* Worker = (CXPLAT_WORKER*)Context->CxPlatContext;
if (!InterlockedFetchAndSetBoolean(&Worker->Running)) {
CxPlatEventQEnqueue(&Worker->EventQ, &Worker->WakeSqe);
if (!CxPlatEventQEnqueue(&Worker->EventQ, &Worker->WakeSqe)) {
QuicTraceEvent(
LibraryErrorStatus,
"[ lib] ERROR, %u, %s.",
GetLastError(),
"CxPlatEventQEnqueue failed (wake)");

//
// Failed to wake the worker, so clear the flag so a future attempt
// can retry once the caller observes the failure.
//
InterlockedFetchAndClearBoolean(&Worker->Running);
}
}
}

Expand Down Expand Up @@ -691,6 +740,27 @@ CxPlatProcessEvents(
Cqes,
ARRAYSIZE(Cqes),
Worker->State.WaitTime);

if (CqeCount == 0) {
if (Worker->EventQClosed) {
Worker->StoppedThread = TRUE;
return;
}
}
#if _WIN32
DWORD Err = GetLastError();
if (Err == ERROR_ABANDONED_WAIT_0 || Err == ERROR_INVALID_HANDLE) {
Worker->EventQClosed = TRUE;
Worker->StoppedThread = TRUE;
return;
}
#elif defined(CX_PLATFORM_LINUX) || defined(CX_PLATFORM_DARWIN)
if (errno == EBADF || errno == EINVAL) {
Worker->EventQClosed = TRUE;
Worker->StoppedThread = TRUE;
return;
}
#endif
uint32_t CurrentCqeCount = CqeCount;
CXPLAT_CQE* CurrentCqe = Cqes;

Expand Down Expand Up @@ -764,6 +834,10 @@ CXPLAT_THREAD_CALLBACK(CxPlatWorkerThread, Context)

CxPlatProcessEvents(Worker);

if (Worker->EventQClosed && Worker->StoppedThread) {
break;
}

if (Worker->State.NoWorkCount == 0) {
Worker->State.LastWorkTime = Worker->State.TimeNow;
} else if (Worker->State.NoWorkCount > CXPLAT_WORKER_IDLE_WORK_THRESHOLD_COUNT) {
Expand Down
Loading