ringbuffer of dlt-daemon only record the old log messsages #628
-
In my opinion, the ringbuffer of dlt-daemon will record the latest dlt log if no dlt-client connect. when the buffer is full, the new coming log will squeeze out the oldest one, this's what ringbuffer means. But i found ringbuffer just drop the new coming dlt log when buffer is full. |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 1 reply
-
Logic is in dlt_daemon_client.c:
|
Beta Was this translation helpful? Give feedback.
-
Hello @cumtsmart , I would like to briefly go through some explanation about DLT daemon ring buffer and code logic in dlt-daemon-client-send:
I agree that the log message here is not clear, maybe "Discard old messages" would be better. In dlt.conf set:
Wait for a couple of minutes and receive logs, dlt is writing new logs over old logs in its ring buffer:
Regards |
Beta Was this translation helpful? Give feedback.
-
@minminlittleshrimp |
Beta Was this translation helpful? Give feedback.
-
Hello @cumtsmart We need to differentiate between dlt ring buffer and libdlt buffer.
This in fact a WARNING message, not an INFO like dlt-daemon.
The discarded messages here are New messages coming when libdlt buffer is full. Thank you |
Beta Was this translation helpful? Give feedback.
-
I mean the ringbuffer on dlt-daemon size, not libdlt buffer. And my dlt-daemon is also started up. My attention is focused on dlt_daemon_client.c::dlt_daemon_client_send. In this function, will invoke
dlt_buffer_push3 method store dlt message in dlt-daemon's proccess ringbuffer. when a dlt-client connected, dlt message in dlt-daemon's proccess ringbuffer will sync to dlt-client. Is my understanding correct? |
Beta Was this translation helpful? Give feedback.
-
Hello @cumtsmart
I could say whenever this control response log appears to indicate the overflow: message_buffer_overflow, no new logs are buffered. Let me take a deeper understanding of this behavior. Regards |
Beta Was this translation helpful? Give feedback.
-
Hello @cumtsmart Case: No dlt client available dlt-daemon/src/shared/dlt_common.c Line 2627 in 4ed1b97 dlt-daemon/src/shared/dlt_common.c Line 2634 in 4ed1b97 ,in which it means the lost of recent logs. No overwriting process there but only a checking for full buffer during while loop of writing: dlt-daemon/src/shared/dlt_common.c Line 2607 in 4ed1b97 Hence, the mechanism of dlt ring buffers:
In a nutshell, we need to correct the document instead 😀 Hello @michael-methner , please kindly check my points. |
Beta Was this translation helpful? Give feedback.
-
In fact, we do not need to correct the doc: ,,If the named pipe/socket of the DLT daemon is full, an overflow flag is set and the message stored in a ring buffer. The next time, a message could be sent to the DLT daemon, an overflow message is sent first, then the contents of the ring buffer. If sending of this message was possible, the overflow flag is reset.'' No overwriting behavior mention, only store old messages and turn on the full flag. |
Beta Was this translation helpful? Give feedback.
-
@minminlittleshrimp |
Beta Was this translation helpful? Give feedback.
-
not a bug |
Beta Was this translation helpful? Give feedback.
Hello @cumtsmart
Case: No dlt client available
I observed in the source code and by doing some tests with continuously increasing the buffer.
What I have found is that this ring buffer is designed to use as producer/consumer mode (write faster than read, and in fact in this case read = 0 till buffer full):
dlt-daemon/src/shared/dlt_common.c
Line 2627 in 4ed1b97
dlt-daemon/src/shared/dlt_common.c
Line 2634 in 4ed1b97
,in which it means the lost of recent logs. No overwriting process there but only a checking for full buffer during while loop of writing:
dlt-daemon/src/shared/dlt_common.c
Line 2607 in 4ed1b97