[ https://issues.apache.org/jira/browse/LOG4J2-1397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322161#comment-15322161 ]
Anthony Maire commented on LOG4J2-1397: --------------------------------------- It just doesn't work because of different orderings in the preallocated array and the ringbuffer. Let's take a simple example: - 2 threads - a ringbuffer with 2 slots So we need a preallocated array with 4 buffers - Thread A get sequence #1 from the atomic counter, then get interrupted by the system scheduler before doing the copy - Thread B is still logging, it get sequence #2, #3, #4 from the counter, pushed 2 events to the async logger (so the ringbuffer is full) and is blocked trying to push the third - Async Logger processed the first event submitted by thread B - Thread B can push another event (with preallocated buffer sequence #4) - Thread B wants to log another event, it get sequence #5 for the preallocated array - Thread A is resumed by the scheduler => Data race, both thread will copy data in the same preAllocated buffer > Support ByteBufferLayout > ------------------------ > > Key: LOG4J2-1397 > URL: https://issues.apache.org/jira/browse/LOG4J2-1397 > Project: Log4j 2 > Issue Type: New Feature > Components: Layouts > Affects Versions: 2.6 > Reporter: Remko Popma > > As requested by Kirk Pepperdine on the Mechanical Sympathy [mailing > list|https://groups.google.com/d/msg/mechanical-sympathy/klefjRqlpQE/-1WF59IGAwAJ]: > Support a new Layout that takes ObjectMessages containing a ByteBuffer > payload and write them to the appender without modification. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org