Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-25307 ThreadLocal pooling leads to NullPointerException #2685

Merged
merged 5 commits into from Nov 25, 2020

Conversation

meszibalu
Copy link
Contributor

  • PoolMap does not discard any elements anymore. If an element is put,
    it always stores it. The reason: it stores expensive resources (rpc
    connections) which would lead to resource leak if we simple discard it.
    RpcClients can reference netty ByteBufs which are reference counted.
    Resource cleanup is done by AbstractRpcClient.cleanupIdleConnections().
  • Removed concurrency from PoolMap. It is called only from
    AbstractRpcClient in synchronized blocks, so it doesn't have to be
    thread-safe.
  • Max size is a hint for RoundRobinPool. Until maxSize is not reached,
    it will force users to create new resources. So it works the same as
    before, but it does not prevent putting more elements then maxSize.
  • ThreadLocalPool doesn't uses ThreadLocal class anymore. It stores
    resources on thread basis, but it doesn't remove values when a thread
    exits. Again, proper cleanup is done by cleanupIdleConnections().

* PoolMap does not discard any elements anymore. If an element is put,
it always stores it. The reason: it stores expensive resources (rpc
connections) which would lead to resource leak if we simple discard it.
RpcClients can reference netty ByteBufs which are reference counted.
Resource cleanup is done by AbstractRpcClient.cleanupIdleConnections().
* Removed concurrency from PoolMap. It is called only from
AbstractRpcClient in synchronized blocks, so it doesn't have to be
thread-safe.
* Max size is a hint for RoundRobinPool. Until maxSize is not reached,
it will force users to create new resources. So it works the same as
before, but it does not prevent putting more elements then maxSize.
* ThreadLocalPool doesn't uses ThreadLocal class anymore. It stores
resources on thread basis, but it doesn't remove values when a thread
exits. Again, proper cleanup is done by cleanupIdleConnections().
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

Copy link
Contributor

@busbey busbey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the connections member variable in AbstractRpcConnection private and include a comment above it that all access must be synchronized. (at least on glance it doesn’t look like anything outside the class needs the current protected access modifier.)

I was trying to figure out why the AbstractRpcConnection#close method isn’t broken

Collection<T> connToClose;
    synchronized (connections) {
      if (!running) {
        return;
      }
      running = false;
      connToClose = connections.values();
      connections.clear();
    }
    cleanupIdleConnectionTask.cancel(true);
    for (T conn : connToClose) {
      conn.shutdown();
    }
    closeInternal();
    for (T conn : connToClose) {
      conn.cleanupConnection();
    }

the contact for Map says that the returned collection from Map.values should reflect changes in the map and vice versa. So after we store a reference to the connToClose collection and then call connections.clear that collection should be empty and the following attempts to shutdown and cleanup will be no-ops.

looking at the implementation of PoolMap#values we make a copy of the values and any changes to the underlying map are definitely not reflected in the collection. This also explains why we’re not running into a problem with cleanupIdleConnections and cancelConnections calling remove on the PoolMap while iterating over the collection returned by PoolMap#values. (related: the fact that we aren’t using it as a general Map explains why PoolMap#remove(key) always returning null isn’t a problem, or why PoolMap.remove(key, value) and PoolMap.entrySet behave like a multimap)

Does PoolMap actually need to implement java.util.Map? PoolMap does not look general purpose and this deviation from the interface contract makes it harder to look for correctness problems. I’d like to see us define the expected behavior for the methods we actually use.

HBASE-25307 ThreadLocal pooling leads to NullPointerException

* PoolMap does not discard any elements anymore. If an element is put,
it always stores it. The reason: it stores expensive resources (rpc
connections) which would lead to resource leak if we simple discard it.
RpcClients can reference netty ByteBufs which are reference counted.
Resource cleanup is done by AbstractRpcClient.cleanupIdleConnections().
* PoolMap does not implement Map interface anymore, so ensuring
thread-safety become easier. Put method is replaced with getOrCreate().
* ThreadLocalPool doesn't uses ThreadLocal class anymore. It stores
resources on thread basis, but it doesn't remove values when a thread
exits. Again, proper cleanup is done by cleanupIdleConnections().
@meszibalu
Copy link
Contributor Author

