Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. PostMessage fails with ERROR_NOT_ENOUGH_QUOTA (PROBLEM FOUND, thanks all)

PostMessage fails with ERROR_NOT_ENOUGH_QUOTA (PROBLEM FOUND, thanks all)

Scheduled Pinned Locked Moved C / C++ / MFC
helpdata-structuresquestionannouncement
10 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #1

    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!

    D L 3 Replies Last reply
    0
    • M Maximilien

      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!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      M 1 Reply Last reply
      0
      • M Maximilien

        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!

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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.

        M 1 Reply Last reply
        0
        • D David Crow

          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

          M Offline
          M Offline
          Maximilien
          wrote on last edited by
          #4

          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!

          1 Reply Last reply
          0
          • L Lost User

            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.

            M Offline
            M Offline
            Maximilien
            wrote on last edited by
            #5

            i am not certain what to look for in the debugger. That's my problem. :sigh:

            I'd rather be phishing!

            L 1 Reply Last reply
            0
            • M Maximilien

              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!

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • M Maximilien

                i am not certain what to look for in the debugger. That's my problem. :sigh:

                I'd rather be phishing!

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                You need to add some debug code to check every time you call PostMessage.

                M 2 Replies Last reply
                0
                • L Lost User

                  You need to add some debug code to check every time you call PostMessage.

                  M Offline
                  M Offline
                  Maximilien
                  wrote on last edited by
                  #8

                  Yes, that's what I thought.

                  I'd rather be phishing!

                  1 Reply Last reply
                  0
                  • L Lost User

                    You need to add some debug code to check every time you call PostMessage.

                    M Offline
                    M Offline
                    Maximilien
                    wrote on last edited by
                    #9

                    I love you. (in a completely professional way). Merry Christmas.

                    I'd rather be phishing!

                    L 1 Reply Last reply
                    0
                    • M Maximilien

                      I love you. (in a completely professional way). Merry Christmas.

                      I'd rather be phishing!

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      Ooh, that's a bit unexpected. :-O

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups