verjan-isencia opened a new issue, #3706:
URL: https://github.com/apache/logging-log4j2/issues/3706
## Description
When using **BasicAsyncLoggerContextSelector** in **log4j2 v2.24.3**, when
logging _RingBufferLogEventHandler4.notifyCallback()_ is called, and it tries
to use an instance variable _sequenceCallback_ that is not set. I am using
**disruptor v3.4.4.202406060700**, because according to the manifest file of
log4j2-core, the accepted range of versions of disruptor is from 3.4 to 4
(excluded).
But it appears to me that the _RingBufferLogEventHandler4_ implementation is
conceived for _disruptor 4_. There is a method defined to set the value of
sequenceCallback:
```
/*
* Overrides a method from Disruptor 4.x. Do not remove.
*/
public void setSequenceCallback(final Sequence sequenceCallback) {
this.sequenceCallback = sequenceCallback;
}
```
So I suspect this code is actually meant to work with _disruptor 4_. I am
working in an **OSGI environment**, so the version range in the Manifest file
is used to determine which version of disruptor to use. Adding disruptor
v4.0.xx does not work as the build tool looks for packages with a version less
then 4.
## Configuration
**Version:** 2.24.3 (in combination with disruptor v3.4.4.202406060700)
**Application Platform**: OSGI
**Operating system:** Windows 11
**JDK:** OpenJDK 17
## Logs
```
AsyncLogger error handling event seq=238,
value='org.apache.logging.log4j.core.async.RingBufferLogEvent@6c16f29d':
java.lang.NullPointerException: Cannot invoke
"com.lmax.disruptor.Sequence.set(long)" because "this.sequenceCallback" is null
java.lang.NullPointerException: Cannot invoke
"com.lmax.disruptor.Sequence.set(long)" because "this.sequenceCallback" is null
at
org.apache.logging.log4j.core.async.RingBufferLogEventHandler4.notifyCallback(RingBufferLogEventHandler4.java:67)
at
org.apache.logging.log4j.core.async.RingBufferLogEventHandler4.onEvent(RingBufferLogEventHandler4.java:61)
at
org.apache.logging.log4j.core.async.RingBufferLogEventHandler4.onEvent(RingBufferLogEventHandler4.java:31)
at
com.lmax.disruptor.BatchEventProcessor.processEvents(BatchEventProcessor.java:168)
at
com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:125)
at java.base/java.lang.Thread.run(Thread.java:833)
```
## Reproduction
I suppose it will occur whenever using BasicAsyncLoggerContextSelector in
log4j2 v2.24.3 combined with a disruptor version less then 4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]