-
Bug
-
Resolution: Done
-
Major
-
None
-
None
In case there's a MDC set on the current thread that is initiating a batch job, on creation of a new Batch Thread this MDC is copied to the the new thread. This context is not being cleared at any stage.
See the attached example project [^jberet-mdc-reproducer.zip].
This is the output of the example project when limiting the batch thread-pool to 4 and calling the REST service 6 times:
15:50:02,811 INFO [org.jboss.gss.batch.Endpoint] (default task-1) Endpoint.start(); Thread: default task-1; MDC: {qwq=jberet-mdc-reproducer} 15:50:02,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:02,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:02,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:02,850 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) writeItems([A, B, C]); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:02,850 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:03,846 INFO [org.jboss.gss.batch.Endpoint] (default task-1) Endpoint.start(); Thread: default task-1; MDC: {sbo=jberet-mdc-reproducer} 15:50:03,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:03,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:03,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:03,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) writeItems([A, B, C]); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:03,849 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:04,501 INFO [org.jboss.gss.batch.Endpoint] (default task-1) Endpoint.start(); Thread: default task-1; MDC: {ynq=jberet-mdc-reproducer} 15:50:04,504 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 3) readItem(); Thread: Batch Thread - 3; MDC: {ynq=jberet-mdc-reproducer} 15:50:04,504 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 3) readItem(); Thread: Batch Thread - 3; MDC: {ynq=jberet-mdc-reproducer} 15:50:04,504 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 3) readItem(); Thread: Batch Thread - 3; MDC: {ynq=jberet-mdc-reproducer} 15:50:04,504 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 3) writeItems([A, B, C]); Thread: Batch Thread - 3; MDC: {ynq=jberet-mdc-reproducer} 15:50:04,504 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 3) readItem(); Thread: Batch Thread - 3; MDC: {ynq=jberet-mdc-reproducer} 15:50:05,150 INFO [org.jboss.gss.batch.Endpoint] (default task-1) Endpoint.start(); Thread: default task-1; MDC: {zot=jberet-mdc-reproducer} 15:50:05,154 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 4) readItem(); Thread: Batch Thread - 4; MDC: {zot=jberet-mdc-reproducer} 15:50:05,154 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 4) readItem(); Thread: Batch Thread - 4; MDC: {zot=jberet-mdc-reproducer} 15:50:05,154 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 4) readItem(); Thread: Batch Thread - 4; MDC: {zot=jberet-mdc-reproducer} 15:50:05,154 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 4) writeItems([A, B, C]); Thread: Batch Thread - 4; MDC: {zot=jberet-mdc-reproducer} 15:50:05,154 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 4) readItem(); Thread: Batch Thread - 4; MDC: {zot=jberet-mdc-reproducer} 15:50:05,820 INFO [org.jboss.gss.batch.Endpoint] (default task-1) Endpoint.start(); Thread: default task-1; MDC: {zhb=jberet-mdc-reproducer} 15:50:05,822 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:05,822 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:05,822 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:05,822 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) writeItems([A, B, C]); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:05,822 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 1) readItem(); Thread: Batch Thread - 1; MDC: {qwq=jberet-mdc-reproducer} 15:50:06,569 INFO [org.jboss.gss.batch.Endpoint] (default task-1) Endpoint.start(); Thread: default task-1; MDC: {ajc=jberet-mdc-reproducer} 15:50:06,571 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:06,571 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:06,571 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:06,571 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) writeItems([A, B, C]); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer} 15:50:06,572 INFO [org.jboss.gss.batch.DummyReader] (Batch Thread - 2) readItem(); Thread: Batch Thread - 2; MDC: {sbo=jberet-mdc-reproducer}
- is cloned by
-
JBEAP-24481 [GSS](7.4.z) WFLY-17552 - MDC from 'default task' Thread copied to 'Batch Thread' on creation but not cleared
- Closed