Please make the connections member variable in AbstractRpcConnection private and include a comment above it that all access must be synchronized. (at least on glance it doesn’t look like anything outside the class needs the current protected access modifier.)

It is thread-safe again.

Does PoolMap actually need to implement java.util.Map? PoolMap does not look general purpose and this deviation from the interface contract makes it harder to look for correctness problems. I’d like to see us define the expected behavior for the methods we actually use.

I interpreted this comment as we can do a bigger refactor. PoolMap does not implement Map anymore. With the reduced functionality it was easier to properly ensure thread safeness.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 3s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 45s master passed
+1 💚 compile 0m 29s master passed
+1 💚 shadedjars 7m 23s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 27s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 30s the patch passed
+1 💚 compile 0m 29s the patch passed
+1 💚 javac 0m 29s the patch passed
+1 💚 shadedjars 7m 19s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s the patch passed
_ Other Tests _
+1 💚 unit 1m 22s hbase-client in the patch passed.
29m 22s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux 75af26045601 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / eca904e
Default Java AdoptOpenJDK-11.0.6+10
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/testReport/
Max. process+thread count 213 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 21s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 14s master passed
+1 💚 compile 0m 27s master passed
+1 💚 shadedjars 7m 26s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 55s the patch passed
+1 💚 compile 0m 34s the patch passed
+1 💚 javac 0m 34s the patch passed
+1 💚 shadedjars 8m 23s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 30s the patch passed
_ Other Tests _
+1 💚 unit 1m 23s hbase-client in the patch passed.
30m 50s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux 9ad774333f3e 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / eca904e
Default Java AdoptOpenJDK-1.8.0_232-b09
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/testReport/
Max. process+thread count 221 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 17s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 8s master passed
+1 💚 checkstyle 0m 29s master passed
+1 💚 spotbugs 1m 1s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 50s the patch passed
-0 ⚠️ checkstyle 0m 27s hbase-client: The patch generated 33 new + 5 unchanged - 2 fixed = 38 total (was 7)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 18m 49s Patch does not cause any errors with Hadoop 3.1.2 3.2.1 3.3.0.
+1 💚 spotbugs 1m 8s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 12s The patch does not generate ASF License warnings.
39m 9s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #2685
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux b81f7fe409f2 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / eca904e
checkstyle https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/artifact/yetus-general-check/output/diff-checkstyle-hbase-client.txt
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/2/console
versions git=2.17.1 maven=3.6.3 spotbugs=3.1.12
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@busbey
Copy link
Contributor

busbey commented Nov 20, 2020

in addition to the above, looks generally like we could prune some methods off of PoolMap?

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 37s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 23s master passed
+1 💚 compile 0m 26s master passed
+1 💚 shadedjars 7m 21s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 23s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 2s the patch passed
+1 💚 compile 0m 26s the patch passed
+1 💚 javac 0m 26s the patch passed
+1 💚 shadedjars 7m 16s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 22s the patch passed
_ Other Tests _
+1 💚 unit 1m 11s hbase-client in the patch passed.
28m 37s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux d89f964beebc 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / c9156e7
Default Java AdoptOpenJDK-1.8.0_232-b09
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/testReport/
Max. process+thread count 227 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 39s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 53s master passed
+1 💚 compile 0m 34s master passed
+1 💚 shadedjars 7m 35s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 30s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 50s the patch passed
+1 💚 compile 0m 31s the patch passed
+1 💚 javac 0m 31s the patch passed
+1 💚 shadedjars 7m 40s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s the patch passed
_ Other Tests _
+1 💚 unit 1m 18s hbase-client in the patch passed.
31m 7s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux dd6d5cc1e461 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / c9156e7
Default Java AdoptOpenJDK-11.0.6+10
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/testReport/
Max. process+thread count 201 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 25s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 3s master passed
+1 💚 checkstyle 0m 30s master passed
+1 💚 spotbugs 1m 0s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 49s the patch passed
-0 ⚠️ checkstyle 0m 28s hbase-client: The patch generated 34 new + 7 unchanged - 2 fixed = 41 total (was 9)
+1 💚 whitespace 0m 1s The patch has no whitespace issues.
+1 💚 hadoopcheck 18m 58s Patch does not cause any errors with Hadoop 3.1.2 3.2.1 3.3.0.
+1 💚 spotbugs 1m 9s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
39m 23s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #2685
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux 40c46c994587 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / c9156e7
checkstyle https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/artifact/yetus-general-check/output/diff-checkstyle-hbase-client.txt
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/3/console
versions git=2.17.1 maven=3.6.3 spotbugs=3.1.12
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@busbey busbey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test for TestThreadLocalPoolMap that confirms if we make multiple requests for the same key in a single thread that we'll get back a single answer and not new ones?

