-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application hangs after sending 10.000 messages when LogBroker is not running #12
Comments
This bug is 100% reproducible with the provided sample apps.
If you want you can:
|
This is not really a bug, it's a feature. ZeroMQ is designed so when messages are streamed between nodes and the target node is not available, the sender can queue messages until the node comes back online. We set the upper limit to 10K for sending and receive queues so memory is not consumed indefinitely (see SND_HWM constant in the following), ZeroMQ lets you override this behavior and set the value to 0, which means unlimited see, GrijjyLogBroker was never intended to operate as a forever running remote logger, but you could certainly create a custom version of the concept using the ExampleWorker, ExampleBroker and ExampleClient projects that we provide in https://github.com/grijjy/DelphiZeroMQ that more precisely matches your needs. |
Thanks for your reply. If I knew that there's no broker listening, I wouldn't send any log messages. Is there some option to tell ZMQ to discard messages that it can't send? |
ZeroMQ has the ability to queue to disk. This article covers the subject, |
Queuing to disk doesn't solve the problem, it only delays it. IIUC, there's not option not to send a message if delivery is not possible, because ZMQ wants to deliver messages as reliably as possible and rather blocks the sender than telling it "sorry, I can't handle that now, try again later" and allowing it to continue. |
I am not an expert in ZeroMQ but they have a concept of non-blocking, ZMQ_NOBLOCK. Like I mentioned before, the Grijjy logger isn't designed to work in the way you want, nor does it expose every possible pattern. You can build these types of solutions with various patterns using our ZeroMQ header translations for Delphi. |
Thanks, I'll see what I get done. For the time being I disabled logging by default. It was nice to be able to fire up the log broker and -viewer at any time while the application is running and see the log messages coming in. |
BTW: I'd suggest to leave this issue open and tag it as "question", because other people might run into the same issue too. |
I'm trying to track down a problem when our application hangs when using GrijjyLog and the log broker is not running. After about 10.000 log messages (10-15 minutes), the application suddenly becomes unresponsive (Windows 10, Delphi 10.3.3 or 10.4.1).
When I start the log broker, the application becomes responsive immediately. It is, as if the suddenly available connection to the log broker is un(b)locking something.
When the broker runs all the time, the application runs for hours without problems.
When I log to a memo instead of using grijjylog.send, the application also runs for hours.
I put a breakpoint on
FMessageQueueLock.Leave
inwith
FMessageQueue.count > 10
as condition, but it only triggered a few times during startup of the application and never later. So it's probably not FMessageQueue running full.Basically the question is "What happens if nobody listens for a long time"?
Any help is greatly appreciated.
The text was updated successfully, but these errors were encountered: