[jira] [Commented] (BATIK-802) Race condition in CleanerThread.java getReferenceQueue() method

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

[jira] [Commented] (BATIK-802) Race condition in CleanerThread.java getReferenceQueue() method

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/BATIK-802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118015#comment-16118015 ]

Zsolt Kúti commented on BATIK-802:

Any update on this? I have run into the same excessive disk-space consumption issue as Volker Gersabeck. The log contains NPEs infinitely:

 at oracle.jdbc.driver.OracleTimeoutPollingThread.run(OracleTimeoutPollingThread.java:158)
        at org.apache.batik.util.CleanerThread.run(Unknown Source)
        at org.apache.batik.util.CleanerThread.run(Unknown Source)

> Race condition in CleanerThread.java getReferenceQueue() method
> ---------------------------------------------------------------
>                 Key: BATIK-802
>                 URL: https://issues.apache.org/jira/browse/BATIK-802
>             Project: Batik
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.8
>         Environment: Operating System: All
> Platform: All
>            Reporter: Archie Cobbs
>            Assignee: Batik Developer's Mailing list
> In org.apache.batik.util.CleanerThread we see:
>     public static ReferenceQueue getReferenceQueue() {
>         if ( queue == null ) {
>             synchronized (CleanerThread.class) {
>                 queue = new ReferenceQueue();
>                 thread = new CleanerThread();
>             }
>         }
>         return queue;
>     }
> This method is not thread safe due to a race condition. The test for "if (queue
> == null)" needs to be inside the synchronized block, not outside of it. As
> written, it's possible for the initialization code to be executed more than once.
> Fix: make the entire method synchronized, or add an additional test for "if
> (queue == null)" within the synchronized block (but see
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html for why
> the variable needs to remain volatile).

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]