PostMessage fails with ERROR_NOT_ENOUGH_QUOTA (PROBLEM FOUND, thanks all)
-
My worker thread is passing message to the mainframe window with PostMessage. There is a situation when the PostMessage fails with the ERROR_NOT_ENOUGH_QUOTA error (and sometimes just not fails, but the message is not handled) That thread does not call PostMessage a lot, maybe 4, 5 times in all when it is used. There is someone else that PostMessage and I have a hard time figuring out who/what, even if the messages are system messages or our own. What would be the best way to track down unruly messages that fills the message queue ? ========================= Problem found. Recent modifications created an update loop. Thanks.
I'd rather be phishing!
-
My worker thread is passing message to the mainframe window with PostMessage. There is a situation when the PostMessage fails with the ERROR_NOT_ENOUGH_QUOTA error (and sometimes just not fails, but the message is not handled) That thread does not call PostMessage a lot, maybe 4, 5 times in all when it is used. There is someone else that PostMessage and I have a hard time figuring out who/what, even if the messages are system messages or our own. What would be the best way to track down unruly messages that fills the message queue ? ========================= Problem found. Recent modifications created an update loop. Thanks.
I'd rather be phishing!
Maximilien wrote:
My worker thread is passing message to the mainframe window with PostMessage.
What type of messages (e.g., status)?
Maximilien wrote:
That thread does not call PostMessage a lot, maybe 4, 5 times in all when it is used.
Then something else is hitting the queue's 10,000 limit.
Maximilien wrote:
What would be the best way to track down unruly messages that fills the message queue ?
Is your main thread blocked such that it is unable to process messages in its queue?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
My worker thread is passing message to the mainframe window with PostMessage. There is a situation when the PostMessage fails with the ERROR_NOT_ENOUGH_QUOTA error (and sometimes just not fails, but the message is not handled) That thread does not call PostMessage a lot, maybe 4, 5 times in all when it is used. There is someone else that PostMessage and I have a hard time figuring out who/what, even if the messages are system messages or our own. What would be the best way to track down unruly messages that fills the message queue ? ========================= Problem found. Recent modifications created an update loop. Thanks.
I'd rather be phishing!
-
Maximilien wrote:
My worker thread is passing message to the mainframe window with PostMessage.
What type of messages (e.g., status)?
Maximilien wrote:
That thread does not call PostMessage a lot, maybe 4, 5 times in all when it is used.
Then something else is hitting the queue's 10,000 limit.
Maximilien wrote:
What would be the best way to track down unruly messages that fills the message queue ?
Is your main thread blocked such that it is unable to process messages in its queue?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
The main Application/UI thread is not blocked, I can still interact with it and manually stop the worker thread. The message is to trigger a function in the MainFrame that will set an event (SetEvent). The handler for the MESSAGEID id is never called. (breakpoint never triggered); so the event is never triggered. (I know the INFINITE is not the best idea, but it is approved) My pseudo-code is something like that : Worker Thread:
void f(CWnd* p) // p is a pointer to the mainframe
{
p->PostMessage(MESSAGEID, 0, 0 );const DWORD dwEvent = WaitForMultipleObjects(NB_EVENT_REGISTERED, ghEventList, FALSE, INFINITE);
// ....
}Main UI thread.
ON_MESSAGE(MESSAGEID, OnMESSAGEID )
//....LRESULT CMainFrame::OnMESSAGEID (WPARAM wParam, LPARAM lParam)
{
//... do stuff.
SetEvent(ghEventList[0]);
}I'd rather be phishing!
-
See PostMessageA function | Microsoft Docs[^] for details of this error. Itmay be that something in your code is getting in a loop under certain conditions. Use your debugger to find the culprit.
i am not certain what to look for in the debugger. That's my problem. :sigh:
I'd rather be phishing!
-
My worker thread is passing message to the mainframe window with PostMessage. There is a situation when the PostMessage fails with the ERROR_NOT_ENOUGH_QUOTA error (and sometimes just not fails, but the message is not handled) That thread does not call PostMessage a lot, maybe 4, 5 times in all when it is used. There is someone else that PostMessage and I have a hard time figuring out who/what, even if the messages are system messages or our own. What would be the best way to track down unruly messages that fills the message queue ? ========================= Problem found. Recent modifications created an update loop. Thanks.
I'd rather be phishing!
Well, Just a few years ago my advice would be to use WinDbg and inspect the message queue. However believe it or not many of those fields have been removed from the public symbols on Windows 8.1 and above. Welcome to the age of security via obscurity. [The queue to nowhere](https://blog.yuo.be/2016/07/10/the-queue-to-nowhere/) You could probably add some temporary debug code that checked for the ERROR_NOT_ENOUGH_QUOTA and responded by hooking the window and empty the queue by looping a call to the [GetMessage function](https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getmessage) and dumping/printing all of the messages. Or maybe just call [GetQueueStatus function](https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getqueuestatus) and get an overview. Best Wishes, -David Delaune
-
i am not certain what to look for in the debugger. That's my problem. :sigh:
I'd rather be phishing!
-
Yes, that's what I thought.
I'd rather be phishing!
-
I love you. (in a completely professional way). Merry Christmas.
I'd rather be phishing!
-
I love you. (in a completely professional way). Merry Christmas.
I'd rather be phishing!