Can I monitor the size of a thread's message queue?

8

Our application is getting a System Call Failed RPC error from DCOM (0x80010100), we suspect that the target thread's message queue is full (although I'm not convinced this is ture). I know the queue is limited to 10,000 messages and I want to see if we're close to this number in the common cases. Is there a way to monitor the size of a thread's message queue?

The most promising option I found was GetQueueStatus but this doesn't include the number of messages in the queue only their types.

multithreading
winapi
message-queue
asked on Stack Overflow Nov 2, 2008 by Motti • edited May 23, 2017 by Community

1 Answer

5

I don't know of any way of monitoring the size of the queue (short of using a kernel debugger and groveling in the internal Win32Thread data structure at TIB+[0x40], which I hardly recommend).

For debugging purposes, to check if the queue is full when you get the error, try doing a PostThreadMessage. If it's full, the call should fail with GetLastError() == 0x718. (Not enough quota is available to process this command.)

answered on Stack Overflow Feb 12, 2009 by Tadmas

User contributions licensed under CC BY-SA 3.0