You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Liyin Tang (Created) (JIRA)" <ji...@apache.org> on 2012/01/26 23:43:42 UTC

[jira] [Created] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

[FindBugs] Synchronization on boxed primitive
---------------------------------------------

                 Key: HBASE-5290
                 URL: https://issues.apache.org/jira/browse/HBASE-5290
             Project: HBase
          Issue Type: Bug
            Reporter: Liyin Tang
            Assignee: Liyin Tang
            Priority: Minor


This bug is reported by the findBugs tool, which is a static analysis tool.

Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
The code synchronizes on a boxed primitive constant, such as an Integer.

private static Integer count = 0;
...
  synchronized(count) {
     count++;
     }
...
Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock

See CERT CON08-J. Do not synchronize on objects that may be reused for more information.

Confidence: Normal, Rank: Troubling (14)
Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197019#comment-13197019 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

Integrated to TRUNK.

Thanks for the patch, Ben.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Ben West
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Ben West (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196483#comment-13196483 ] 

Ben West commented on HBASE-5290:
---------------------------------

v4 looks good to me. +1.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Ben West
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Hadoop QA (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196399#comment-13196399 ] 

Hadoop QA commented on HBASE-5290:
----------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12512451/HBASE-5290v2.patch
  against trunk revision .

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    -1 javadoc.  The javadoc tool appears to have generated -140 warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 158 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

     -1 core tests.  The patch failed these unit tests:
                       org.apache.hadoop.hbase.mapreduce.TestHFileOutputFormat
                  org.apache.hadoop.hbase.mapred.TestTableMapReduce
                  org.apache.hadoop.hbase.mapreduce.TestImportTsv

Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/874//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/874//artifact/trunk/patchprocess/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/874//console

This message is automatically generated.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196335#comment-13196335 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

This is not recommended:
{code}
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.List;
+import java.util.*;
{code}
Imports should be specific.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197506#comment-13197506 ] 

Hudson commented on HBASE-5290:
-------------------------------

Integrated in HBase-TRUNK #2649 (See [https://builds.apache.org/job/HBase-TRUNK/2649/])
    HBASE-5290 [FindBugs] Synchronization on boxed primitive (Ben West)

tedyu : 
Files : 
* /hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/CompactSelection.java

                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Ben West
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Hadoop QA (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196372#comment-13196372 ] 

Hadoop QA commented on HBASE-5290:
----------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12512447/HBASE-5290.patch
  against trunk revision .

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    -1 javadoc.  The javadoc tool appears to have generated -140 warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 158 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

     -1 core tests.  The patch failed these unit tests:
                       org.apache.hadoop.hbase.replication.TestReplicationPeer
                  org.apache.hadoop.hbase.io.hfile.TestHFileBlock
                  org.apache.hadoop.hbase.mapreduce.TestImportTsv
                  org.apache.hadoop.hbase.mapred.TestTableMapReduce
                  org.apache.hadoop.hbase.mapreduce.TestHFileOutputFormat

Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/873//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/873//artifact/trunk/patchprocess/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/873//console

This message is automatically generated.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196405#comment-13196405 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

Patch looks good.
{code}
+  public final Object compactionCountLock = new Object();
{code}
Since the lock isn't used by test, I changed it to private and TestCompactSelection passes.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhihong Yu updated HBASE-5290:
------------------------------

    Attachment: 5290-v3.txt

Patch v3 changes compactionCountLock to private.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Ben West (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben West updated HBASE-5290:
----------------------------

    Attachment: HBASE-5290v2.patch

Two changes as per Zhihong:

1. Make imports specific
2. Make the error message say "incorrect" instead of "correct"
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhihong Yu updated HBASE-5290:
------------------------------

    Description: 
This bug is reported by the findBugs tool, which is a static analysis tool.

Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
The code synchronizes on a boxed primitive constant, such as an Integer.
{code}
private static Integer count = 0;
...
  synchronized(count) {
     count++;
     }
...
{code}
Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock

See CERT CON08-J. Do not synchronize on objects that may be reused for more information.

Confidence: Normal, Rank: Troubling (14)
Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

  was:
This bug is reported by the findBugs tool, which is a static analysis tool.

Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
The code synchronizes on a boxed primitive constant, such as an Integer.

private static Integer count = 0;
...
  synchronized(count) {
     count++;
     }
...
Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock

See CERT CON08-J. Do not synchronize on objects that may be reused for more information.

Confidence: Normal, Rank: Troubling (14)
Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

    
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Ben West (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben West updated HBASE-5290:
----------------------------

    Affects Version/s: 0.94.0
               Status: Patch Available  (was: Open)

The issue is deadlock, so it's kind of hard to write a good test, but I verified that the three tests failed before my patch and passed after.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196485#comment-13196485 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

Will integrate tomorrow if there is no further review comment.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Ben West
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Ben West (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196461#comment-13196461 ] 

Ben West commented on HBASE-5290:
---------------------------------

TestCompactSelection is a different package, so making it package private won't help, right? (Unless JUnit has some magic here?)
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhihong Yu reassigned HBASE-5290:
---------------------------------

    Assignee: Ben West  (was: Liyin Tang)
    
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Ben West
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhihong Yu updated HBASE-5290:
------------------------------

    Fix Version/s: 0.94.0
     Hadoop Flags: Reviewed
    
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Ben West
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196344#comment-13196344 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

I did get an assertion without the patch to CompactSelection.java, but I think the message in assertion should state that locking was handled incorrectly:
{code}
+    assertTrue("Locking handled correctly in getCompactSelectionRatio", elapsed < 5000);
{code}
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Ben West (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben West updated HBASE-5290:
----------------------------

    Attachment: HBASE-5290.patch
    
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Hadoop QA (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196476#comment-13196476 ] 

Hadoop QA commented on HBASE-5290:
----------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12512467/5290-v4.txt
  against trunk revision .

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no new tests are needed for this patch.
                        Also please list what manual steps were performed to verify this patch.

    -1 javadoc.  The javadoc tool appears to have generated -140 warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 157 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

     -1 core tests.  The patch failed these unit tests:
                       org.apache.hadoop.hbase.master.TestSplitLogManager
                  org.apache.hadoop.hbase.mapreduce.TestHFileOutputFormat
                  org.apache.hadoop.hbase.mapred.TestTableMapReduce
                  org.apache.hadoop.hbase.io.hfile.TestHFileBlock
                  org.apache.hadoop.hbase.mapreduce.TestImportTsv

Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/876//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/876//artifact/trunk/patchprocess/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/876//console

This message is automatically generated.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196370#comment-13196370 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

@Liyin:
Do you mind if I assign this JIRA to Ben ?
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhihong Yu updated HBASE-5290:
------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)
    
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Ben West
>            Priority: Minor
>             Fix For: 0.94.0
>
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zhihong Yu updated HBASE-5290:
------------------------------

    Attachment: 5290-v4.txt

Patch v4 should be close to the final form.
Since numOutstandingOffPeakCompactions is static, the lock object should be static as well.
Since numOutstandingOffPeakCompactions isn't referenced by any other class, I made it package private in case TestCompactSelection needs to access it in future.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Ben West (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben West updated HBASE-5290:
----------------------------

    Attachment: HBASE-5290.patch
    
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: HBASE-5290.patch, HBASE-5290.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196417#comment-13196417 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

I realized that since numOutstandingOffPeakCompactions is no longer the lock object, it should be declared as primitive type (long, e.g.)
But that makes the test irrelevant.

@Ben:
Is it Okay that I drop the new test ?

                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Zhihong Yu (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196468#comment-13196468 ] 

Zhihong Yu commented on HBASE-5290:
-----------------------------------

Good point.
When the need comes to access numOutstandingOffPeakCompactions in unit test, we can either:
1. move TestCompactSelection.java to src/test/java/org/apache/hadoop/hbase/regionserver/compactions
2. use reflection
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Ben West (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196420#comment-13196420 ] 

Ben West commented on HBASE-5290:
---------------------------------

@Zhihong: fine with me. I was thinking it would be good to change to a primitive, but it's a public field so didn't want to break the API.

Maybe change to get/set for the public piece while we're breaking stuff? Not sure what the HBase standard is.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (HBASE-5290) [FindBugs] Synchronization on boxed primitive

Posted by "Hadoop QA (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HBASE-5290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196441#comment-13196441 ] 

Hadoop QA commented on HBASE-5290:
----------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12512460/5290-v3.txt
  against trunk revision .

    +1 @author.  The patch does not contain any @author tags.

    +1 tests included.  The patch appears to include 3 new or modified tests.

    -1 javadoc.  The javadoc tool appears to have generated -140 warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 158 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

     -1 core tests.  The patch failed these unit tests:
                       org.apache.hadoop.hbase.io.hfile.TestHFileBlock
                  org.apache.hadoop.hbase.mapreduce.TestImportTsv
                  org.apache.hadoop.hbase.mapred.TestTableMapReduce
                  org.apache.hadoop.hbase.mapreduce.TestHFileOutputFormat

Test results: https://builds.apache.org/job/PreCommit-HBASE-Build/875//testReport/
Findbugs warnings: https://builds.apache.org/job/PreCommit-HBASE-Build/875//artifact/trunk/patchprocess/newPatchFindbugsWarnings.html
Console output: https://builds.apache.org/job/PreCommit-HBASE-Build/875//console

This message is automatically generated.
                
> [FindBugs] Synchronization on boxed primitive
> ---------------------------------------------
>
>                 Key: HBASE-5290
>                 URL: https://issues.apache.org/jira/browse/HBASE-5290
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 0.94.0
>            Reporter: Liyin Tang
>            Assignee: Liyin Tang
>            Priority: Minor
>         Attachments: 5290-v3.txt, 5290-v4.txt, HBASE-5290.patch, HBASE-5290.patch, HBASE-5290v2.patch
>
>
> This bug is reported by the findBugs tool, which is a static analysis tool.
> Bug: Synchronization on Integer in org.apache.hadoop.hbase.regionserver.compactions.CompactSelection.emptyFileList()
> The code synchronizes on a boxed primitive constant, such as an Integer.
> {code}
> private static Integer count = 0;
> ...
>   synchronized(count) {
>      count++;
>      }
> ...
> {code}
> Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock
> See CERT CON08-J. Do not synchronize on objects that may be reused for more information.
> Confidence: Normal, Rank: Troubling (14)
> Pattern: DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE 
> Type: DL, Category: MT_CORRECTNESS (Multithreaded correctness)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira