[slf4j-dev] [Bug 224] New: BasicMDCAdapter.getCopyOfContextMap can lead to ConcurrentModificationException

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Wed Jun 22 01:42:59 CEST 2011


http://bugzilla.slf4j.org/show_bug.cgi?id=224

           Summary: BasicMDCAdapter.getCopyOfContextMap can lead to
                    ConcurrentModificationException
           Product: SLF4J
           Version: 1.6.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: Core API
        AssignedTo: slf4j-dev at qos.ch
        ReportedBy: alex.boisvert at gmail.com


As illustrated by this stacktrace,

java.util.ConcurrentModificationException
       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
       at java.util.HashMap$EntryIterator.next(HashMap.java:834)
       at java.util.HashMap$EntryIterator.next(HashMap.java:832)
       at java.util.HashMap.putAllForCreate(HashMap.java:435)
       at java.util.HashMap.<init>(HashMap.java:225)
       at
org.slf4j.helpers.BasicMDCAdapter.getCopyOfContextMap(BasicMDCAdapter.java:130)
       at org.slf4j.MDC.getCopyOfContextMap(MDC.java:176)
       at com.bizo.logging.SmtpHandler.publish(SmtpHandler.java:65)
       at java.util.logging.Logger.log(Logger.java:458)
       at java.util.logging.Logger.doLog(Logger.java:480)
       at java.util.logging.Logger.log(Logger.java:503)
       at java.util.logging.Logger.info(Logger.java:1022)

it appears that if BasicMDCAdapter.getCopyOfContextMap() is called while the
parent thread is mutating the context, a ConcurrentModificationException can be
thrown.

-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list