We have a very strange behaviour in JBoss 6.1 when using MDC.
Our application is a SOAP web service and upon connection to the service we generate a unique transaction id that we set in the MDC for logging purpose.
Now this works fine when I run the server on my local machine in standalone mode. It seems to work fine on another server that's part of a two-server-cluster. The other machine does not work fine. And then we have six more servers that are in the same cluster where it doesn't work as supposed to.
What happens is that the unique transaction id set by MDC.put gets mixed up between the Threads. As soon as a new client connects to the service and gets a new transaction id, all the other active sessions gets the same transaction id. And when a sessions ends and we remove the MDC transaction id from that session, it's removed from all active sessions.
I have no clue at all how to solve this issue since I can't reproduce the problem om my local machine. And in the cluster with two machines where one works and the other doesn't, there is no difference that I can find in the JBoss config.
Does anyone have any suggestion on how to track down what the problem actually is?
Thanks
Asked
Active
Viewed 109 times
0

Pierre
- 123
- 1
- 2
- 9
-
Further investigation shows that this is related to the Jboss cluster. Starting clean with one machine in the cluster, the problem does not exist. When adding a Jboss server to the cluster the newly added server has this problem but not the first one. When shutting down the first server and then starting it up to join the cluster again, this server also gets the problem with MDC value getting replaced with new MDC value. – Pierre Aug 14 '14 at 13:20
-
Finally was able to test this in wildfly and as far as I can see this is not an issue in wildfly. So far we have only located this problem in JBoss 6.1. I have not tested it in JBoss 7. We are migrating to wildfly in a couple of months so I'll drop this issue now. – Pierre Sep 08 '14 at 14:49