Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-20734

Logging thread-local diagnostic context not cleared on Quartz threads

      Logging that comes from job threads includes the NDC information from the setup wizard, or whatever other action was the first one executed in Confluence:

      2010-09-03 10:38:02,888 ERROR [pool-9-thread-2] [directory.ldap.mapper.GroupContextMapper] mapFromContext Failed to map attribute <memberDNs> from context with DN <cn=o-group-6643,ou=kid-5,ou=child-0,ou=Bulk,ou=Test,dc=dc-one,dc=crowd,dc=sydney,dc=atlassian,dc=com>
       -- referer: http://localhost:8080/setup/setupstandarddb-start.action?database=postgresql | url: /setup/setupstandarddb.action | userName: anonymous | action: setupstandarddb
      

      In this case, the referer and url information are incorrect. The NDC information should not be set on the Quartz worker threads. This seems to be a bug where it is being transferred from the thread which starts Quartz.

      First spotted on the Embedded Crowd branch, but will most probably apply to all versions of Confluence since the NDC was introduced.

            [CONFSERVER-20734] Logging thread-local diagnostic context not cleared on Quartz threads

            Matt Ryall added a comment -

            Fixed in 3.5.

            Matt Ryall added a comment - Fixed in 3.5.

            Matt Ryall added a comment -

            This only really happens when you first set up Confluence, until you restart it. So it's more of an improvement for our tests – which always run this way – than for our customers.

            Matt Ryall added a comment - This only really happens when you first set up Confluence, until you restart it. So it's more of an improvement for our tests – which always run this way – than for our customers.

            Matt Ryall added a comment -

            This is kind of tricky. You can't clear the MDC of a thread when you're not executing on that thread. And the SimpleThreadPool from Quartz uses a package-protected inner class for its WorkerThreads, so I can't simply override their behaviour.

            The only option I can see is to change AbstractJob to clear the thread, but that isn't used by the Embedded Crowd threads and several other things in Confluence.

            Matt Ryall added a comment - This is kind of tricky. You can't clear the MDC of a thread when you're not executing on that thread. And the SimpleThreadPool from Quartz uses a package-protected inner class for its WorkerThreads, so I can't simply override their behaviour. The only option I can see is to change AbstractJob to clear the thread, but that isn't used by the Embedded Crowd threads and several other things in Confluence.

              matt@atlassian.com Matt Ryall
              matt@atlassian.com Matt Ryall
              Affected customers:
              0 This affects my team
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: