From tri at observatorysciences.co.uk  Thu Feb  5 09:20:47 2026
From: tri at observatorysciences.co.uk (Thomas Ives)
Date: Thu, 5 Feb 2026 09:20:47 +0000
Subject: [omniORB] Windows timeout during ORB shutdown
In-Reply-To: <d3c86cb30d7c044e3558a55aeacb76b97d469bc8.camel@grisby.org>
References: <d142dc79-10fa-40ec-9665-b9051467c178@observatorysciences.co.uk>
 <d805e831-2de5-4b05-9aab-300b1cd09daf@observatorysciences.co.uk>
 <623234d5add971ee2ad33bb40acee20854f5cc2f.camel@grisby.org>
 <ca5a229f-c029-4111-8565-edb7ab82916f@observatorysciences.co.uk>
 <d3c86cb30d7c044e3558a55aeacb76b97d469bc8.camel@grisby.org>
Message-ID: <f07718e7-0b3b-4705-a6f9-2a55353a50f2@observatorysciences.co.uk>

On 30/01/2026 16:58, Duncan Grisby wrote:

> That is interesting, but I think it is too fragile to use here.?In your
> test, all the connection worker threads are blocked in select, but in
> general there is no way to know if the worker threads are in select at
> the time, or whether they are busy doing some other work that might be
> damaged by the asynchronous call.

The APC will only be called when the thread is supposed to be sleeping, 
or in what Windows calls an "alterable state", so there is no chance of 
damaging any work the thread is doing.? From [1]:

 > When a user-mode APC is queued, the thread to which it is queued is 
not directed to call the APC function unless it is in an alertable 
state. A thread enters an alertable state when it calls the SleepEx, 
SignalObjectAndWait, MsgWaitForMultipleObjectsEx, 
WaitForMultipleObjectsEx, or WaitForSingleObjectEx function.

> Real servers, as opposed to test code, are not expected to rapidly
> start and stop repeatedly, so I don't think the additional significant
> complexity to make it faster would be a good idea.

Indeed, I think it is fair to say it isn't worth the complexity cost to 
interrupt the threads on Windows.

> I'm going to commit the attached small change. I suggest that for your
> test code you set scanGranularity to 1. That will mean it takes a
> second to stop, which is still quite long, but faster than the default
> 5 seconds.

Thanks for the patch.? Although this is not ideal for our case, I still 
think this will speed our Windows tests up significantly.

Thanks

Thomas

[1] 
https://learn.microsoft.com/en-us/windows/win32/sync/asynchronous-procedure-calls



