gabr42 / OmniThreadLibrary

A simple and powerful multithreading library for Delphi
http://www.omnithreadlibrary.com
Other
461 stars 141 forks source link

PostMessage related Quota error during peak machine latencies #182

Open orthopteroid opened 2 years ago

orthopteroid commented 2 years ago

I've noticed that once I get above 50% physical memory and hard faults begin to happen, ERROR_NOT_ENOUGH_QUOTA is thrown inside https://github.com/gabr42/OmniThreadLibrary/blob/f74c63c36577faccab6b45b1cb83a39a9fc21b4c/OtlContainerObserver.pas#L331-L354

My working theory is that for the system to resolve the hard faults and allow the process message queues to drain the messaging process needs more sleep time, ie CSecondSleep needs to be longer (at least as long as a timeslice?) or CMaxTries needs to be bigger (which would just result in more busy waiting).

I've been able to address the issue for the moment by making CSecondSleep = 500. A better hack might be some form of Nagleing or a HardFault notification.

Possibly related: https://github.com/gabr42/OmniThreadLibrary/issues/63