Details
-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
1.0.13
-
None
Description
There is a race condition in AbstractSocketAppender – if the queue is "full" then this line will silently drop the event:
queue.offer(event);
To avoid dropped events, the code should be using "add" instead of "offer" to ensure that the caller blocks if the queue is full.
This is very easy to reproduce with the default queue size of zero.
The javadoc for AbstractSocketAppender seems to contract itself on this matter, it claims:
- "Using a non-zero queue length can improve performance by eliminating delays caused by transient network delays."
- "If the queue is full when the append(Object) method is called, the event is summarily and silently dropped."
If events are dropped when the queue is full, then there aren't any "delays" to worry about, only "dropped" events. If dropping events is the intended behavior, I think append() should check the return value of offer() and call addWarn() to notify the user that messages are being dropped (at least for the first such drop). Then the user will know that the queue size must be increased.
Attachments
Issue Links
- duplicates
-
LOGBACK-942 LoggerEvents are lost when sending over the SocketAppender
- Resolved