If the test calls poolMap.getOrCreate in a loop from the test method directly that should do it, I think?

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 30s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 20s master passed
+1 💚 compile 0m 30s master passed
+1 💚 shadedjars 6m 52s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 28s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 7s the patch passed
+1 💚 compile 0m 30s the patch passed
+1 💚 javac 0m 30s the patch passed
+1 💚 shadedjars 6m 46s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s the patch passed
_ Other Tests _
+1 💚 unit 1m 11s hbase-client in the patch passed.
26m 50s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux 4ccf4f4af1ab 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1c09f24
Default Java AdoptOpenJDK-11.0.6+10
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/testReport/
Max. process+thread count 285 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 2m 33s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 5m 25s master passed
+1 💚 compile 0m 32s master passed
+1 💚 shadedjars 8m 36s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 32s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 56s the patch passed
+1 💚 compile 0m 35s the patch passed
+1 💚 javac 0m 35s the patch passed
+1 💚 shadedjars 8m 39s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 28s the patch passed
_ Other Tests _
+1 💚 unit 1m 29s hbase-client in the patch passed.
35m 4s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux f8b029b499df 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1c09f24
Default Java AdoptOpenJDK-1.8.0_232-b09
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/testReport/
Max. process+thread count 221 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 8s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 9s master passed
+1 💚 checkstyle 0m 30s master passed
+1 💚 spotbugs 1m 3s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 49s the patch passed
-0 ⚠️ checkstyle 0m 30s hbase-client: The patch generated 35 new + 7 unchanged - 2 fixed = 42 total (was 9)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 18m 56s Patch does not cause any errors with Hadoop 3.1.2 3.2.1 3.3.0.
+1 💚 spotbugs 1m 9s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 12s The patch does not generate ASF License warnings.
39m 10s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #2685
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux aeb42bc29148 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1c09f24
checkstyle https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/artifact/yetus-general-check/output/diff-checkstyle-hbase-client.txt
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/4/console
versions git=2.17.1 maven=3.6.3 spotbugs=3.1.12
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@busbey busbey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great. one nit below, I think you're fine to delete the comment line and merge.

assertEquals(POOL_SIZE, poolMap.values().size());

// pool is filled, get() should return elements round robin order
// starting from 1, because the first get was called by runThread()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this second line is wrong. the first value is now 0 and not 1, and runThread doesn't exist.

// when the pool becomes full, we expect the value we get back to be
// what we put earlier, in round-robin order
runThread(randomKey, randomValue, randomValues.get((i - POOL_SIZE + 1) % POOL_SIZE));
public void testMultiThreadedRoundRobin() throws ExecutionException, InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a great test.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 32s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 14s master passed
+1 💚 compile 0m 30s master passed
+1 💚 shadedjars 6m 40s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 28s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 4m 2s the patch passed
+1 💚 compile 0m 27s the patch passed
+1 💚 javac 0m 27s the patch passed
+1 💚 shadedjars 6m 40s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s the patch passed
_ Other Tests _
+1 💚 unit 1m 10s hbase-client in the patch passed.
26m 25s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux c1e51ed2a414 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / fc33137
Default Java AdoptOpenJDK-11.0.6+10
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/testReport/
Max. process+thread count 287 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 2m 46s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 4m 27s master passed
+1 💚 compile 0m 26s master passed
+1 💚 shadedjars 7m 10s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 21s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 55s the patch passed
+1 💚 compile 0m 25s the patch passed
+1 💚 javac 0m 25s the patch passed
+1 💚 shadedjars 7m 14s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 21s the patch passed
_ Other Tests _
+1 💚 unit 1m 7s hbase-client in the patch passed.
29m 26s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #2685
Optional Tests javac javadoc unit shadedjars compile
uname Linux 6c3caed08599 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / fc33137
Default Java AdoptOpenJDK-1.8.0_232-b09
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/testReport/
Max. process+thread count 220 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 20s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 7s master passed
+1 💚 checkstyle 0m 29s master passed
+1 💚 spotbugs 1m 1s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 49s the patch passed
-0 ⚠️ checkstyle 0m 28s hbase-client: The patch generated 35 new + 7 unchanged - 2 fixed = 42 total (was 9)
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 18m 51s Patch does not cause any errors with Hadoop 3.1.2 3.2.1 3.3.0.
+1 💚 spotbugs 1m 10s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 11s The patch does not generate ASF License warnings.
39m 22s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #2685
Optional Tests dupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
uname Linux 121f3181dbe5 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / fc33137
checkstyle https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/artifact/yetus-general-check/output/diff-checkstyle-hbase-client.txt
Max. process+thread count 84 (vs. ulimit of 30000)
modules C: hbase-client U: hbase-client
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-2685/5/console
versions git=2.17.1 maven=3.6.3 spotbugs=3.1.12
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@meszibalu meszibalu merged commit 094aadc into apache:master Nov 25, 2020
@meszibalu meszibalu deleted the my/hbase-25307 branch November 25, 2020 10:10
asfgit pushed a commit that referenced this pull request Nov 25, 2020
meszibalu added a commit to meszibalu/hbase that referenced this pull request Nov 25, 2020
…#2685)

* PoolMap does not discard any elements anymore. If an element is put,
it always stores it. The reason: it stores expensive resources (rpc
connections) which would lead to resource leak if we simple discard it.
RpcClients can reference netty ByteBufs which are reference counted.
Resource cleanup is done by AbstractRpcClient.cleanupIdleConnections().
* PoolMap does not implement Map interface anymore, so ensuring
thread-safety has become easier. Put method is replaced with getOrCreate().
* ThreadLocalPool doesn't use ThreadLocal class anymore. It stores
resources on thread basis, but it doesn't remove values when a thread
exits. Again, proper cleanup is done by cleanupIdleConnections().

Signed-off-by: Sean Busbey <busbey@apache.org>
Signed-off-by: Wellington Chevreuil <wellington.chevreuil@gmail.com>
meszibalu added a commit to meszibalu/hbase that referenced this pull request Nov 25, 2020
…#2685)

* PoolMap does not discard any elements anymore. If an element is put,
it always stores it. The reason: it stores expensive resources (rpc
connections) which would lead to resource leak if we simple discard it.
RpcClients can reference netty ByteBufs which are reference counted.
Resource cleanup is done by AbstractRpcClient.cleanupIdleConnections().
* PoolMap does not implement Map interface anymore, so ensuring
thread-safety has become easier. Put method is replaced with getOrCreate().
* ThreadLocalPool doesn't use ThreadLocal class anymore. It stores
resources on thread basis, but it doesn't remove values when a thread
exits. Again, proper cleanup is done by cleanupIdleConnections().

Signed-off-by: Sean Busbey <busbey@apache.org>
Signed-off-by: Wellington Chevreuil <wellington.chevreuil@gmail.com>
meszibalu added a commit to meszibalu/hbase that referenced this pull request Nov 26, 2020
…#2685)

* PoolMap does not discard any elements anymore. If an element is put,
it always stores it. The reason: it stores expensive resources (rpc
connections) which would lead to resource leak if we simple discard it.
RpcClients can reference netty ByteBufs which are reference counted.
Resource cleanup is done by AbstractRpcClient.cleanupIdleConnections().
* PoolMap does not implement Map interface anymore, so ensuring
thread-safety has become easier. Put method is replaced with getOrCreate().
* ThreadLocalPool doesn't use ThreadLocal class anymore. It stores
resources on thread basis, but it doesn't remove values when a thread
exits. Again, proper cleanup is done by cleanupIdleConnections().

Signed-off-by: Sean Busbey <busbey@apache.org>
Signed-off-by: Wellington Chevreuil <wellington.chevreuil@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants