[geode] 02/02: GEODE-10122: fix quorm loss in test
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit e961ed9090b6c5ce7922d4a54f50ff9339f2fbfb Author: Bill Burcham AuthorDate: Wed Apr 27 11:47:59 2022 -0700 GEODE-10122: fix quorm loss in test (cherry picked from commit cedff28ffb826c627894902bff4f4c6f27a1e514) --- .../internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java | 10 ++ 1 file changed, 10 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java index 3a887d5521..a364cbbae8 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java @@ -101,6 +101,16 @@ public class P2pMessagingSslTlsKeyUpdateDistributedTest { @After public void afterEach() { +/* + * Disconnect DSs before killing JVMs. + */ +clusterStartupRule.getVM(2).invoke( +() -> ClusterStartupRule.getCache().close()); +clusterStartupRule.getVM(1).invoke( +() -> ClusterStartupRule.getCache().close()); +clusterStartupRule.getVM(0).invoke( +() -> ClusterStartupRule.getCache().close()); + clusterStartupRule.getVM(0).bounceForcibly(); clusterStartupRule.getVM(1).bounceForcibly(); clusterStartupRule.getVM(2).bounceForcibly();
[geode] branch support/1.12 updated (1319ca0d66 -> e961ed9090)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git from 1319ca0d66 GEODE-10229: GII image should fill disk region RVV's exceptions. (#7602) new b4c1cf8b3d GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615) new e961ed9090 GEODE-10122: fix quorm loss in test The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../internal/P2PMessagingConcurrencyDUnitTest.java | 2 +- ...P2pMessagingSslTlsKeyUpdateDistributedTest.java | 377 .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 1 - .../internal/net/NioSslEngineKeyUpdateTest.java| 497 + .../apache/geode/internal/net/NioSslEngine.java| 67 +-- .../org/apache/geode/internal/tcp/Connection.java | 2 +- .../geode/internal/net/NioSslEngineTest.java | 38 +- 7 files changed, 939 insertions(+), 45 deletions(-) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java create mode 100644 geode-core/src/integrationTest/java/org/apache/geode/internal/net/NioSslEngineKeyUpdateTest.java
[geode] 01/02: GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit b4c1cf8b3de150dc5e052f89608bee5da0222657 Author: Bill Burcham AuthorDate: Tue Apr 26 14:54:03 2022 -0700 GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615) * Key expiration works for TLSv1.3 and GCM-based ciphers * TLS KeyUpdate messages are processed correctly * Removed dependencies on: Mockito 4, JUnit 5, GeodeParamsRunner * Removed dependency on DistributedBlackboard rule (cherry picked from commit d2535394a82ac5faf10f004f4e3c15f756f7b177) (cherry picked from commit 07c08e95025ff955c9b361db4b97902ce722be81) --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 2 +- ...P2pMessagingSslTlsKeyUpdateDistributedTest.java | 367 +++ .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 1 - .../internal/net/NioSslEngineKeyUpdateTest.java| 497 + .../apache/geode/internal/net/NioSslEngine.java| 67 +-- .../org/apache/geode/internal/tcp/Connection.java | 2 +- .../geode/internal/net/NioSslEngineTest.java | 38 +- 7 files changed, 929 insertions(+), 45 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java index 4c8677c43f..ad975886c7 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -167,7 +167,6 @@ public class P2PMessagingConcurrencyDUnitTest { bytesTransferredAdder = new LongAdder(); final ClusterDistributionManager cdm = getCDM(); - final Random random = new Random(RANDOM_SEED); final AtomicInteger nextSenderId = new AtomicInteger(); /* @@ -194,6 +193,7 @@ public class P2PMessagingConcurrencyDUnitTest { throw new RuntimeException("doSending failed", e); } final int firstMessageId = senderId * SENDER_COUNT; +final Random random = new Random(RANDOM_SEED); for (int messageId = firstMessageId; messageId < firstMessageId + MESSAGES_PER_SENDER; messageId++) { final TestMessage msg = new TestMessage(receiverMember, random, messageId); diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java new file mode 100644 index 00..3a887d5521 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java @@ -0,0 +1,367 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.distributed.internal; + +import static org.apache.geode.distributed.ConfigurationProperties.SSL_CIPHERS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.lang.reflect.Field; +import java.security.GeneralSecurityException; +import java.security.Security; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.LongAdder; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.jetbrains.annotations.NotNull; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import org.apache.geode.cache.CacheFactory; +import org.apache.geode.cache.ssl.CertStores; +import org.apache.geode.cach
[geode] branch support/1.13 updated: GEODE-10122: fix quorm loss in test
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.13 by this push: new cedff28ffb GEODE-10122: fix quorm loss in test cedff28ffb is described below commit cedff28ffb826c627894902bff4f4c6f27a1e514 Author: Bill Burcham AuthorDate: Wed Apr 27 11:47:59 2022 -0700 GEODE-10122: fix quorm loss in test --- .../internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java | 10 ++ 1 file changed, 10 insertions(+) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java index 3a887d5521..a364cbbae8 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java @@ -101,6 +101,16 @@ public class P2pMessagingSslTlsKeyUpdateDistributedTest { @After public void afterEach() { +/* + * Disconnect DSs before killing JVMs. + */ +clusterStartupRule.getVM(2).invoke( +() -> ClusterStartupRule.getCache().close()); +clusterStartupRule.getVM(1).invoke( +() -> ClusterStartupRule.getCache().close()); +clusterStartupRule.getVM(0).invoke( +() -> ClusterStartupRule.getCache().close()); + clusterStartupRule.getVM(0).bounceForcibly(); clusterStartupRule.getVM(1).bounceForcibly(); clusterStartupRule.getVM(2).bounceForcibly();
[geode] branch support/1.13 updated: GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615) (#7625)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.13 by this push: new 6b93208307 GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615) (#7625) 6b93208307 is described below commit 6b9320830724dcab8fb1ed3ad3211c4dfc5bf5b5 Author: Bill Burcham AuthorDate: Tue Apr 26 15:40:40 2022 -0700 GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615) (#7625) * Key expiration works for TLSv1.3 and GCM-based ciphers * TLS KeyUpdate messages are processed correctly * Removed dependencies on: Mockito 4, JUnit 5, GeodeParamsRunner (cherry picked from commit d2535394a82ac5faf10f004f4e3c15f756f7b177) (cherry picked from commit 07c08e95025ff955c9b361db4b97902ce722be81) --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 2 +- ...P2pMessagingSslTlsKeyUpdateDistributedTest.java | 367 +++ .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 8 +- .../internal/net/NioSslEngineKeyUpdateTest.java| 497 + .../apache/geode/internal/net/NioSslEngine.java| 67 +-- .../org/apache/geode/internal/tcp/Connection.java | 2 +- .../geode/internal/net/NioSslEngineTest.java | 38 +- 7 files changed, 934 insertions(+), 47 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java index 0d7c2d389f..326e1c2ac4 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -167,7 +167,6 @@ public class P2PMessagingConcurrencyDUnitTest { bytesTransferredAdder = new LongAdder(); final ClusterDistributionManager cdm = getCDM(); - final Random random = new Random(RANDOM_SEED); final AtomicInteger nextSenderId = new AtomicInteger(); /* @@ -194,6 +193,7 @@ public class P2PMessagingConcurrencyDUnitTest { throw new RuntimeException("doSending failed", e); } final int firstMessageId = senderId * SENDER_COUNT; +final Random random = new Random(RANDOM_SEED); for (int messageId = firstMessageId; messageId < firstMessageId + MESSAGES_PER_SENDER; messageId++) { final TestMessage msg = new TestMessage(receiverMember, random, messageId); diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java new file mode 100644 index 00..3a887d5521 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java @@ -0,0 +1,367 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.distributed.internal; + +import static org.apache.geode.distributed.ConfigurationProperties.SSL_CIPHERS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.lang.reflect.Field; +import java.security.GeneralSecurityException; +import java.security.Security; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.LongAdder; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.jetbrains.annotations.NotNull; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experime
[geode] branch support/1.14 updated: GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.14 by this push: new 07c08e9502 GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615) 07c08e9502 is described below commit 07c08e95025ff955c9b361db4b97902ce722be81 Author: Bill Burcham AuthorDate: Tue Apr 26 14:54:03 2022 -0700 GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) (#7615) * Key expiration works for TLSv1.3 and GCM-based ciphers * TLS KeyUpdate messages are processed correctly * Removed dependencies on: Mockito 4, JUnit 5, GeodeParamsRunner (cherry picked from commit d2535394a82ac5faf10f004f4e3c15f756f7b177) --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 2 +- ...P2pMessagingSslTlsKeyUpdateDistributedTest.java | 367 +++ .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 8 +- .../internal/net/NioSslEngineKeyUpdateTest.java| 497 + .../apache/geode/internal/net/NioSslEngine.java| 67 +-- .../org/apache/geode/internal/tcp/Connection.java | 2 +- .../geode/internal/net/NioSslEngineTest.java | 38 +- 7 files changed, 934 insertions(+), 47 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java index 0d7c2d389f..326e1c2ac4 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -167,7 +167,6 @@ public class P2PMessagingConcurrencyDUnitTest { bytesTransferredAdder = new LongAdder(); final ClusterDistributionManager cdm = getCDM(); - final Random random = new Random(RANDOM_SEED); final AtomicInteger nextSenderId = new AtomicInteger(); /* @@ -194,6 +193,7 @@ public class P2PMessagingConcurrencyDUnitTest { throw new RuntimeException("doSending failed", e); } final int firstMessageId = senderId * SENDER_COUNT; +final Random random = new Random(RANDOM_SEED); for (int messageId = firstMessageId; messageId < firstMessageId + MESSAGES_PER_SENDER; messageId++) { final TestMessage msg = new TestMessage(receiverMember, random, messageId); diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java new file mode 100644 index 00..3a887d5521 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java @@ -0,0 +1,367 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.distributed.internal; + +import static org.apache.geode.distributed.ConfigurationProperties.SSL_CIPHERS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.lang.reflect.Field; +import java.security.GeneralSecurityException; +import java.security.Security; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.LongAdder; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.jetbrains.annotations.NotNull; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import org.apache.
[geode] branch develop updated: GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new d2535394a8 GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) d2535394a8 is described below commit d2535394a82ac5faf10f004f4e3c15f756f7b177 Author: Bill Burcham AuthorDate: Wed Apr 6 20:14:48 2022 -0700 GEODE-10122: P2P Messaging Handles TLS KeyUpdate Message (#7449) * Key expiration works for TLSv1.3 and GCM-based ciphers * TLS KeyUpdate messages are processed correctly --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 2 +- ...P2pMessagingSslTlsKeyUpdateDistributedTest.java | 367 +++ .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 8 +- .../internal/net/NioSslEngineKeyUpdateTest.java| 497 + .../apache/geode/internal/net/NioSslEngine.java| 69 +-- .../org/apache/geode/internal/tcp/Connection.java | 2 +- .../geode/internal/net/NioSslEngineTest.java | 40 +- 7 files changed, 939 insertions(+), 46 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java index 28abe5dd3e..e761e1bb12 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -167,7 +167,6 @@ public class P2PMessagingConcurrencyDUnitTest { bytesTransferredAdder = new LongAdder(); final ClusterDistributionManager cdm = getCDM(); - final Random random = new Random(RANDOM_SEED); final AtomicInteger nextSenderId = new AtomicInteger(); /* @@ -194,6 +193,7 @@ public class P2PMessagingConcurrencyDUnitTest { throw new RuntimeException("doSending failed", e); } final int firstMessageId = senderId * SENDER_COUNT; +final Random random = new Random(RANDOM_SEED); for (int messageId = firstMessageId; messageId < firstMessageId + MESSAGES_PER_SENDER; messageId++) { final TestMessage msg = new TestMessage(receiverMember, random, messageId); diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java new file mode 100644 index 00..e31f9cfd79 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2pMessagingSslTlsKeyUpdateDistributedTest.java @@ -0,0 +1,367 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.distributed.internal; + +import static org.apache.geode.distributed.ConfigurationProperties.SSL_CIPHERS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.lang.reflect.Field; +import java.security.GeneralSecurityException; +import java.security.Security; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.LongAdder; + +import junitparams.Parameters; +import org.jetbrains.annotations.NotNull; +import org.junit.After; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import org.apache.geode.cache.CacheFactory; +import org.apache.geode.cache.ssl.CertStores; +import org.apache.geode.cache.ssl.CertificateBuilder; +import org.apache.geode.cache.ssl.CertificateMaterial; +import org.apache.geode.distributed.internal.mem
[geode] branch develop updated (0e55693 -> d89fdf6)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 0e55693 adjust timeouts and max_in_flight for best pipeline characteristics (#7183) add d89fdf6 GEODE-9822: Quorum Calculation Requires Majority (#7126) No new revisions were added by this update. Summary of changes: ...twork_partitioning_management_works.html.md.erb | 2 +- .../gms/membership/GMSJoinLeaveJUnitTest.java | 92 ++ .../membership/gms/membership/GMSJoinLeave.java| 36 +++-- 3 files changed, 107 insertions(+), 23 deletions(-)
[geode] branch develop updated (607c30c -> a24fceb)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 607c30c GEODE-9811: Turn UnavailableSecurityManagerException into CacheClosedException (#7148) add a24fceb GEODE-9396: Translate Old Member IP to Name for Endpoint ID (#7119) No new revisions were added by this update. Summary of changes: .../DeploymentManagementUpgradeTest.java | 4 +- .../management/OperationManagementUpgradeTest.java | 16 +- .../RollingUpgradeWithGfshDUnitTest.java | 25 +- .../management/RollingUpgradeWithSslDUnitTest.java | 276 + .../org/apache/geode/management/gemfire.properties | 3 +- .../RestrictUseOfInetAddressJUnitTest.java | 2 +- .../apache/geode/internal/net/SocketCreator.java | 6 +- .../org/apache/geode/internal/tcp/Connection.java | 137 ++ .../geode/test/junit/rules/gfsh/GfshRule.java | 10 +- 9 files changed, 403 insertions(+), 76 deletions(-) create mode 100644 geode-assembly/src/upgradeTest/java/org/apache/geode/management/RollingUpgradeWithSslDUnitTest.java copy geode-core/src/main/resources/META-INF/services/org.apache.geode.internal.version.ComponentVersion => geode-assembly/src/upgradeTest/resources/org/apache/geode/management/gemfire.properties (92%)
[geode] 02/02: GEODE-9825: minus GEODE-9713
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit 7ec6f679f4fdc394eb053f98726d70b42175ef49 Author: Bill Burcham AuthorDate: Wed Nov 24 12:12:38 2021 -0800 GEODE-9825: minus GEODE-9713 --- .../geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java index 0d7c2d3..4c8677c 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -89,7 +89,7 @@ public class P2PMessagingConcurrencyDUnitTest { @ClassRule public static final DistributedExecutorServiceRule senderExecutorServiceRule = - new DistributedExecutorServiceRule(SENDER_COUNT, 3); + new DistributedExecutorServiceRule(SENDER_COUNT); private MemberVM sender; private MemberVM receiver;
[geode] 01/02: GEODE-9825: processInputBuffer resize retains data (#7131)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit e8cb3ecc6582f1494cce2d9093b1e068fd128968 Author: Bill Burcham AuthorDate: Tue Nov 23 08:29:11 2021 -0800 GEODE-9825: processInputBuffer resize retains data (#7131) (cherry picked from commit fb142e1bbd42d6af2463fd9b9b49ef3e5519cfcb) (cherry picked from commit 62bc9aee3f929103411fc2dbe66cc750e56c06c1) --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 370 + .../org/apache/geode/internal/tcp/Connection.java | 12 +- 2 files changed, 380 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java new file mode 100644 index 000..0d7c2d3 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -0,0 +1,370 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.distributed.internal; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Properties; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.jetbrains.annotations.NotNull; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import org.apache.geode.cache.CacheFactory; +import org.apache.geode.cache.ssl.CertStores; +import org.apache.geode.cache.ssl.CertificateBuilder; +import org.apache.geode.cache.ssl.CertificateMaterial; +import org.apache.geode.distributed.internal.membership.InternalDistributedMember; +import org.apache.geode.internal.cache.InternalCache; +import org.apache.geode.internal.serialization.DeserializationContext; +import org.apache.geode.internal.serialization.SerializationContext; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.MembershipTest; +import org.apache.geode.test.version.VersionManager; + +/** + * Tests one-way P2P messaging between two peers. + * Many concurrent tasks compete on the sending side. + * The main purpose of the test is to exercise + * ByteBufferSharing and friends. + * + * Tests combinations of: conserve-sockets true/false, + * TLS on/off, and socket-buffer-size for sender + * and receiver both set to the default (and equal) + * and set to the sender's buffer twice as big as the + * receiver's buffer. + * + */ +@Category({MembershipTest.class}) +@RunWith(JUnitParamsRunner.class) +public class P2PMessagingConcurrencyDUnitTest { + + // how many messages will each sender generate? + private static final int MESSAGES_PER_SENDER = 1_000; + + // number of concurrent (sending) tasks to run + private static final int SENDER_COUNT = 10; + + // (exclusive) upper bound of random message size, in bytes + private static final int LARGEST_MESSAGE_BOUND = 32 * 1024 + 2; // 32KiB + 2 + + // random seed + private static final int RANDOM_SEED = 1234; + + private static Properties securityProperties; + + @Rule + public final ClusterStartupRule clusterStartupRule = new ClusterStartupRule(3); + + @ClassRule + public static final DistributedExecutorServiceRule senderExecutorServiceRule = + new DistributedExecutorServiceRule(SENDER_COUNT, 3); + + private MemberVM sender; + private MemberVM receiver; + + /* + * byte
[geode] branch support/1.12 updated (d979357 -> 7ec6f67)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git. from d979357 GEODE-9838: Log key info for deserialization issue while index update (#7136) new e8cb3ec GEODE-9825: processInputBuffer resize retains data (#7131) new 7ec6f67 GEODE-9825: minus GEODE-9713 The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../internal/P2PMessagingConcurrencyDUnitTest.java | 370 + .../org/apache/geode/internal/tcp/Connection.java | 12 +- 2 files changed, 380 insertions(+), 2 deletions(-) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java
[geode] branch support/1.13 updated (a6c458d -> c0d138f)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from a6c458d GEODE-9838: Log key info for deserialization issue while index update (#7136) new 671d807 GEODE-9713: Support thread count in ExecutorService rules (#7002) new c0d138f GEODE-9825: processInputBuffer resize retains data (#7131) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../internal/P2PMessagingConcurrencyDUnitTest.java | 370 + .../org/apache/geode/internal/tcp/Connection.java | 12 +- ...dExecutorServiceRuleLimitedThreadCountTest.java | 103 ++ ...utedExecutorServiceRuleLimitedVmCountTest.java} | 14 +- ...xecutorServiceRuleUnlimitedThreadCountTest.java | 75 + .../rules/DistributedExecutorServiceRule.java | 165 - .../sanctioned-geode-dunit-serializables.txt | 2 +- .../test/junit/rules/ExecutorServiceRule.java | 69 +++- .../sanctioned-geode-junit-serializables.txt | 2 +- 9 files changed, 785 insertions(+), 27 deletions(-) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java copy geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/{DistributedRuleDistributedTest.java => DistributedExecutorServiceRuleLimitedVmCountTest.java} (73%) create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleUnlimitedThreadCountTest.java
[geode] 02/02: GEODE-9825: processInputBuffer resize retains data (#7131)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit c0d138f05738782da84a3e9fbdda74fc779e3ab3 Author: Bill Burcham AuthorDate: Tue Nov 23 08:29:11 2021 -0800 GEODE-9825: processInputBuffer resize retains data (#7131) (cherry picked from commit fb142e1bbd42d6af2463fd9b9b49ef3e5519cfcb) (cherry picked from commit 62bc9aee3f929103411fc2dbe66cc750e56c06c1) --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 370 + .../org/apache/geode/internal/tcp/Connection.java | 12 +- 2 files changed, 380 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java new file mode 100644 index 000..0d7c2d3 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -0,0 +1,370 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.distributed.internal; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Properties; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.jetbrains.annotations.NotNull; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import org.apache.geode.cache.CacheFactory; +import org.apache.geode.cache.ssl.CertStores; +import org.apache.geode.cache.ssl.CertificateBuilder; +import org.apache.geode.cache.ssl.CertificateMaterial; +import org.apache.geode.distributed.internal.membership.InternalDistributedMember; +import org.apache.geode.internal.cache.InternalCache; +import org.apache.geode.internal.serialization.DeserializationContext; +import org.apache.geode.internal.serialization.SerializationContext; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.MembershipTest; +import org.apache.geode.test.version.VersionManager; + +/** + * Tests one-way P2P messaging between two peers. + * Many concurrent tasks compete on the sending side. + * The main purpose of the test is to exercise + * ByteBufferSharing and friends. + * + * Tests combinations of: conserve-sockets true/false, + * TLS on/off, and socket-buffer-size for sender + * and receiver both set to the default (and equal) + * and set to the sender's buffer twice as big as the + * receiver's buffer. + * + */ +@Category({MembershipTest.class}) +@RunWith(JUnitParamsRunner.class) +public class P2PMessagingConcurrencyDUnitTest { + + // how many messages will each sender generate? + private static final int MESSAGES_PER_SENDER = 1_000; + + // number of concurrent (sending) tasks to run + private static final int SENDER_COUNT = 10; + + // (exclusive) upper bound of random message size, in bytes + private static final int LARGEST_MESSAGE_BOUND = 32 * 1024 + 2; // 32KiB + 2 + + // random seed + private static final int RANDOM_SEED = 1234; + + private static Properties securityProperties; + + @Rule + public final ClusterStartupRule clusterStartupRule = new ClusterStartupRule(3); + + @ClassRule + public static final DistributedExecutorServiceRule senderExecutorServiceRule = + new DistributedExecutorServiceRule(SENDER_COUNT, 3); + + private MemberVM sender; + private MemberVM receiver; + + /* + * byte
[geode] 01/02: GEODE-9713: Support thread count in ExecutorService rules (#7002)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 671d8071398034c8bd5bec2a0b4e8d67e8bda382 Author: Kirk Lund AuthorDate: Mon Oct 18 17:16:32 2021 -0700 GEODE-9713: Support thread count in ExecutorService rules (#7002) Restores thread count support to ExecutorServiceRule, and adds it to DistributedExecutorServiceRule. PROBLEM ExecutorService rules currently create a newCachedThreadPool which creates new threads as needed. Some usages would benefit from the option of specifying a threadCount limit which would create a newFixedThreadPool that reuses a fixed number of threads. SOLUTION Add optional threadCount creation parameter to both ExecutorServiceRule and DistributedExecutorServiceRule. Creating a ExecutorService rule without a threadCount will still create a newCachedThreadPool. Using a threadCount will now create a newFixedThreadPool. (cherry picked from commit 636bea3fd14c634d2568ed49eba3b13f1797d1ff) --- ...dExecutorServiceRuleLimitedThreadCountTest.java | 103 + ...butedExecutorServiceRuleLimitedVmCountTest.java | 37 + ...xecutorServiceRuleUnlimitedThreadCountTest.java | 75 ++ .../rules/DistributedExecutorServiceRule.java | 165 - .../sanctioned-geode-dunit-serializables.txt | 2 +- .../test/junit/rules/ExecutorServiceRule.java | 69 +++-- .../sanctioned-geode-junit-serializables.txt | 2 +- 7 files changed, 434 insertions(+), 19 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java new file mode 100644 index 000..9328d5e --- /dev/null +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.test.dunit.rules.tests; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.awaitility.GeodeAwaitility.getTimeout; +import static org.apache.geode.test.dunit.VM.getController; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule.builder; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Stream; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule; + +@SuppressWarnings("serial") +public class DistributedExecutorServiceRuleLimitedThreadCountTest implements Serializable { + + private static final int THREAD_COUNT = 2; + private static final long TIMEOUT = getTimeout().toMinutes(); + private static final TimeUnit UNIT = TimeUnit.MINUTES; + private static final AtomicInteger STARTED_TASKS = new AtomicInteger(); + private static final AtomicInteger COMPLETED_TASKS = new AtomicInteger(); + private static final AtomicReference LATCH = new AtomicReference<>(); + + @Rule + public DistributedExecutorServiceRule executorServiceRule = builder() + .threadCount(THREAD_COUNT).vmCount(1).build(); + + @Before + public void setUp() { +Stream.of(getController(), getVM(0)).forEach(vm -> vm.invoke(() -> { + STARTED_TASKS.set(0); + COMPLETED_TASKS.set(0); + LATCH.set(new CountDownLatch(1)); +})); + } + + @Test + public void limitsRunningTasksToThreadCount() { +// start THREAD_COUNT threads to use up the executor's thread pool +Stream.of(getController(), getVM(0)).forEach(vm -&g
[geode] 02/02: GEODE-9825: processInputBuffer resize retains data (#7131)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git commit 0a69cc87bb8a43b18fe7e32cf588b7344ec37580 Author: Bill Burcham AuthorDate: Tue Nov 23 08:29:11 2021 -0800 GEODE-9825: processInputBuffer resize retains data (#7131) (cherry picked from commit fb142e1bbd42d6af2463fd9b9b49ef3e5519cfcb) --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 370 + .../org/apache/geode/internal/tcp/Connection.java | 12 +- 2 files changed, 380 insertions(+), 2 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java new file mode 100644 index 000..0d7c2d3 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -0,0 +1,370 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.distributed.internal; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.Properties; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.LongAdder; + +import junitparams.JUnitParamsRunner; +import junitparams.Parameters; +import org.jetbrains.annotations.NotNull; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; + +import org.apache.geode.cache.CacheFactory; +import org.apache.geode.cache.ssl.CertStores; +import org.apache.geode.cache.ssl.CertificateBuilder; +import org.apache.geode.cache.ssl.CertificateMaterial; +import org.apache.geode.distributed.internal.membership.InternalDistributedMember; +import org.apache.geode.internal.cache.InternalCache; +import org.apache.geode.internal.serialization.DeserializationContext; +import org.apache.geode.internal.serialization.SerializationContext; +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.MembershipTest; +import org.apache.geode.test.version.VersionManager; + +/** + * Tests one-way P2P messaging between two peers. + * Many concurrent tasks compete on the sending side. + * The main purpose of the test is to exercise + * ByteBufferSharing and friends. + * + * Tests combinations of: conserve-sockets true/false, + * TLS on/off, and socket-buffer-size for sender + * and receiver both set to the default (and equal) + * and set to the sender's buffer twice as big as the + * receiver's buffer. + * + */ +@Category({MembershipTest.class}) +@RunWith(JUnitParamsRunner.class) +public class P2PMessagingConcurrencyDUnitTest { + + // how many messages will each sender generate? + private static final int MESSAGES_PER_SENDER = 1_000; + + // number of concurrent (sending) tasks to run + private static final int SENDER_COUNT = 10; + + // (exclusive) upper bound of random message size, in bytes + private static final int LARGEST_MESSAGE_BOUND = 32 * 1024 + 2; // 32KiB + 2 + + // random seed + private static final int RANDOM_SEED = 1234; + + private static Properties securityProperties; + + @Rule + public final ClusterStartupRule clusterStartupRule = new ClusterStartupRule(3); + + @ClassRule + public static final DistributedExecutorServiceRule senderExecutorServiceRule = + new DistributedExecutorServiceRule(SENDER_COUNT, 3); + + private MemberVM sender; + private MemberVM receiver; + + /* + * bytes sent on sender JVM, bytes received on receiver JVM + * (
[geode] 01/02: GEODE-9713: Support thread count in ExecutorService rules (#7002)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git commit d6d9a9108150e2396ebe3ca91ee62c1e895cf040 Author: Kirk Lund AuthorDate: Mon Oct 18 17:16:32 2021 -0700 GEODE-9713: Support thread count in ExecutorService rules (#7002) Restores thread count support to ExecutorServiceRule, and adds it to DistributedExecutorServiceRule. PROBLEM ExecutorService rules currently create a newCachedThreadPool which creates new threads as needed. Some usages would benefit from the option of specifying a threadCount limit which would create a newFixedThreadPool that reuses a fixed number of threads. SOLUTION Add optional threadCount creation parameter to both ExecutorServiceRule and DistributedExecutorServiceRule. Creating a ExecutorService rule without a threadCount will still create a newCachedThreadPool. Using a threadCount will now create a newFixedThreadPool. (cherry picked from commit 636bea3fd14c634d2568ed49eba3b13f1797d1ff) --- ...dExecutorServiceRuleLimitedThreadCountTest.java | 103 + ...butedExecutorServiceRuleLimitedVmCountTest.java | 37 + ...xecutorServiceRuleUnlimitedThreadCountTest.java | 75 ++ .../rules/DistributedExecutorServiceRule.java | 165 - .../sanctioned-geode-dunit-serializables.txt | 2 +- .../test/junit/rules/ExecutorServiceRule.java | 69 +++-- .../sanctioned-geode-junit-serializables.txt | 2 +- 7 files changed, 434 insertions(+), 19 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java new file mode 100644 index 000..9328d5e --- /dev/null +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.test.dunit.rules.tests; + +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; +import static org.apache.geode.test.awaitility.GeodeAwaitility.getTimeout; +import static org.apache.geode.test.dunit.VM.getController; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule.builder; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.Serializable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Stream; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule; + +@SuppressWarnings("serial") +public class DistributedExecutorServiceRuleLimitedThreadCountTest implements Serializable { + + private static final int THREAD_COUNT = 2; + private static final long TIMEOUT = getTimeout().toMinutes(); + private static final TimeUnit UNIT = TimeUnit.MINUTES; + private static final AtomicInteger STARTED_TASKS = new AtomicInteger(); + private static final AtomicInteger COMPLETED_TASKS = new AtomicInteger(); + private static final AtomicReference LATCH = new AtomicReference<>(); + + @Rule + public DistributedExecutorServiceRule executorServiceRule = builder() + .threadCount(THREAD_COUNT).vmCount(1).build(); + + @Before + public void setUp() { +Stream.of(getController(), getVM(0)).forEach(vm -> vm.invoke(() -> { + STARTED_TASKS.set(0); + COMPLETED_TASKS.set(0); + LATCH.set(new CountDownLatch(1)); +})); + } + + @Test + public void limitsRunningTasksToThreadCount() { +// start THREAD_COUNT threads to use up the executor's thread pool +Stream.of(getController(), getVM(0)).forEach(vm -&g
[geode] branch support/1.14 updated (fd3672e -> 0a69cc8)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git. from fd3672e GEODE-9838: Log key info for deserialization issue while index update (#7136) new d6d9a91 GEODE-9713: Support thread count in ExecutorService rules (#7002) new 0a69cc8 GEODE-9825: processInputBuffer resize retains data (#7131) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../internal/P2PMessagingConcurrencyDUnitTest.java | 370 + .../org/apache/geode/internal/tcp/Connection.java | 12 +- ...dExecutorServiceRuleLimitedThreadCountTest.java | 103 ++ ...utedExecutorServiceRuleLimitedVmCountTest.java} | 14 +- ...xecutorServiceRuleUnlimitedThreadCountTest.java | 75 + .../rules/DistributedExecutorServiceRule.java | 165 - .../sanctioned-geode-dunit-serializables.txt | 2 +- .../test/junit/rules/ExecutorServiceRule.java | 69 +++- .../sanctioned-geode-junit-serializables.txt | 2 +- 9 files changed, 785 insertions(+), 27 deletions(-) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleLimitedThreadCountTest.java copy geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/{DistributedRuleDistributedTest.java => DistributedExecutorServiceRuleLimitedVmCountTest.java} (73%) create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedExecutorServiceRuleUnlimitedThreadCountTest.java
[geode] branch develop updated: GEODE-9825: processInputBuffer resize retains data (#7131)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new fb142e1 GEODE-9825: processInputBuffer resize retains data (#7131) fb142e1 is described below commit fb142e1bbd42d6af2463fd9b9b49ef3e5519cfcb Author: Bill Burcham AuthorDate: Tue Nov 23 08:29:11 2021 -0800 GEODE-9825: processInputBuffer resize retains data (#7131) --- .../internal/P2PMessagingConcurrencyDUnitTest.java | 136 +++-- .../org/apache/geode/internal/tcp/Connection.java | 12 +- 2 files changed, 111 insertions(+), 37 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java index e54191a..c204777 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java @@ -15,6 +15,7 @@ package org.apache.geode.distributed.internal; +import static org.apache.geode.test.awaitility.GeodeAwaitility.await; import static org.assertj.core.api.Assertions.assertThat; import java.io.DataInput; @@ -29,12 +30,13 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.LongAdder; +import junitparams.Parameters; import org.jetbrains.annotations.NotNull; -import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; import org.apache.geode.cache.CacheFactory; import org.apache.geode.cache.ssl.CertStores; @@ -48,15 +50,24 @@ import org.apache.geode.test.dunit.rules.ClusterStartupRule; import org.apache.geode.test.dunit.rules.DistributedExecutorServiceRule; import org.apache.geode.test.dunit.rules.MemberVM; import org.apache.geode.test.junit.categories.MembershipTest; +import org.apache.geode.test.junit.runners.GeodeParamsRunner; import org.apache.geode.test.version.VersionManager; /** - * Tests one-way P2P messaging between two peers. A shared, - * ordered connection is used and many concurrent tasks - * compete on the sending side. Tests with TLS enabled - * to exercise ByteBufferSharing and friends. + * Tests one-way P2P messaging between two peers. + * Many concurrent tasks compete on the sending side. + * The main purpose of the test is to exercise + * ByteBufferSharing and friends. + * + * Tests combinations of: conserve-sockets true/false, + * TLS on/off, and socket-buffer-size for sender + * and receiver both set to the default (and equal) + * and set to the sender's buffer twice as big as the + * receiver's buffer. + * */ @Category({MembershipTest.class}) +@RunWith(GeodeParamsRunner.class) public class P2PMessagingConcurrencyDUnitTest { // how many messages will each sender generate? @@ -71,6 +82,8 @@ public class P2PMessagingConcurrencyDUnitTest { // random seed private static final int RANDOM_SEED = 1234; + private static Properties securityProperties; + @Rule public final ClusterStartupRule clusterStartupRule = new ClusterStartupRule(3); @@ -87,21 +100,56 @@ public class P2PMessagingConcurrencyDUnitTest { */ private static LongAdder bytesTransferredAdder; - @Before - public void before() throws GeneralSecurityException, IOException { -final Properties configuration = gemFireConfiguration(); + private void configure( + final boolean conserveSockets, + final boolean useTLS, + final int sendSocketBufferSize, + final int receiveSocketBufferSize) throws GeneralSecurityException, IOException { + +final Properties senderConfiguration = +gemFireConfiguration(conserveSockets, useTLS, sendSocketBufferSize); +final Properties receiverConfiguration = +gemFireConfiguration(conserveSockets, useTLS, receiveSocketBufferSize); final MemberVM locator = clusterStartupRule.startLocatorVM(0, 0, VersionManager.CURRENT_VERSION, -x -> x.withProperties(configuration).withConnectionToLocator() +x -> x.withProperties(senderConfiguration).withConnectionToLocator() .withoutClusterConfigurationService().withoutManagementRestService()); -sender = clusterStartupRule.startServerVM(1, configuration, locator.getPort()); -receiver = clusterStartupRule.startServerVM(2, configuration, locator.getPort()); +sender = clusterStartupRule.startServerVM(1, senderConfiguration, locator.getPort()); +receiver = clusterStartupRule.startServerVM(2, receiverConfiguration, locator.getPort()); } @Test - publi
[geode] branch support/1.12 updated: GEODE-8542: java.lang.IllegalStateException: tcp message exceeded max… (#5562)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 26f7c17 GEODE-8542: java.lang.IllegalStateException: tcp message exceeded max… (#5562) 26f7c17 is described below commit 26f7c17b49b4e83f2af40fca66c8719658a53bf2 Author: Bruce Schuchardt AuthorDate: Tue Sep 29 10:17:56 2020 -0700 GEODE-8542: java.lang.IllegalStateException: tcp message exceeded max… (#5562) Limit the size of message chunks to the maximum message size allowed by org.apache.geode.internal.tcp.Connection. (cherry picked from commit b439d3301dc15a81a9917b05ca4bd0717d1718bc) (cherry picked from commit cb07f831b1ce1023608e59f873b015f1ae2768bc) --- .../org/apache/geode/internal/tcp/MsgStreamer.java | 9 +- .../apache/geode/internal/tcp/MsgStreamerTest.java | 129 + 2 files changed, 137 insertions(+), 1 deletion(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java index ed25ce3..69f8047 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java +++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java @@ -27,6 +27,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIterator; import org.apache.geode.DataSerializer; +import org.apache.geode.annotations.VisibleForTesting; import org.apache.geode.distributed.internal.DMStats; import org.apache.geode.distributed.internal.DistributionMessage; import org.apache.geode.internal.Assert; @@ -129,7 +130,8 @@ public class MsgStreamer extends OutputStream this.stats = stats; this.msg = msg; this.cons = cons; -this.buffer = bufferPool.acquireDirectSenderBuffer(sendBufferSize); +int bufferSize = Math.min(sendBufferSize, Connection.MAX_MSG_SIZE); +this.buffer = bufferPool.acquireDirectSenderBuffer(bufferSize); this.buffer.clear(); this.buffer.position(Connection.MSG_HEADER_BYTES); this.msgId = MsgIdGenerator.NO_MSG_ID; @@ -347,6 +349,11 @@ public class MsgStreamer extends OutputStream this.buffer.position(Connection.MSG_HEADER_BYTES); } + @VisibleForTesting + protected ByteBuffer getBuffer() { +return buffer; + } + @Override public void close() throws IOException { try { diff --git a/geode-core/src/test/java/org/apache/geode/internal/tcp/MsgStreamerTest.java b/geode-core/src/test/java/org/apache/geode/internal/tcp/MsgStreamerTest.java new file mode 100644 index 000..22f5756 --- /dev/null +++ b/geode-core/src/test/java/org/apache/geode/internal/tcp/MsgStreamerTest.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.List; + +import javax.net.ssl.SSLException; + +import org.junit.Test; + +import org.apache.geode.distributed.internal.DMStats; +import org.apache.geode.distributed.internal.DistributionMessage; +import org.apache.geode.distributed.internal.SerialAckedMessage; +import org.apache.geode.distributed.internal.membership.InternalDistributedMember; +import org.apache.geode.internal.net.BufferPool; +import org.apache.geode.internal.serialization.Version; + +public class MsgStreamerTest { + private DMStats stats = mock(DMStats.class); + private BufferPool pool = spy(new BufferPool(stats)); + Connection connection1 = mock(Connection.class); + Connection connection2 = mock(Connection.class); + + // This test reli
[geode] branch support/1.13 updated: GEODE-8542: java.lang.IllegalStateException: tcp message exceeded max… (#5562)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.13 by this push: new 653e8cd GEODE-8542: java.lang.IllegalStateException: tcp message exceeded max… (#5562) 653e8cd is described below commit 653e8cde775bb3f97f21c91017a12a809a54b51e Author: Bruce Schuchardt AuthorDate: Tue Sep 29 10:17:56 2020 -0700 GEODE-8542: java.lang.IllegalStateException: tcp message exceeded max… (#5562) Limit the size of message chunks to the maximum message size allowed by org.apache.geode.internal.tcp.Connection. (cherry picked from commit b439d3301dc15a81a9917b05ca4bd0717d1718bc) --- .../org/apache/geode/internal/tcp/MsgStreamer.java | 9 ++- .../apache/geode/internal/tcp/MsgStreamerTest.java | 29 -- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java index 603d2bd..6157928 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java +++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/MsgStreamer.java @@ -27,6 +27,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIterator; import org.apache.geode.DataSerializer; +import org.apache.geode.annotations.VisibleForTesting; import org.apache.geode.distributed.internal.DMStats; import org.apache.geode.distributed.internal.DistributionMessage; import org.apache.geode.internal.Assert; @@ -129,7 +130,8 @@ public class MsgStreamer extends OutputStream this.stats = stats; this.msg = msg; this.cons = cons; -this.buffer = bufferPool.acquireDirectSenderBuffer(sendBufferSize); +int bufferSize = Math.min(sendBufferSize, Connection.MAX_MSG_SIZE); +this.buffer = bufferPool.acquireDirectSenderBuffer(bufferSize); this.buffer.clear(); this.buffer.position(Connection.MSG_HEADER_BYTES); this.msgId = MsgIdGenerator.NO_MSG_ID; @@ -351,6 +353,11 @@ public class MsgStreamer extends OutputStream this.buffer.position(Connection.MSG_HEADER_BYTES); } + @VisibleForTesting + protected ByteBuffer getBuffer() { +return buffer; + } + @Override public void close() throws IOException { try { diff --git a/geode-core/src/test/java/org/apache/geode/internal/tcp/MsgStreamerTest.java b/geode-core/src/test/java/org/apache/geode/internal/tcp/MsgStreamerTest.java index 1631b08..d1f1509 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/tcp/MsgStreamerTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/tcp/MsgStreamerTest.java @@ -77,6 +77,31 @@ public class MsgStreamerTest { verify(pool, times(2)).releaseSenderBuffer(isA(ByteBuffer.class)); } + @Test + public void streamerRespectsMaxMessageSize() { +InternalDistributedMember member1; +member1 = new InternalDistributedMember("localhost", 1234); + +DistributionMessage message = new SerialAckedMessage(); +message.setRecipients(Arrays.asList(member1)); + +when(connection1.getRemoteAddress()).thenReturn(member1); +when(connection1.getRemoteVersion()).thenReturn(Version.CURRENT); +// create a streamer for a Connection that has a buffer size that's larger than the +// biggest message we can actually send. This is picked up by the MsgStreamer to allocate +// a buffer +when(connection1.getSendBufferSize()).thenReturn(Connection.MAX_MSG_SIZE + 1); +List connections = Arrays.asList(connection1); + +final BaseMsgStreamer msgStreamer = +MsgStreamer.create(connections, message, false, stats, pool); +// the streamer ought to have limited the message buffer to MAX_MSG_SIZE +assertThat(((MsgStreamer) msgStreamer).getBuffer().capacity()) +.isEqualTo(Connection.MAX_MSG_SIZE); + } + + + protected BaseMsgStreamer createMsgStreamer(boolean mixedDestinationVersions) { InternalDistributedMember member1, member2; @@ -92,9 +117,9 @@ public class MsgStreamerTest { when(connection2.getRemoteAddress()).thenReturn(member2); when(connection2.getSendBufferSize()).thenReturn(Connection.SMALL_BUFFER_SIZE); if (mixedDestinationVersions) { - when(connection1.getRemoteVersion()).thenReturn(Version.GEODE_1_12_0); + when(connection2.getRemoteVersion()).thenReturn(Version.GEODE_1_12_0); } else { - when(connection1.getRemoteVersion()).thenReturn(Version.CURRENT); + when(connection2.getRemoteVersion()).thenReturn(Version.CURRENT); } List connections = Arrays.asList(connection1, connection2);
[geode] branch develop updated: GEODE-9675: remove useless but flaky test (#7095)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 1885f06 GEODE-9675: remove useless but flaky test (#7095) 1885f06 is described below commit 1885f0606467703487c4bcc056e0c6696280d570 Author: Bill Burcham AuthorDate: Tue Nov 9 16:00:17 2021 -0800 GEODE-9675: remove useless but flaky test (#7095) --- .../ClusterDistributionManagerDUnitTest.java| 21 - 1 file changed, 21 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java index d854aaa..c7a5170 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/ClusterDistributionManagerDUnitTest.java @@ -155,27 +155,6 @@ public class ClusterDistributionManagerDUnitTest extends CacheTestCase { } /** - * Demonstrate that a new UDP port is used when an attempt is made to reconnect using a shunned - * port - */ - @Test - public void testConnectAfterBeingShunned() { -InternalDistributedSystem system = getSystem(); -Distribution membership = MembershipManagerHelper.getDistribution(system); -InternalDistributedMember memberBefore = membership.getLocalMember(); - -// TODO GMS needs to have a system property allowing the bind-port to be set -System.setProperty(GEMFIRE_PREFIX + "jg-bind-port", "" + memberBefore.getMembershipPort()); -system.disconnect(); -system = getSystem(); -membership = MembershipManagerHelper.getDistribution(system); -system.disconnect(); -InternalDistributedMember memberAfter = membership.getLocalMember(); - - assertThat(memberAfter.getMembershipPort()).isEqualTo(memberBefore.getMembershipPort()); - } - - /** * Test the handling of "surprise members" in the membership manager. Create a DistributedSystem * in this VM and then add a fake member to its surpriseMember set. Then ensure that it stays in * the set when a new membership view arrives that doesn't contain it. Then wait until the member
[geode] branch develop updated (d759a52 -> 115704a)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from d759a52 GEODE-9767: Bump netty from 4.1.67.Final to 4.1.69.Final (#7031) add 115704a GEODE-9763: DUnit Test of Concurrent P2P Messaging with TLS Enabled (#6930) No new revisions were added by this update. Summary of changes: .../internal/P2PMessagingConcurrencyDUnitTest.java | 304 + .../geode/internal/net/ByteBufferVendor.java | 9 + .../internal/net/ByteBufferConcurrencyTest.java| 131 + .../serialization/DataSerializableFixedID.java | 2 +- 4 files changed, 394 insertions(+), 52 deletions(-) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/distributed/internal/P2PMessagingConcurrencyDUnitTest.java
[geode] branch support/1.12 updated: GEODE-7920: Geode UDP INT thread found processing cache operations (#7018)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 6fe63cc GEODE-7920: Geode UDP INT thread found processing cache operations (#7018) 6fe63cc is described below commit 6fe63cc3dc586824ea827300728688fafcd3d002 Author: Bill Burcham AuthorDate: Fri Oct 22 10:43:57 2021 -0700 GEODE-7920: Geode UDP INT thread found processing cache operations (#7018) Modified DistributionMessage to look for JGroups "internal" executor threads. We thought we'd turned off all JGroups thread pools but this one is still around. We don't want to process DistributionMessages in these threads unless absolutely necessary since they're needed when processing incoming messages. (cherry picked from commit 8f24abbc7bade3f8e65a52a1a0402343e12ba2b5) Co-authored-by: Bruce Schuchardt --- .../internal/ClusterOperationExecutors.java | 2 +- .../distributed/internal/DistributionMessage.java | 19 +-- .../geode/distributed/internal/ShutdownMessage.java | 2 +- .../internal/ThrottlingMemLinkedQueueWithDMStats.java | 2 +- .../distributed/internal/DistributionMessageTest.java | 12 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java index 586f5dc..ab85e7a 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java @@ -738,7 +738,7 @@ public class ClusterOperationExecutors implements OperationExecutors { // UDP readers are throttled in the FC protocol, which queries // the queue to see if it should throttle if (stats.getInternalSerialQueueBytes() > TOTAL_SERIAL_QUEUE_THROTTLE - && !DistributionMessage.isPreciousThread()) { + && !DistributionMessage.isMembershipMessengerThread()) { do { boolean interrupted = Thread.interrupted(); try { diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java index 4fed3c1..0f11b6b 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessage.java @@ -412,7 +412,8 @@ public abstract class DistributionMessage */ protected void schedule(final ClusterDistributionManager dm) { boolean inlineProcess = INLINE_PROCESS -&& getProcessorType() == OperationExecutors.SERIAL_EXECUTOR && !isPreciousThread(); +&& getProcessorType() == OperationExecutors.SERIAL_EXECUTOR +&& !isMembershipMessengerThread(); boolean forceInline = this.acker != null || getInlineProcess() || Connection.isDominoThread(); @@ -476,13 +477,19 @@ public abstract class DistributionMessage } /** - * returns true if the current thread should not be used for inline processing. i.e., it is a - * "precious" resource + * returns true if the current thread should not be used for inline processing because it + * is responsible for reading geode-membership messages. Blocking such a thread can cause + * a server to be kicked out */ - public static boolean isPreciousThread() { + public static boolean isMembershipMessengerThread() { String thrname = Thread.currentThread().getName(); -// return thrname.startsWith("Geode UDP"); -return thrname.startsWith("unicast receiver") || thrname.startsWith("multicast receiver"); + +return isMembershipMessengerThreadName(thrname); + } + + public static boolean isMembershipMessengerThreadName(String thrname) { +return thrname.startsWith("unicast receiver") || thrname.startsWith("multicast receiver") +|| thrname.startsWith("Geode UDP"); } diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ShutdownMessage.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ShutdownMessage.java index 66cadc4..2e1ebc4 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ShutdownMessage.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ShutdownMessage.java @@ -79,7 +79,7 @@ public class ShutdownMessage extends HighPriorityDistributionMessage // reply.setRecipient(getSender()); //
[geode] 02/02: GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit 924a610a7c6517c768069ce1e1939fb4b2b67cd0 Author: Bill Burcham AuthorDate: Sat Apr 17 09:12:13 2021 -0700 GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished (cherry picked from commit 9d0d4d1d33794d0f6a21c3bcae71e965cbbd7fbd) (cherry picked from commit 9e8b3972fcf449eed4d41c254cf3f553e517eaa1) (cherry picked from commit c4730deed48bb4513bd04486d4e8c09cdd3bb5a9) --- ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../geode/internal/net/ByteBufferSharing.java | 15 + .../geode/internal/net/ByteBufferSharingNoOp.java | 5 + .../geode/internal/net/ByteBufferVendor.java | 144 ++--- .../apache/geode/internal/net/NioSslEngine.java| 50 ++- .../apache/geode/internal/net/SocketCreator.java | 9 +- .../org/apache/geode/internal/tcp/Connection.java | 334 +++-- .../geode/internal/net/ByteBufferVendorTest.java | 36 ++- .../geode/internal/net/NioSslEngineTest.java | 41 +-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 12 files changed, 361 insertions(+), 285 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java index a70f3b1..e86bfea 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java @@ -103,6 +103,9 @@ public class SSLSocketHostNameVerificationIntegrationTest { @Before public void setUp() throws Exception { + +SocketCreatorFactory.close(); // to clear socket creators made in previous tests + IgnoredException.addIgnoredException("javax.net.ssl.SSLException: Read timed out"); this.localHost = InetAddress.getLoopbackAddress(); @@ -172,7 +175,7 @@ public class SSLSocketHostNameVerificationIntegrationTest { try { this.socketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), - sslEngine, 0, true, + sslEngine, 0, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); @@ -205,7 +208,6 @@ public class SSLSocketHostNameVerificationIntegrationTest { sc.handshakeSSLSocketChannel(socket.getChannel(), sslEngine, timeoutMillis, -false, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); } catch (Throwable throwable) { diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java index e7ac191..13e9d5b 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java @@ -217,7 +217,7 @@ public class SSLSocketIntegrationTest { clientSocket = clientChannel.socket(); NioSslEngine engine = clusterSocketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), -clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, true, +clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); clientChannel.configureBlocking(true); @@ -267,7 +267,6 @@ public class SSLSocketIntegrationTest { sc.handshakeSSLSocketChannel(socket.getChannel(), sc.createSSLEngine("localhost", 1234, false), timeoutMillis, -false, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt index af3bd1e..cd1af3a 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt @@ -104,4 +104,4 @@ org/apache/geode/cache/qu
[geode] 01/02: GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit 41a1f14bf0c362e7d0092ea5d0d3c86b5c928d56 Author: Bill Burcham AuthorDate: Sat Apr 17 13:15:53 2021 -0700 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor (cherry picked from commit 38a3540583a1d0a402b026ee0d33ae4b0a2907d3) (cherry picked from commit e0fa01dd9ec9c61504d517e77d1620f8e7975b73) --- .../apache/geode/internal/net/ByteBufferSharingNoOp.java | 2 +- ...{ByteBufferSharingImpl.java => ByteBufferVendor.java} | 6 +++--- .../java/org/apache/geode/internal/net/NioSslEngine.java | 10 +- .../geode/internal/net/ByteBufferConcurrencyTest.java| 16 ...ferSharingImplTest.java => ByteBufferVendorTest.java} | 6 +++--- .../org/apache/geode/internal/net/NioSslEngineTest.java | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java index bd707e3..4a8bc49 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java @@ -27,7 +27,7 @@ import java.nio.ByteBuffer; * meant for use with the {@link NioPlainEngine} only, since that engine keeps no buffers and so, * needs no reference counting on buffers, nor any synchronization around access to buffers. * - * See also {@link ByteBufferSharingImpl} + * See also {@link ByteBufferVendor} */ class ByteBufferSharingNoOp implements ByteBufferSharing { diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java similarity index 96% rename from geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java rename to geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java index b083d09..4933247 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java @@ -31,7 +31,7 @@ import org.apache.geode.internal.net.BufferPool.BufferType; * {@link ByteBuffer}) is available (for reading and modification) in the scope of the * try-with-resources. */ -class ByteBufferSharingImpl implements ByteBufferSharing { +class ByteBufferVendor implements ByteBufferSharing { static class OpenAttemptTimedOut extends Exception { } @@ -53,8 +53,8 @@ class ByteBufferSharingImpl implements ByteBufferSharing { * This constructor acquires no lock. The reference count will be 1 after this constructor * completes. */ - ByteBufferSharingImpl(final ByteBuffer buffer, final BufferType bufferType, - final BufferPool bufferPool) { + ByteBufferVendor(final ByteBuffer buffer, final BufferType bufferType, + final BufferPool bufferPool) { this.buffer = buffer; this.bufferType = bufferType; this.bufferPool = bufferPool; diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java index 8969ecc..fc91a31 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java @@ -42,7 +42,7 @@ import org.apache.logging.log4j.Logger; import org.apache.geode.GemFireIOException; import org.apache.geode.annotations.VisibleForTesting; import org.apache.geode.internal.net.BufferPool.BufferType; -import org.apache.geode.internal.net.ByteBufferSharingImpl.OpenAttemptTimedOut; +import org.apache.geode.internal.net.ByteBufferVendor.OpenAttemptTimedOut; import org.apache.geode.logging.internal.log4j.api.LogService; @@ -62,12 +62,12 @@ public class NioSslEngine implements NioFilter { /** * holds bytes wrapped by the SSLEngine; a.k.a. myNetData */ - private final ByteBufferSharingImpl outputSharing; + private final ByteBufferVendor outputSharing; /** * holds the last unwrapped data from a peer; a.k.a. peerAppData */ - private final ByteBufferSharingImpl inputSharing; + private final ByteBufferVendor inputSharing; NioSslEngine(SSLEngine engine, BufferPool bufferPool) { SSLSession session = engine.getSession(); @@ -77,10 +77,10 @@ public class NioSslEngine implements NioFilter { this.engine = engine; this.bufferPool = bufferPool; outputSharing = -new ByteBufferSharingImpl(bufferPool.acquireDirectSenderBuffer(packetBufferSize), +new ByteBufferVendor(bufferPool.acquireDirectSenderBuffer(packetBufferSize), TRACKED_SENDER, buff
[geode] branch support/1.12 updated (0a33ffb -> 924a610)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git. from 0a33ffb GEODE-9180: warn when heartbeat thread oversleeps (#6360) new 41a1f14 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor new 924a610 GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../geode/internal/net/ByteBufferSharing.java | 15 + .../geode/internal/net/ByteBufferSharingNoOp.java | 7 +- ...ufferSharingImpl.java => ByteBufferVendor.java} | 144 ++--- .../apache/geode/internal/net/NioSslEngine.java| 56 ++-- .../apache/geode/internal/net/SocketCreator.java | 9 +- .../org/apache/geode/internal/tcp/Connection.java | 334 +++-- .../internal/net/ByteBufferConcurrencyTest.java| 16 +- ...ringImplTest.java => ByteBufferVendorTest.java} | 40 +-- .../geode/internal/net/NioSslEngineTest.java | 41 +-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 13 files changed, 375 insertions(+), 299 deletions(-) rename geode-core/src/main/java/org/apache/geode/internal/net/{ByteBufferSharingImpl.java => ByteBufferVendor.java} (53%) rename geode-core/src/test/java/org/apache/geode/internal/net/{ByteBufferSharingImplTest.java => ByteBufferVendorTest.java} (84%)
[geode] branch support/1.13 updated (2ff9f46 -> 4ef2bcd)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 2ff9f46 GEODE-9180: warn when heartbeat thread oversleeps (#6360) new f28eca3 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor new 4ef2bcd GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../geode/internal/net/ByteBufferSharing.java | 15 ++ .../geode/internal/net/ByteBufferSharingNoOp.java | 7 +- ...ufferSharingImpl.java => ByteBufferVendor.java} | 144 ++ .../apache/geode/internal/net/NioSslEngine.java| 56 ++-- .../apache/geode/internal/net/SocketCreator.java | 5 +- .../org/apache/geode/internal/tcp/Connection.java | 299 ++--- .../internal/net/ByteBufferConcurrencyTest.java| 16 +- ...ringImplTest.java => ByteBufferVendorTest.java} | 40 +-- .../geode/internal/net/NioSslEngineTest.java | 41 +-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 13 files changed, 354 insertions(+), 281 deletions(-) rename geode-core/src/main/java/org/apache/geode/internal/net/{ByteBufferSharingImpl.java => ByteBufferVendor.java} (53%) rename geode-core/src/test/java/org/apache/geode/internal/net/{ByteBufferSharingImplTest.java => ByteBufferVendorTest.java} (84%)
[geode] 02/02: GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 4ef2bcd4962bc9506c2b7eec2fdab8467759488f Author: Bill Burcham AuthorDate: Sat Apr 17 09:12:13 2021 -0700 GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished (cherry picked from commit 9d0d4d1d33794d0f6a21c3bcae71e965cbbd7fbd) (cherry picked from commit 9e8b3972fcf449eed4d41c254cf3f553e517eaa1) --- ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../geode/internal/net/ByteBufferSharing.java | 15 ++ .../geode/internal/net/ByteBufferSharingNoOp.java | 5 + .../geode/internal/net/ByteBufferVendor.java | 144 ++ .../apache/geode/internal/net/NioSslEngine.java| 50 ++-- .../apache/geode/internal/net/SocketCreator.java | 5 +- .../org/apache/geode/internal/tcp/Connection.java | 299 ++--- .../geode/internal/net/ByteBufferVendorTest.java | 36 +-- .../geode/internal/net/NioSslEngineTest.java | 41 +-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 12 files changed, 340 insertions(+), 267 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java index a70f3b1..e86bfea 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java @@ -103,6 +103,9 @@ public class SSLSocketHostNameVerificationIntegrationTest { @Before public void setUp() throws Exception { + +SocketCreatorFactory.close(); // to clear socket creators made in previous tests + IgnoredException.addIgnoredException("javax.net.ssl.SSLException: Read timed out"); this.localHost = InetAddress.getLoopbackAddress(); @@ -172,7 +175,7 @@ public class SSLSocketHostNameVerificationIntegrationTest { try { this.socketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), - sslEngine, 0, true, + sslEngine, 0, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); @@ -205,7 +208,6 @@ public class SSLSocketHostNameVerificationIntegrationTest { sc.handshakeSSLSocketChannel(socket.getChannel(), sslEngine, timeoutMillis, -false, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); } catch (Throwable throwable) { diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java index add6b9a..5415f4e 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java @@ -227,7 +227,7 @@ public class SSLSocketIntegrationTest { clientSocket = clientChannel.socket(); NioSslEngine engine = clusterSocketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), -clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, true, +clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); clientChannel.configureBlocking(true); @@ -279,7 +279,6 @@ public class SSLSocketIntegrationTest { engine = sc.handshakeSSLSocketChannel(socket.getChannel(), sslEngine, timeoutMillis, -false, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); final List serverNames = sslEngine.getSSLParameters().getServerNames(); diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt index 33f43c3..a96907f 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt @@ -104,4 +104,4 @@ org/apache/geode/cache/query/internal/xml/ElementType org/apa
[geode] 01/02: GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit f28eca3ad926f4f8f9c481426260f8f8ddc2dc9a Author: Bill Burcham AuthorDate: Sat Apr 17 13:15:53 2021 -0700 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor (cherry picked from commit 38a3540583a1d0a402b026ee0d33ae4b0a2907d3) (cherry picked from commit e0fa01dd9ec9c61504d517e77d1620f8e7975b73) --- .../apache/geode/internal/net/ByteBufferSharingNoOp.java | 2 +- ...{ByteBufferSharingImpl.java => ByteBufferVendor.java} | 6 +++--- .../java/org/apache/geode/internal/net/NioSslEngine.java | 10 +- .../geode/internal/net/ByteBufferConcurrencyTest.java| 16 ...ferSharingImplTest.java => ByteBufferVendorTest.java} | 6 +++--- .../org/apache/geode/internal/net/NioSslEngineTest.java | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java index bd707e3..4a8bc49 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java @@ -27,7 +27,7 @@ import java.nio.ByteBuffer; * meant for use with the {@link NioPlainEngine} only, since that engine keeps no buffers and so, * needs no reference counting on buffers, nor any synchronization around access to buffers. * - * See also {@link ByteBufferSharingImpl} + * See also {@link ByteBufferVendor} */ class ByteBufferSharingNoOp implements ByteBufferSharing { diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java similarity index 96% rename from geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java rename to geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java index b083d09..4933247 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java @@ -31,7 +31,7 @@ import org.apache.geode.internal.net.BufferPool.BufferType; * {@link ByteBuffer}) is available (for reading and modification) in the scope of the * try-with-resources. */ -class ByteBufferSharingImpl implements ByteBufferSharing { +class ByteBufferVendor implements ByteBufferSharing { static class OpenAttemptTimedOut extends Exception { } @@ -53,8 +53,8 @@ class ByteBufferSharingImpl implements ByteBufferSharing { * This constructor acquires no lock. The reference count will be 1 after this constructor * completes. */ - ByteBufferSharingImpl(final ByteBuffer buffer, final BufferType bufferType, - final BufferPool bufferPool) { + ByteBufferVendor(final ByteBuffer buffer, final BufferType bufferType, + final BufferPool bufferPool) { this.buffer = buffer; this.bufferType = bufferType; this.bufferPool = bufferPool; diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java index 8969ecc..fc91a31 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java @@ -42,7 +42,7 @@ import org.apache.logging.log4j.Logger; import org.apache.geode.GemFireIOException; import org.apache.geode.annotations.VisibleForTesting; import org.apache.geode.internal.net.BufferPool.BufferType; -import org.apache.geode.internal.net.ByteBufferSharingImpl.OpenAttemptTimedOut; +import org.apache.geode.internal.net.ByteBufferVendor.OpenAttemptTimedOut; import org.apache.geode.logging.internal.log4j.api.LogService; @@ -62,12 +62,12 @@ public class NioSslEngine implements NioFilter { /** * holds bytes wrapped by the SSLEngine; a.k.a. myNetData */ - private final ByteBufferSharingImpl outputSharing; + private final ByteBufferVendor outputSharing; /** * holds the last unwrapped data from a peer; a.k.a. peerAppData */ - private final ByteBufferSharingImpl inputSharing; + private final ByteBufferVendor inputSharing; NioSslEngine(SSLEngine engine, BufferPool bufferPool) { SSLSession session = engine.getSession(); @@ -77,10 +77,10 @@ public class NioSslEngine implements NioFilter { this.engine = engine; this.bufferPool = bufferPool; outputSharing = -new ByteBufferSharingImpl(bufferPool.acquireDirectSenderBuffer(packetBufferSize), +new ByteBufferVendor(bufferPool.acquireDirectSenderBuffer(packetBufferSize), TRACKED_SENDER, buff
[geode] branch support/1.12 updated: GEODE-9180: warn when heartbeat thread oversleeps (#6360)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 0a33ffb GEODE-9180: warn when heartbeat thread oversleeps (#6360) 0a33ffb is described below commit 0a33ffbe990af93e2779957ae6027a2c5a077c3f Author: Bill Burcham AuthorDate: Wed Apr 28 10:22:16 2021 -0700 GEODE-9180: warn when heartbeat thread oversleeps (#6360) * heartbeat producer logs warning when it oversleeps by a period or more (cherry picked from commit f8b07a007ac93c323cd888cbc53dc3914336077f) --- .../gms/fd/GMSHealthMonitorJUnitTest.java | 47 + .../membership/gms/fd/GMSHealthMonitor.java| 190 - 2 files changed, 161 insertions(+), 76 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java index e458dcf..2fd15e0 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java @@ -58,6 +58,7 @@ import java.util.Timer; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import java.util.function.LongUnaryOperator; import org.junit.After; import org.junit.Assert; @@ -989,6 +990,52 @@ public class GMSHealthMonitorJUnitTest { executeTestDoTCPCheck(GMSHealthMonitor.ERROR + 100, false); } + @Test + public void heartbeatOversleepCausesWarning() { +testHeartbeatSleepScenario(sleepLimit -> sleepLimit + 1, +"Failure detection heartbeat-generation thread overslept by more than a full period. Asleep time: 1,000,000,001 nanoseconds. Period: 500,000,000 nanoseconds."); + } + + @Test + public void heartbeatOnTimeWakeupCausesNoWarning() { +testHeartbeatSleepScenario(sleepLimit -> sleepLimit, +null); + } + + private void testHeartbeatSleepScenario(final LongUnaryOperator actualSleepPeriod, + final String expectedLogWarning) { + +/* + * Creating a class here because it's a convenient to provide (mutable) variables needed + * by the lambdas. Without the class, each of them would have to be arrays or atomics + * or some other kind of "holder object". By creating a class they can simply be fields. + */ +new Runnable() { + // the thing we're testing + final GMSHealthMonitor.Heart heart = gmsHealthMonitor.new Heart(); + int periodNumber = 0; // index into times + String capturedMessage; // warning message (if any) generated by heart + + @Override + public void run() { +heart.sendPeriodicHeartbeats(sleepMillis -> { +}, +() -> { + switch (periodNumber++) { +case 0: + return 0L; +case 1: +default: + gmsHealthMonitor.stop(); + return actualSleepPeriod.applyAsLong(heart.sleepLimitNanos); + } +}, +msg -> capturedMessage = msg); +assertThat(capturedMessage).isEqualTo(expectedLogWarning); + } +}.run(); + } + private void executeTestDoTCPCheck(int receivedStatus, boolean expectedResult) throws Exception { MemberIdentifier otherMember = createGMSMember(Version.CURRENT_ORDINAL, 0, 1, 1); diff --git a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java index 73af605..a1b493f 100644 --- a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java +++ b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java @@ -749,82 +749,7 @@ public class GMSHealthMonitor implements HealthMoni * process */ private void startHeartbeatThread() { -checkExecutor.execute(new Runnable() { - @Override - public void run() { -Thread.currentThread().setName("Geode Heartbeat Sender"); -sendPeriodicHeartbeats(); - } - - private void sendPeriodicHeartbeats() { -while (!isStopping && !services.getCancelCriterion().isCancelInProgress()) { - try { -Thread.sleep(memberTimeout / LOGICAL_INTERVAL); - } catch (InterruptedException e) { -return; - } - GMSMembershipView v = currentVie
[geode] branch support/1.13 updated: GEODE-9180: warn when heartbeat thread oversleeps (#6360)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.13 by this push: new 2ff9f46 GEODE-9180: warn when heartbeat thread oversleeps (#6360) 2ff9f46 is described below commit 2ff9f4696028d05dbca669f3d873caf9e75922be Author: Bill Burcham AuthorDate: Wed Apr 28 10:22:16 2021 -0700 GEODE-9180: warn when heartbeat thread oversleeps (#6360) * heartbeat producer logs warning when it oversleeps by a period or more (cherry picked from commit f8b07a007ac93c323cd888cbc53dc3914336077f) --- .../gms/fd/GMSHealthMonitorJUnitTest.java | 47 + .../membership/gms/fd/GMSHealthMonitor.java| 190 - 2 files changed, 161 insertions(+), 76 deletions(-) diff --git a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java index 2aaf2f5..81e132a 100644 --- a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java +++ b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java @@ -48,6 +48,7 @@ import java.util.Timer; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import java.util.function.LongUnaryOperator; import org.junit.After; import org.junit.Assert; @@ -952,6 +953,52 @@ public class GMSHealthMonitorJUnitTest { executeTestDoTCPCheck(GMSHealthMonitor.ERROR + 100, false); } + @Test + public void heartbeatOversleepCausesWarning() { +testHeartbeatSleepScenario(sleepLimit -> sleepLimit + 1, +"Failure detection heartbeat-generation thread overslept by more than a full period. Asleep time: 1,000,000,001 nanoseconds. Period: 500,000,000 nanoseconds."); + } + + @Test + public void heartbeatOnTimeWakeupCausesNoWarning() { +testHeartbeatSleepScenario(sleepLimit -> sleepLimit, +null); + } + + private void testHeartbeatSleepScenario(final LongUnaryOperator actualSleepPeriod, + final String expectedLogWarning) { + +/* + * Creating a class here because it's a convenient to provide (mutable) variables needed + * by the lambdas. Without the class, each of them would have to be arrays or atomics + * or some other kind of "holder object". By creating a class they can simply be fields. + */ +new Runnable() { + // the thing we're testing + final GMSHealthMonitor.Heart heart = gmsHealthMonitor.new Heart(); + int periodNumber = 0; // index into times + String capturedMessage; // warning message (if any) generated by heart + + @Override + public void run() { +heart.sendPeriodicHeartbeats(sleepMillis -> { +}, +() -> { + switch (periodNumber++) { +case 0: + return 0L; +case 1: +default: + gmsHealthMonitor.stop(); + return actualSleepPeriod.applyAsLong(heart.sleepLimitNanos); + } +}, +msg -> capturedMessage = msg); +assertThat(capturedMessage).isEqualTo(expectedLogWarning); + } +}.run(); + } + private void executeTestDoTCPCheck(int receivedStatus, boolean expectedResult) throws Exception { MemberIdentifier otherMember = createGMSMember(Version.CURRENT_ORDINAL, 0, 1, 1); diff --git a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java index 2590e23..7457557 100644 --- a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java +++ b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java @@ -750,82 +750,7 @@ public class GMSHealthMonitor implements HealthMoni * process */ private void startHeartbeatThread() { -checkExecutor.execute(new Runnable() { - @Override - public void run() { -Thread.currentThread().setName("Geode Heartbeat Sender"); -sendPeriodicHeartbeats(); - } - - private void sendPeriodicHeartbeats() { -while (!isStopping && !services.getCancelCriterion().isCancelInProgress()) { - try { -Thread.sleep(memberTimeout / LOGICAL_INTERVAL); - } catch (InterruptedException e) { -return; - } - GMSMem
[geode] 02/02: GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit 1a8eb5aec580eb75871060793ea65d62f5f2d959 Author: Bill Burcham AuthorDate: Sat Apr 17 09:12:13 2021 -0700 GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished (cherry picked from commit 9d0d4d1d33794d0f6a21c3bcae71e965cbbd7fbd) (cherry picked from commit 9e8b3972fcf449eed4d41c254cf3f553e517eaa1) (cherry picked from commit c4730deed48bb4513bd04486d4e8c09cdd3bb5a9) --- ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../geode/internal/net/ByteBufferSharing.java | 15 + .../geode/internal/net/ByteBufferSharingNoOp.java | 5 + .../geode/internal/net/ByteBufferVendor.java | 144 ++--- .../apache/geode/internal/net/NioSslEngine.java| 50 ++- .../apache/geode/internal/net/SocketCreator.java | 9 +- .../org/apache/geode/internal/tcp/Connection.java | 334 +++-- .../geode/internal/net/ByteBufferVendorTest.java | 36 ++- .../geode/internal/net/NioSslEngineTest.java | 41 +-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 12 files changed, 361 insertions(+), 285 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java index a70f3b1..e86bfea 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java @@ -103,6 +103,9 @@ public class SSLSocketHostNameVerificationIntegrationTest { @Before public void setUp() throws Exception { + +SocketCreatorFactory.close(); // to clear socket creators made in previous tests + IgnoredException.addIgnoredException("javax.net.ssl.SSLException: Read timed out"); this.localHost = InetAddress.getLoopbackAddress(); @@ -172,7 +175,7 @@ public class SSLSocketHostNameVerificationIntegrationTest { try { this.socketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), - sslEngine, 0, true, + sslEngine, 0, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); @@ -205,7 +208,6 @@ public class SSLSocketHostNameVerificationIntegrationTest { sc.handshakeSSLSocketChannel(socket.getChannel(), sslEngine, timeoutMillis, -false, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); } catch (Throwable throwable) { diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java index e7ac191..13e9d5b 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java @@ -217,7 +217,7 @@ public class SSLSocketIntegrationTest { clientSocket = clientChannel.socket(); NioSslEngine engine = clusterSocketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), -clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, true, +clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); clientChannel.configureBlocking(true); @@ -267,7 +267,6 @@ public class SSLSocketIntegrationTest { sc.handshakeSSLSocketChannel(socket.getChannel(), sc.createSSLEngine("localhost", 1234, false), timeoutMillis, -false, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt index af3bd1e..cd1af3a 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt @@ -104,4 +104,4 @@ org/apache/geode/cache/qu
[geode] branch support/1.12 updated (70f6955 -> 1a8eb5a)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git. from 70f6955 GEODE-9289: Configuration compatibile with pre-1.12.0 versions. (#6592) new bba4242 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor new 1a8eb5a GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../geode/internal/net/ByteBufferSharing.java | 15 + .../geode/internal/net/ByteBufferSharingNoOp.java | 7 +- ...ufferSharingImpl.java => ByteBufferVendor.java} | 144 ++--- .../apache/geode/internal/net/NioSslEngine.java| 56 ++-- .../apache/geode/internal/net/SocketCreator.java | 9 +- .../org/apache/geode/internal/tcp/Connection.java | 334 +++-- .../internal/net/ByteBufferConcurrencyTest.java| 16 +- ...ringImplTest.java => ByteBufferVendorTest.java} | 40 +-- .../geode/internal/net/NioSslEngineTest.java | 41 +-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 13 files changed, 375 insertions(+), 299 deletions(-) rename geode-core/src/main/java/org/apache/geode/internal/net/{ByteBufferSharingImpl.java => ByteBufferVendor.java} (53%) rename geode-core/src/test/java/org/apache/geode/internal/net/{ByteBufferSharingImplTest.java => ByteBufferVendorTest.java} (84%)
[geode] 01/02: GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git commit bba424244b8011daf4e7d1285334ad91ce4497fe Author: Bill Burcham AuthorDate: Sat Apr 17 13:15:53 2021 -0700 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor (cherry picked from commit 38a3540583a1d0a402b026ee0d33ae4b0a2907d3) (cherry picked from commit e0fa01dd9ec9c61504d517e77d1620f8e7975b73) --- .../apache/geode/internal/net/ByteBufferSharingNoOp.java | 2 +- ...{ByteBufferSharingImpl.java => ByteBufferVendor.java} | 6 +++--- .../java/org/apache/geode/internal/net/NioSslEngine.java | 10 +- .../geode/internal/net/ByteBufferConcurrencyTest.java| 16 ...ferSharingImplTest.java => ByteBufferVendorTest.java} | 6 +++--- .../org/apache/geode/internal/net/NioSslEngineTest.java | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java index bd707e3..4a8bc49 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java @@ -27,7 +27,7 @@ import java.nio.ByteBuffer; * meant for use with the {@link NioPlainEngine} only, since that engine keeps no buffers and so, * needs no reference counting on buffers, nor any synchronization around access to buffers. * - * See also {@link ByteBufferSharingImpl} + * See also {@link ByteBufferVendor} */ class ByteBufferSharingNoOp implements ByteBufferSharing { diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java similarity index 96% rename from geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java rename to geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java index b083d09..4933247 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java @@ -31,7 +31,7 @@ import org.apache.geode.internal.net.BufferPool.BufferType; * {@link ByteBuffer}) is available (for reading and modification) in the scope of the * try-with-resources. */ -class ByteBufferSharingImpl implements ByteBufferSharing { +class ByteBufferVendor implements ByteBufferSharing { static class OpenAttemptTimedOut extends Exception { } @@ -53,8 +53,8 @@ class ByteBufferSharingImpl implements ByteBufferSharing { * This constructor acquires no lock. The reference count will be 1 after this constructor * completes. */ - ByteBufferSharingImpl(final ByteBuffer buffer, final BufferType bufferType, - final BufferPool bufferPool) { + ByteBufferVendor(final ByteBuffer buffer, final BufferType bufferType, + final BufferPool bufferPool) { this.buffer = buffer; this.bufferType = bufferType; this.bufferPool = bufferPool; diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java index 8969ecc..fc91a31 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java @@ -42,7 +42,7 @@ import org.apache.logging.log4j.Logger; import org.apache.geode.GemFireIOException; import org.apache.geode.annotations.VisibleForTesting; import org.apache.geode.internal.net.BufferPool.BufferType; -import org.apache.geode.internal.net.ByteBufferSharingImpl.OpenAttemptTimedOut; +import org.apache.geode.internal.net.ByteBufferVendor.OpenAttemptTimedOut; import org.apache.geode.logging.internal.log4j.api.LogService; @@ -62,12 +62,12 @@ public class NioSslEngine implements NioFilter { /** * holds bytes wrapped by the SSLEngine; a.k.a. myNetData */ - private final ByteBufferSharingImpl outputSharing; + private final ByteBufferVendor outputSharing; /** * holds the last unwrapped data from a peer; a.k.a. peerAppData */ - private final ByteBufferSharingImpl inputSharing; + private final ByteBufferVendor inputSharing; NioSslEngine(SSLEngine engine, BufferPool bufferPool) { SSLSession session = engine.getSession(); @@ -77,10 +77,10 @@ public class NioSslEngine implements NioFilter { this.engine = engine; this.bufferPool = bufferPool; outputSharing = -new ByteBufferSharingImpl(bufferPool.acquireDirectSenderBuffer(packetBufferSize), +new ByteBufferVendor(bufferPool.acquireDirectSenderBuffer(packetBufferSize), TRACKED_SENDER, buff
[geode] branch feature/backport-GEODE-9180-1-13 created (now a3036ff)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch feature/backport-GEODE-9180-1-13 in repository https://gitbox.apache.org/repos/asf/geode.git. at a3036ff GEODE-9180: warn when heartbeat thread oversleeps (#6360) This branch includes the following new commits: new a3036ff GEODE-9180: warn when heartbeat thread oversleeps (#6360) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode] 01/01: GEODE-9180: warn when heartbeat thread oversleeps (#6360)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch feature/backport-GEODE-9180-1-13 in repository https://gitbox.apache.org/repos/asf/geode.git commit a3036ffb5c79a3ea6def7600efd519b8206aa16c Author: Bill Burcham AuthorDate: Wed Apr 28 10:22:16 2021 -0700 GEODE-9180: warn when heartbeat thread oversleeps (#6360) * heartbeat producer logs warning when it oversleeps by a period or more (cherry picked from commit f8b07a007ac93c323cd888cbc53dc3914336077f) --- .../gms/fd/GMSHealthMonitorJUnitTest.java | 47 + .../membership/gms/fd/GMSHealthMonitor.java| 190 - 2 files changed, 161 insertions(+), 76 deletions(-) diff --git a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java index 2aaf2f5..81e132a 100644 --- a/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java +++ b/geode-membership/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java @@ -48,6 +48,7 @@ import java.util.Timer; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import java.util.function.LongUnaryOperator; import org.junit.After; import org.junit.Assert; @@ -952,6 +953,52 @@ public class GMSHealthMonitorJUnitTest { executeTestDoTCPCheck(GMSHealthMonitor.ERROR + 100, false); } + @Test + public void heartbeatOversleepCausesWarning() { +testHeartbeatSleepScenario(sleepLimit -> sleepLimit + 1, +"Failure detection heartbeat-generation thread overslept by more than a full period. Asleep time: 1,000,000,001 nanoseconds. Period: 500,000,000 nanoseconds."); + } + + @Test + public void heartbeatOnTimeWakeupCausesNoWarning() { +testHeartbeatSleepScenario(sleepLimit -> sleepLimit, +null); + } + + private void testHeartbeatSleepScenario(final LongUnaryOperator actualSleepPeriod, + final String expectedLogWarning) { + +/* + * Creating a class here because it's a convenient to provide (mutable) variables needed + * by the lambdas. Without the class, each of them would have to be arrays or atomics + * or some other kind of "holder object". By creating a class they can simply be fields. + */ +new Runnable() { + // the thing we're testing + final GMSHealthMonitor.Heart heart = gmsHealthMonitor.new Heart(); + int periodNumber = 0; // index into times + String capturedMessage; // warning message (if any) generated by heart + + @Override + public void run() { +heart.sendPeriodicHeartbeats(sleepMillis -> { +}, +() -> { + switch (periodNumber++) { +case 0: + return 0L; +case 1: +default: + gmsHealthMonitor.stop(); + return actualSleepPeriod.applyAsLong(heart.sleepLimitNanos); + } +}, +msg -> capturedMessage = msg); +assertThat(capturedMessage).isEqualTo(expectedLogWarning); + } +}.run(); + } + private void executeTestDoTCPCheck(int receivedStatus, boolean expectedResult) throws Exception { MemberIdentifier otherMember = createGMSMember(Version.CURRENT_ORDINAL, 0, 1, 1); diff --git a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java index 2590e23..7457557 100644 --- a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java +++ b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitor.java @@ -750,82 +750,7 @@ public class GMSHealthMonitor implements HealthMoni * process */ private void startHeartbeatThread() { -checkExecutor.execute(new Runnable() { - @Override - public void run() { -Thread.currentThread().setName("Geode Heartbeat Sender"); -sendPeriodicHeartbeats(); - } - - private void sendPeriodicHeartbeats() { -while (!isStopping && !services.getCancelCriterion().isCancelInProgress()) { - try { -Thread.sleep(memberTimeout / LOGICAL_INTERVAL); - } catch (InterruptedException e) { -return; - } - GMSMembershipView v = currentView; - if (v != null) { -List mbrs = v.getMembers(); -int index = mbrs.indexOf(localAd
[geode] 01/02: GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch features/back-port-geode-9141-to-1-13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 79c1abb6c54262387bebda264b6d806b39edd17a Author: Bill Burcham AuthorDate: Sat Apr 17 13:15:53 2021 -0700 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor (cherry picked from commit 38a3540583a1d0a402b026ee0d33ae4b0a2907d3) (cherry picked from commit e0fa01dd9ec9c61504d517e77d1620f8e7975b73) --- .../apache/geode/internal/net/ByteBufferSharingNoOp.java | 2 +- ...{ByteBufferSharingImpl.java => ByteBufferVendor.java} | 6 +++--- .../java/org/apache/geode/internal/net/NioSslEngine.java | 10 +- .../geode/internal/net/ByteBufferConcurrencyTest.java| 16 ...ferSharingImplTest.java => ByteBufferVendorTest.java} | 6 +++--- .../org/apache/geode/internal/net/NioSslEngineTest.java | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java index bd707e3..4a8bc49 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java @@ -27,7 +27,7 @@ import java.nio.ByteBuffer; * meant for use with the {@link NioPlainEngine} only, since that engine keeps no buffers and so, * needs no reference counting on buffers, nor any synchronization around access to buffers. * - * See also {@link ByteBufferSharingImpl} + * See also {@link ByteBufferVendor} */ class ByteBufferSharingNoOp implements ByteBufferSharing { diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java similarity index 96% rename from geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java rename to geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java index b083d09..4933247 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferVendor.java @@ -31,7 +31,7 @@ import org.apache.geode.internal.net.BufferPool.BufferType; * {@link ByteBuffer}) is available (for reading and modification) in the scope of the * try-with-resources. */ -class ByteBufferSharingImpl implements ByteBufferSharing { +class ByteBufferVendor implements ByteBufferSharing { static class OpenAttemptTimedOut extends Exception { } @@ -53,8 +53,8 @@ class ByteBufferSharingImpl implements ByteBufferSharing { * This constructor acquires no lock. The reference count will be 1 after this constructor * completes. */ - ByteBufferSharingImpl(final ByteBuffer buffer, final BufferType bufferType, - final BufferPool bufferPool) { + ByteBufferVendor(final ByteBuffer buffer, final BufferType bufferType, + final BufferPool bufferPool) { this.buffer = buffer; this.bufferType = bufferType; this.bufferPool = bufferPool; diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java index 8969ecc..fc91a31 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java @@ -42,7 +42,7 @@ import org.apache.logging.log4j.Logger; import org.apache.geode.GemFireIOException; import org.apache.geode.annotations.VisibleForTesting; import org.apache.geode.internal.net.BufferPool.BufferType; -import org.apache.geode.internal.net.ByteBufferSharingImpl.OpenAttemptTimedOut; +import org.apache.geode.internal.net.ByteBufferVendor.OpenAttemptTimedOut; import org.apache.geode.logging.internal.log4j.api.LogService; @@ -62,12 +62,12 @@ public class NioSslEngine implements NioFilter { /** * holds bytes wrapped by the SSLEngine; a.k.a. myNetData */ - private final ByteBufferSharingImpl outputSharing; + private final ByteBufferVendor outputSharing; /** * holds the last unwrapped data from a peer; a.k.a. peerAppData */ - private final ByteBufferSharingImpl inputSharing; + private final ByteBufferVendor inputSharing; NioSslEngine(SSLEngine engine, BufferPool bufferPool) { SSLSession session = engine.getSession(); @@ -77,10 +77,10 @@ public class NioSslEngine implements NioFilter { this.engine = engine; this.bufferPool = bufferPool; outputSharing = -new ByteBufferSharingImpl(bufferPool.acquireDirectSenderBuffer(packetBufferSize), +new ByteBufferVendor(bufferPool.acquireDirectSenderBuffer(packetBufferSize), TRACKED_
[geode] branch features/back-port-geode-9141-to-1-13 created (now c4730de)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch features/back-port-geode-9141-to-1-13 in repository https://gitbox.apache.org/repos/asf/geode.git. at c4730de GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished This branch includes the following new commits: new 79c1abb GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor new c4730de GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode] 02/02: GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch features/back-port-geode-9141-to-1-13 in repository https://gitbox.apache.org/repos/asf/geode.git commit c4730deed48bb4513bd04486d4e8c09cdd3bb5a9 Author: Bill Burcham AuthorDate: Sat Apr 17 09:12:13 2021 -0700 GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished (cherry picked from commit 9d0d4d1d33794d0f6a21c3bcae71e965cbbd7fbd) (cherry picked from commit 9e8b3972fcf449eed4d41c254cf3f553e517eaa1) --- ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../geode/internal/net/ByteBufferSharing.java | 15 ++ .../geode/internal/net/ByteBufferSharingNoOp.java | 5 + .../geode/internal/net/ByteBufferVendor.java | 144 ++ .../apache/geode/internal/net/NioSslEngine.java| 50 ++-- .../apache/geode/internal/net/SocketCreator.java | 5 +- .../org/apache/geode/internal/tcp/Connection.java | 299 ++--- .../geode/internal/net/ByteBufferVendorTest.java | 36 +-- .../geode/internal/net/NioSslEngineTest.java | 41 +-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 12 files changed, 340 insertions(+), 267 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java index a70f3b1..e86bfea 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java @@ -103,6 +103,9 @@ public class SSLSocketHostNameVerificationIntegrationTest { @Before public void setUp() throws Exception { + +SocketCreatorFactory.close(); // to clear socket creators made in previous tests + IgnoredException.addIgnoredException("javax.net.ssl.SSLException: Read timed out"); this.localHost = InetAddress.getLoopbackAddress(); @@ -172,7 +175,7 @@ public class SSLSocketHostNameVerificationIntegrationTest { try { this.socketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), - sslEngine, 0, true, + sslEngine, 0, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); @@ -205,7 +208,6 @@ public class SSLSocketHostNameVerificationIntegrationTest { sc.handshakeSSLSocketChannel(socket.getChannel(), sslEngine, timeoutMillis, -false, ByteBuffer.allocate(sslEngine.getSession().getPacketBufferSize()), new BufferPool(mock(DMStats.class))); } catch (Throwable throwable) { diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java index add6b9a..5415f4e 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java @@ -227,7 +227,7 @@ public class SSLSocketIntegrationTest { clientSocket = clientChannel.socket(); NioSslEngine engine = clusterSocketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), -clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, true, +clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); clientChannel.configureBlocking(true); @@ -279,7 +279,6 @@ public class SSLSocketIntegrationTest { engine = sc.handshakeSSLSocketChannel(socket.getChannel(), sslEngine, timeoutMillis, -false, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); final List serverNames = sslEngine.getSSLParameters().getServerNames(); diff --git a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt index 33f43c3..a96907f 100644 --- a/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt +++ b/geode-core/src/integrationTest/resources/org/apache/geode/codeAnalysis/excludedClasses.txt @@ -104,4 +104,4 @@ org/apache/geode/cache/query/intern
[geode] branch develop updated (f8b07a0 -> 9d0d4d1)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from f8b07a0 GEODE-9180: warn when heartbeat thread oversleeps (#6360) add 38a3540 GEODE-9141: (1 of 2) rename ByteBufferSharingImpl to ByteBuferVendor add 9d0d4d1 GEODE-9141: (2 of 2) Handle in-buffer concurrency * Connection uses a ByteBufferVendor to mediate access to inputBuffer * Prevent return to pool before socket closer is finished No new revisions were added by this update. Summary of changes: ...LSocketHostNameVerificationIntegrationTest.java | 6 +- .../internal/net/SSLSocketIntegrationTest.java | 3 +- .../apache/geode/codeAnalysis/excludedClasses.txt | 2 +- .../org/apache/geode/internal/net/BufferPool.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 15 ++ .../geode/internal/net/ByteBufferSharingNoOp.java | 7 +- ...ufferSharingImpl.java => ByteBufferVendor.java} | 146 .../apache/geode/internal/net/NioSslEngine.java| 56 +++-- .../apache/geode/internal/net/SocketCreator.java | 5 +- .../org/apache/geode/internal/tcp/Connection.java | 250 ++--- .../internal/net/ByteBufferConcurrencyTest.java| 16 +- ...ringImplTest.java => ByteBufferVendorTest.java} | 40 ++-- .../geode/internal/net/NioSslEngineTest.java | 41 ++-- .../apache/geode/internal/tcp/ConnectionTest.java | 1 + 14 files changed, 334 insertions(+), 258 deletions(-) rename geode-core/src/main/java/org/apache/geode/internal/net/{ByteBufferSharingImpl.java => ByteBufferVendor.java} (53%) rename geode-core/src/test/java/org/apache/geode/internal/net/{ByteBufferSharingImplTest.java => ByteBufferVendorTest.java} (84%)
[geode] branch develop updated (b18836c -> f8b07a0)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from b18836c GEODE-9163: Mark docs for apis compatible with Redis as experimental (#6374) add f8b07a0 GEODE-9180: warn when heartbeat thread oversleeps (#6360) No new revisions were added by this update. Summary of changes: .../gms/fd/GMSHealthMonitorJUnitTest.java | 47 + .../membership/gms/fd/GMSHealthMonitor.java| 190 - 2 files changed, 161 insertions(+), 76 deletions(-)
[geode] 01/02: GEODE-7245: Remove most uses of latestViewReadLock in GMSMembership (#6037)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git commit ff947f1328f87ec8a8f4a914aea80f3d59eaef59 Author: Kamilla Aslami AuthorDate: Tue Mar 2 11:50:00 2021 -0600 GEODE-7245: Remove most uses of latestViewReadLock in GMSMembership (#6037) * Remove most uses of latestViewReadLock in GMSMembership * make MembershipView immutable * Constructor consolidation and better naming of add/remove * Tighten constructor chaining Co-authored-by: Bill Burcham (cherry picked from commit 477ffba8e155dca0bdeeefd312b6b32b4b481100) --- .../internal/membership/api/MembershipView.java| 147 +++--- .../internal/membership/gms/GMSMembership.java | 313 - 2 files changed, 164 insertions(+), 296 deletions(-) diff --git a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/MembershipView.java b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/MembershipView.java index 22a7691..902837c 100644 --- a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/MembershipView.java +++ b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/MembershipView.java @@ -14,75 +14,53 @@ */ package org.apache.geode.distributed.internal.membership.api; +import static java.util.stream.Collectors.toList; + import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.stream.Stream; /** - * The MembershipView class represents a membership view. MembershipViews are typically - * unmodifiable though you an create and manipulate one for local usel A MembershipView - * defines who is in the cluster and knows which node created the view. It also knows which - * members left or were removed when the view was created. MemberIdentifiers in the view - * are marked with the viewId of the MembershipView in which they joined the cluster. + * The MembershipView class represents a membership view. A MembershipView defines who is in the + * cluster and knows which node created the view. It also knows which members left or were removed + * when the view was created. MemberIdentifiers in the view are marked with the viewId of the + * MembershipView in which they joined the cluster. */ public class MembershipView { - private int viewId; - private List members; - private Set shutdownMembers; - private Set crashedMembers; - private ID creator; - private Set hashedMembers; - private volatile boolean unmodifiable; - + private final int viewId; + private final List members; + private final Set shutdownMembers; + private final Set crashedMembers; + private final ID creator; + private final Set hashedMembers; public MembershipView() { -viewId = -1; -members = new ArrayList<>(0); -this.hashedMembers = new HashSet<>(members); -shutdownMembers = Collections.emptySet(); -crashedMembers = new HashSet<>(); -creator = null; +this(null, -1, Collections.emptyList()); } - public MembershipView(ID creator, int viewId, - List members) { -this.viewId = viewId; -this.members = new ArrayList<>(members); -hashedMembers = new HashSet<>(this.members); -shutdownMembers = new HashSet<>(); -crashedMembers = Collections.emptySet(); -this.creator = creator; - } - - /** - * Create a new view with the contents of the given view and the specified view ID - */ - public MembershipView(MembershipView other, int viewId) { -this.creator = other.creator; -this.viewId = viewId; -this.members = new ArrayList<>(other.members); -this.hashedMembers = new HashSet<>(other.members); -this.shutdownMembers = new HashSet<>(other.shutdownMembers); -this.crashedMembers = new HashSet<>(other.crashedMembers); + public MembershipView(final ID creator, final int viewId, final List members) { +this(creator, viewId, members, Collections.emptySet(), Collections.emptySet()); } - public MembershipView(ID creator, int viewId, - List mbrs, Set shutdowns, - Set crashes) { + public MembershipView(final ID creator, final int viewId, final List members, + final Set shutdowns, final Set crashes) { this.creator = creator; this.viewId = viewId; -this.members = mbrs; -this.hashedMembers = new HashSet<>(mbrs); -this.shutdownMembers = shutdowns; -this.crashedMembers = crashes; - } - public void makeUnmodifiable() { -unmodifiable = true; +/* + * Copy each collection, then store the ref to the unmodifiable + * wrapper so we can expose it. + */ +this.members = Collections.unmodifiableList(new ArrayList<>(members
[geode] 02/02: GEODE-8972: remove shunnedMembers collection from GMSMembership (#6089)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git commit f274c73c105c51fe798ac0f50ef058ec1a939867 Author: Kamilla Aslami AuthorDate: Tue Mar 9 09:59:13 2021 -0600 GEODE-8972: remove shunnedMembers collection from GMSMembership (#6089) * GEODE-8972: remove shunnedMembers collection from GMSMembership * Changes after the code review (cherry picked from commit c2fc107bad1de221157072470e2a6ad426533f20) --- .../internal/membership/api/Membership.java| 7 - .../internal/membership/gms/GMSMembership.java | 168 ++--- 2 files changed, 12 insertions(+), 163 deletions(-) diff --git a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/Membership.java b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/Membership.java index 91583d2..dfaa045 100644 --- a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/Membership.java +++ b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/api/Membership.java @@ -243,13 +243,6 @@ public interface Membership { */ Throwable getShutdownCause(); - /** - * If this member is shunned, ensure that a warning is generated at least once. - * - * @param mbr the member that may be shunned - */ - void warnShun(ID mbr); - boolean addSurpriseMember(ID mbr); /** diff --git a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMembership.java b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMembership.java index 3c05988..a119c02 100644 --- a/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMembership.java +++ b/geode-membership/src/main/java/org/apache/geode/distributed/internal/membership/gms/GMSMembership.java @@ -258,19 +258,6 @@ public class GMSMembership implements Membership shunnedMembers = new ConcurrentHashMap<>(); - - /** * Members that have sent a shutdown message. This is used to suppress suspect processing that * otherwise becomes pretty aggressive when a member is shutting down. */ @@ -286,15 +273,6 @@ public class GMSMembership implements Membership shunnedAndWarnedMembers = - Collections.newSetFromMap(new ConcurrentHashMap<>()); - /** * The identities and birth-times of others that we have allowed into membership at the * distributed system level, but have not yet appeared in a view. * @@ -323,14 +301,6 @@ public class GMSMembership implements Membership suspectedMembers = new ConcurrentHashMap<>(); /** - * Length of time, in seconds, that a member is retained in the zombie set - * - * @see #shunnedMembers - */ - private static final int SHUNNED_SUNSET = Integer - .getInteger(GeodeGlossary.GEMFIRE_PREFIX + "shunned-member-timeout", 300).intValue(); - - /** * Set to true when the service should stop. */ private volatile boolean shutdownInProgress = false; @@ -442,14 +412,7 @@ public class GMSMembership implements Membership", m); @@ -646,11 +609,10 @@ public class GMSMembership implements Membership implements Membership implements Membership implements Membership", m); - } - /** * Logic for processing a distribution message. * @@ -874,9 +820,7 @@ public class GMSMembership implements Membership implements Membership", m); if (logger.isTraceEnabled()) { logger.trace("Membership: Ignoring message from shunned member <{}>:{}", m, msg); } @@ -1427,14 +1371,6 @@ public class GMSMembership implements Membership implements Membership now) { - return true; -} - -// Oh, it _is_ stale. Remove it while we're here. -endShun(m); -return false; +final MembershipView view = latestView; +return m.getVmViewId() <= view.getViewId() && !view.contains(m); } private boolean isShunnedOrNew(final ID m) { +final MembershipView view = latestView; +if (m.getVmViewId() <= view.getViewId() && view.contains(m)) { + return false; +} latestViewReadLock.lock(); try { - return shunnedMembers.containsKey(m) || isNew(m); + return isShunned(m) || isNew(m); } finally { // synchronized latestViewReadLock.unlock(); } @@ -1483,11 +1408,9 @@ public class GMSMembership implements Membership - * Unlike isShunned, this method will not cause expiry of a surprise member. That must be done + * This method will not cause expiry of a surprise member. That must be done * during view processing. * - * Like isShunned, this method holds the view lock while executing - * * Concurrency: protected by {@link #latestViewReadLock} * * @param m the member in
[geode] branch support/1.14 updated (e3653c8 -> f274c73)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git. from e3653c8 do more testing in parallel new ff947f1 GEODE-7245: Remove most uses of latestViewReadLock in GMSMembership (#6037) new f274c73 GEODE-8972: remove shunnedMembers collection from GMSMembership (#6089) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../internal/membership/api/Membership.java| 7 - .../internal/membership/api/MembershipView.java| 147 +++ .../internal/membership/gms/GMSMembership.java | 429 + 3 files changed, 150 insertions(+), 433 deletions(-)
[geode] branch master updated: GEODE-9012: Turn off Github Comments Causing Jira Ticket Comments (#6114)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/master by this push: new 93898a8 GEODE-9012: Turn off Github Comments Causing Jira Ticket Comments (#6114) 93898a8 is described below commit 93898a880738dd7be19604b35202cf938f67a0d6 Author: Bill Burcham AuthorDate: Wed Mar 10 14:39:14 2021 -0800 GEODE-9012: Turn off Github Comments Causing Jira Ticket Comments (#6114) --- .asf.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.asf.yaml b/.asf.yaml index 4368159..dcd55a6 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -54,4 +54,4 @@ notifications: commits: commits@geode.apache.org issues: iss...@geode.apache.org pullrequests: notificati...@geode.apache.org -jira_options: link label comment +jira_options: link label
[geode] branch develop updated (df7b5b1 -> cc5fb5b)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from df7b5b1 GEODE-8761: detect stuck server connection threads (#6094) add cc5fb5b GEODE-9012: turn off Github PR to Jira comment mirroring (#6103) No new revisions were added by this update. Summary of changes: .asf.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[geode] branch support/1.14 updated: GEODE-8920: Modify debug logging to make it easier to trace a message (#6041) (#6071)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.14 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.14 by this push: new bce7a19 GEODE-8920: Modify debug logging to make it easier to trace a message (#6041) (#6071) bce7a19 is described below commit bce7a19b55b51a8809e71c9a2c776eba31a4e92c Author: Kamilla Aslami AuthorDate: Tue Mar 2 11:58:09 2021 -0600 GEODE-8920: Modify debug logging to make it easier to trace a message (#6041) (#6071) (cherry picked from commit fc2fc9f890c5673bd6d0954048efb525b0098126) --- .../geode/distributed/internal/direct/DirectChannel.java | 10 +- .../main/java/org/apache/geode/internal/tcp/Connection.java| 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java index fc8800f..8f65c2d 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java @@ -211,7 +211,7 @@ public class DirectChannel { InternalDistributedMember[] p_destinations, final DistributionMessage msg, long ackWaitThreshold, long ackSAThreshold) throws ConnectExceptions, NotSerializableException { -InternalDistributedMember destinations[] = p_destinations; +InternalDistributedMember[] destinations = p_destinations; // Collects connect exceptions that happened during previous attempts to send. // These represent members we are not able to distribute to. @@ -276,7 +276,7 @@ public class DirectChannel { retryInfo = null; retry = true; } -final List cons = new ArrayList(destinations.length); +final List cons = new ArrayList<>(destinations.length); ConnectExceptions ce = getConnections(mgr, msg, destinations, orderedMsg, retry, ackTimeout, ackSDTimeout, cons); @@ -299,9 +299,9 @@ public class DirectChannel { return bytesWritten; } -if (retry && logger.isDebugEnabled()) { - logger.debug("Retrying send ({}{}) to {} peers ({}) via tcp/ip", - msg, cons.size(), cons); +if (logger.isDebugEnabled()) { + logger.debug("{} on these {} connections: {}", + (retry ? "Retrying send" : "Sending"), cons.size(), cons); } DMStats stats = getDMStats(); List sentCons; // used for cons we sent to this time diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java index 6d4c675..60c418e 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java +++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java @@ -3224,7 +3224,7 @@ public class Connection implements Runnable { private void setThreadName(int dominoNumber) { Thread.currentThread().setName(THREAD_KIND_IDENTIFIER + " for " + remoteAddr + " " + (sharedResource ? "" : "un") + "shared" + " " + (preserveOrder ? "" : "un") -+ "ordered" + " uid=" + uniqueId + (dominoNumber > 0 ? " dom #" + dominoNumber : "") ++ "ordered sender uid=" + uniqueId + (dominoNumber > 0 ? " dom #" + dominoNumber : "") + " local port=" + socket.getLocalPort() + " remote port=" + socket.getPort()); }
[geode] branch develop updated (39d2d2b -> 5b0cf7f)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 39d2d2b GEODE-8917: Revise gfsh export stack-traces docs (#6009) add 5b0cf7f GEODE-8901: Surviving side server forcefully disconnected after network drop (#5984) No new revisions were added by this update. Summary of changes: .../gms/fd/GMSHealthMonitorJUnitTest.java | 44 ++ .../gms/membership/GMSJoinLeaveJUnitTest.java | 25 .../membership/gms/fd/GMSHealthMonitor.java| 8 +++- .../membership/gms/interfaces/HealthMonitor.java | 12 ++ .../membership/gms/membership/GMSJoinLeave.java| 14 --- 5 files changed, 90 insertions(+), 13 deletions(-)
[geode] branch develop updated (010065e -> 1547f5f)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 010065e GEODE-8870: Removes GFE_6622. add 1547f5f GEODE-8882: Enable JetBrains NotNull Annotation (#5967) No new revisions were added by this update. Summary of changes: .../src/test/resources/expected-pom.xml| 6 ++ .../gradle/plugins/DependencyConstraints.groovy| 5 ++ geode-common/build.gradle | 1 - geode-core/build.gradle| 2 + .../cache/tier/sockets/SocketMessageWriter.java| 64 -- .../tier/sockets/SocketMessageWriterTest.java} | 16 -- 6 files changed, 58 insertions(+), 36 deletions(-) copy geode-core/src/{main/java/org/apache/geode/internal/cache/tier/sockets/MessageTooLargeException.java => test/java/org/apache/geode/internal/cache/tier/sockets/SocketMessageWriterTest.java} (64%) mode change 100755 => 100644
[geode] branch support/1.12 updated: GEODE-8796: doc max-threads incompatible with TLS (#5860)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 6f1e56a GEODE-8796: doc max-threads incompatible with TLS (#5860) 6f1e56a is described below commit 6f1e56a1ab3ccf8d1a5a2d58121aac26dac16272 Author: Bill Burcham AuthorDate: Fri Dec 18 14:22:23 2020 -0800 GEODE-8796: doc max-threads incompatible with TLS (#5860) (cherry picked from commit 3e4db05c529bfff499b27d3decd0b7a368f9f9a0) --- geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb index 165257e..94e94a0 100644 --- a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb +++ b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb @@ -723,7 +723,7 @@ See Overview of \-\-max-threads -Sets the maximum number of threads allowed in this cache server to service client requests. The default of 0 causes the cache server to dedicate a thread for every client connection. +Sets the maximum number of threads allowed in this cache server to service client requests. The default of 0 causes the cache server to dedicate a thread for every client connection. When client-server TLS/SSL is configured, values other than the default are not supported. Â
[geode] branch support/1.13 updated: GEODE-8796: doc max-threads incompatible with TLS (#5860)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.13 by this push: new 0a6be20 GEODE-8796: doc max-threads incompatible with TLS (#5860) 0a6be20 is described below commit 0a6be203357e69aa727765a8c5205da13b1b2696 Author: Bill Burcham AuthorDate: Fri Dec 18 14:22:23 2020 -0800 GEODE-8796: doc max-threads incompatible with TLS (#5860) (cherry picked from commit 3e4db05c529bfff499b27d3decd0b7a368f9f9a0) --- geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb index 165257e..94e94a0 100644 --- a/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb +++ b/geode-docs/tools_modules/gfsh/command-pages/start.html.md.erb @@ -723,7 +723,7 @@ See Overview of \-\-max-threads -Sets the maximum number of threads allowed in this cache server to service client requests. The default of 0 causes the cache server to dedicate a thread for every client connection. +Sets the maximum number of threads allowed in this cache server to service client requests. The default of 0 causes the cache server to dedicate a thread for every client connection. When client-server TLS/SSL is configured, values other than the default are not supported. Â
[geode] branch develop updated: GEODE-8730: don't bind to ephemeral ports in test
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 4e206f0 GEODE-8730: don't bind to ephemeral ports in test 4e206f0 is described below commit 4e206f09df87d26fd22a3238596ac4bc12cf4846 Author: Bill Burcham AuthorDate: Thu Dec 3 12:27:14 2020 -0800 GEODE-8730: don't bind to ephemeral ports in test --- .../resources/org/apache/geode/client/sni/docker-compose.yml | 3 ++- .../acceptanceTest/resources/org/apache/geode/client/sni/haproxy.cfg | 4 ++-- .../org/apache/geode/client/sni/scripts/geode-starter-2.gfsh | 4 ++-- .../resources/org/apache/geode/client/sni/scripts/geode-starter.gfsh | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/docker-compose.yml b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/docker-compose.yml index dd52102..730d74d 100644 --- a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/docker-compose.yml +++ b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/docker-compose.yml @@ -22,7 +22,8 @@ services: hostname: geode expose: - '10334' - - '40404' + - '8501' + - '8502' entrypoint: 'sh' command: '-c /geode/scripts/forever' networks: diff --git a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/haproxy.cfg b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/haproxy.cfg index c451ef6..b77a1d5 100644 --- a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/haproxy.cfg +++ b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/haproxy.cfg @@ -37,8 +37,8 @@ backend locators-maeve backend servers-dolores mode tcp - server server1 geode:40404 + server server1 geode:8501 backend servers-clementine mode tcp - server server1 geode:40405 + server server1 geode:8502 diff --git a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter-2.gfsh b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter-2.gfsh index d640a77..5e6ad74 100644 --- a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter-2.gfsh +++ b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter-2.gfsh @@ -16,8 +16,8 @@ # start locator --name=locator-maeve --connect=false --redirect-output --hostname-for-clients=locator-maeve --properties-file=/geode/config/gemfire.properties --security-properties-file=/geode/config/gfsecurity.properties --J=-Dgemfire.ssl-keystore=/geode/config/locator-maeve-keystore.jks -start server --name=server-dolores --group=group-dolores --hostname-for-clients=server-dolores --locators=geode[10334] --properties-file=/geode/config/gemfire.properties --security-properties-file=/geode/config/gfsecurity.properties --J=-Dgemfire.ssl-keystore=/geode/config/server-dolores-keystore.jks -start server --name=server-clementine --group=group-clementine --hostname-for-clients=server-clementine --server-port=40405 --locators=geode[10334] --properties-file=/geode/config/gemfire.properties --security-properties-file=/geode/config/gfsecurity.properties --J=-Dgemfire.ssl-keystore=/geode/config/server-clementine-keystore.jks +start server --name=server-dolores --group=group-dolores --hostname-for-clients=server-dolores --server-port=8501 --locators=geode[10334] --properties-file=/geode/config/gemfire.properties --security-properties-file=/geode/config/gfsecurity.properties --J=-Dgemfire.ssl-keystore=/geode/config/server-dolores-keystore.jks +start server --name=server-clementine --group=group-clementine --hostname-for-clients=server-clementine --server-port=8502 --locators=geode[10334] --properties-file=/geode/config/gemfire.properties --security-properties-file=/geode/config/gfsecurity.properties --J=-Dgemfire.ssl-keystore=/geode/config/server-clementine-keystore.jks connect --locator=geode[10334] --use-ssl=true --security-properties-file=/geode/config/gfsecurity.properties create region --name=region-dolores --group=group-dolores --type=REPLICATE create region --name=region-clementine --group=group-clementine --type=REPLICATE diff --git a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter.gfsh b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter.gfsh index bd89a37..a9a9685 100644 --- a/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter.gfsh +++ b/geode-assembly/src/acceptanceTest/resources/org/apache/geode/client/sni/scripts/geode-starter.gfsh @@ -16,7 +16,7
[geode] branch support/1.12 updated: GEODE-8419: SSL/TLS protocol and cipher suite configuration is ignored (#5465)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new a6f3ea2 GEODE-8419: SSL/TLS protocol and cipher suite configuration is ignored (#5465) a6f3ea2 is described below commit a6f3ea2f47b5d22410c96293794f62440b79edf4 Author: Bill Burcham AuthorDate: Fri Oct 2 15:22:08 2020 -0700 GEODE-8419: SSL/TLS protocol and cipher suite configuration is ignored (#5465) Configure cipher suites when creating an SSLEngine (cherry picked from commit 537721ff815cf40eff85fde65db9b5e787471c89) --- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 5 +- .../apache/geode/internal/net/SocketCreator.java | 136 + .../org/apache/geode/internal/tcp/Connection.java | 3 +- .../geode/internal/net/SocketCreatorJUnitTest.java | 56 + 5 files changed, 176 insertions(+), 28 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java index 91e5f55..a70f3b1 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketHostNameVerificationIntegrationTest.java @@ -168,7 +168,7 @@ public class SSLSocketHostNameVerificationIntegrationTest { this.clientSocket = clientChannel.socket(); SSLEngine sslEngine = -this.socketCreator.createSSLEngine(this.localHost.getHostName(), 1234); +this.socketCreator.createSSLEngine(this.localHost.getHostName(), 1234, true); try { this.socketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), @@ -200,7 +200,7 @@ public class SSLSocketHostNameVerificationIntegrationTest { try { socket = serverSocket.accept(); SocketCreator sc = SocketCreatorFactory.getSocketCreatorForComponent(CLUSTER); -final SSLEngine sslEngine = sc.createSSLEngine(this.localHost.getHostName(), 1234); +final SSLEngine sslEngine = sc.createSSLEngine(this.localHost.getHostName(), 1234, false); engine = sc.handshakeSSLSocketChannel(socket.getChannel(), sslEngine, diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java index 7a3759b..e7ac191 100755 --- a/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java @@ -217,7 +217,7 @@ public class SSLSocketIntegrationTest { clientSocket = clientChannel.socket(); NioSslEngine engine = clusterSocketCreator.handshakeSSLSocketChannel(clientSocket.getChannel(), -clusterSocketCreator.createSSLEngine("localhost", 1234), 0, true, +clusterSocketCreator.createSSLEngine("localhost", 1234, true), 0, true, ByteBuffer.allocate(65535), new BufferPool(mock(DMStats.class))); clientChannel.configureBlocking(true); @@ -264,7 +264,8 @@ public class SSLSocketIntegrationTest { socket = serverSocket.accept(); SocketCreator sc = SocketCreatorFactory.getSocketCreatorForComponent(CLUSTER); engine = -sc.handshakeSSLSocketChannel(socket.getChannel(), sc.createSSLEngine("localhost", 1234), +sc.handshakeSSLSocketChannel(socket.getChannel(), sc.createSSLEngine("localhost", 1234, +false), timeoutMillis, false, ByteBuffer.allocate(65535), diff --git a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java index 427e758..a232fca 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java +++ b/geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java @@ -38,6 +38,8 @@ import java.security.PrivateKey; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Properties; @@ -47,6 +49,8 @@ import javax.net.ServerSocketFactory; import javax.net.SocketFactory; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SNIHostName; +imp
[geode] branch feature/GEODE-8419-backport updated (524dd58 -> 467ee63)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch feature/GEODE-8419-backport in repository https://gitbox.apache.org/repos/asf/geode.git. discard 524dd58 GEODE-8419: backported forward add ee4ff0e GEODE-8432: use regionPath directly instead of getRegion when put eve… (#5464) add 9c22643 GEODE-8475: Resolve a potential dead lock in ParallelGatewaySenderQueue (#5492) add 2ccaf7b GEODE-8584: Message transmission fails with IllegalStateException in socket i/o code (#5605) add 21d77a8 GEODE-8608: StateFlush could hang when the target member is shutdown (#5624) add 65e20b5 GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) add 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) add 5f14c41 Bump jetty from 9.4.21.v20190926 to 9.4.33.v20201020 add 43f4890 GEODE-8496: fix rest management test after dependency bump (#5547) add 4060542 Revert "GEODE-8682: Bump jetty from 9.4.21.v20190926 to 9.4.33.v20201020" add bec4704 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" add 798a245 GEODE-7727: modify sender thread to detect relese of connection (#4751) add 9b2aea9 GEODE-8603: Potentially expand classes identified for CI stressing to include subclasses (#5601) (#5674) add 7f8f882 GEODE-8681: peer-to-peer message loss due to sending connection closing with TLS enabled (#5699) add 3660bb5 Update NioSslEngineTest.java add f80d41a GEODE-8681: peer-to-peer message loss due to sending connection closing with TLS enabled (#5699) (#5714) add 3a89ae5 GEODE-6008: CI Failure: ClientServerHostNameVerificationDistributedTe… (#4839) add 68b8559 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) add d682b66 GEODE-8261: Added a null check for the proxyID. (#5251) add e3ea0ad GEODE-8536: Allow limited retries when creating Lucene IndexWriter (#5659) add 7ef6802 GEODE-8686: Prevent potential deadlock during GII and tombstone GC (#5707) add 6fec62f GEODE-7884: server hangs due to IllegalStateException (#4822) add b027331 GEODE-8607: Adding some test API to get oldest tombstone (#5623) (#5733) add 741b0b4 GEODE-8682: Bump jetty from 9.4.21.v20190926 to 9.4.33.v20201020 add 3d92903 GEODE-8718: Bump shiro from 1.6.0 to 1.7.0 add ed4644f [GEODE-8661] Use version provided by *-builder-image-family. (#5681) add c9795c3 Update exmples CI to use the builder_image (#5685) add 080c45d cache 1.12 dependencies (not develop) for 1.12 images add 1d0cd58 GEODE-8725: Bump jetty from 9.4.33.v20201020 to 9.4.34.v20201102 add 467ee63 GEODE-8419: SSL/TLS protocol and cipher suite configuration is ignored (#5465) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (524dd58) \ N -- N -- N refs/heads/feature/GEODE-8419-backport (467ee63) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../src/test/resources/expected-pom.xml| 6 +- build.gradle | 29 ++ .../gradle/plugins/DependencyConstraints.groovy| 4 +- ci/docker/cache_dependencies.sh| 2 +- .../scripts/cache_dependencies.sh | 2 +- ci/pipelines/examples/jinja.template.yml | 2 + ci/pipelines/geode-build/jinja.template.yml| 8 +- ci/pipelines/pull-request/jinja.template.yml | 4 + ci/pipelines/shared/jinja.variables.yml| 2 +- ci/scripts/create_instance.sh | 9 +- ci/scripts/repeat-new-tests.sh | 54 ++- .../rest/ListIndexManagementDUnitTest.java | 3 +- .../session/tests/GenericAppServerInstall.java | 2 +- .../integrationTest/resources/assembly_content.txt | 34 +- .../resources/dependency_classpath.txt | 34 +- .../geode/ClusterCommunicationsDUnitTest.java | 85 +++- ...tServerHostNameVerificationDistributedTest.java | 4 + .../ClusterDistributionManagerDUnitTest.java | 30 ++ .../cache/versions/TombstoneDUnitTest.java | 290 ++--- .../geode/internal/tcp/CloseConnectionTest.java| 89 .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 ++ .../geode/intern
[geode] branch support/1.12 updated: GEODE-7884: server hangs due to IllegalStateException (#4822)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 6fec62f GEODE-7884: server hangs due to IllegalStateException (#4822) 6fec62f is described below commit 6fec62ff7b4b6ebc4f0f8079fcd67a2b0c3919b0 Author: Bruce Schuchardt AuthorDate: Fri Mar 20 09:05:24 2020 -0700 GEODE-7884: server hangs due to IllegalStateException (#4822) * GEODE-7884: server hangs due to IllegalStateException Added cancellation check before scheduling an idle-timeout or ack-wait-threshold timer task. I had to add a new method to SystemTimerTask and then noticed there were no tests for SystemTimer, so I cleaned up that class and added tests. * adding missing copyright header to new test * fixing LGTM issues * reinstating 'continue' when encountering a null timer during a sweep * addressing Bill's comments renamed swarm everwhere made the collection of timers associated with a DistributedSystem into a Set made timer task variables in Connection volatile added checks in tasks to cancel themselves if their Connection is closed (cherry picked from commit 2d2a3f80bd5053749963889c1898df48e9aa0be7) --- .../internal/InternalDistributedSystem.java| 2 +- .../org/apache/geode/internal/SystemTimer.java | 370 +++-- .../geode/internal/admin/StatAlertsManager.java| 2 +- .../geode/internal/cache/ExpirationScheduler.java | 2 +- .../geode/internal/cache/GemFireCacheImpl.java | 2 +- .../cache/partitioned/PRSanityCheckMessage.java| 2 +- .../internal/cache/tier/sockets/AcceptorImpl.java | 2 +- .../org/apache/geode/internal/tcp/Connection.java | 30 +- .../apache/geode/internal/tcp/ConnectionTable.java | 22 +- .../org/apache/geode/internal/SystemTimerTest.java | 162 + 10 files changed, 329 insertions(+), 267 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java index 823844f..e97bd02 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java @@ -1625,7 +1625,7 @@ public class InternalDistributedSystem extends DistributedSystem // bug 38501: this has to happen *after* // the DM is closed :-( if (!preparingForReconnect) { -SystemTimer.cancelSwarm(this); +SystemTimer.cancelTimers(this); } } // finally timer cancelled } // finally dm closed diff --git a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java index 9ce3525..7eddf43 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java +++ b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java @@ -15,32 +15,30 @@ package org.apache.geode.internal; import java.lang.ref.WeakReference; -import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.Timer; import java.util.TimerTask; import org.apache.logging.log4j.Logger; import org.apache.geode.CancelException; -import org.apache.geode.SystemFailure; import org.apache.geode.annotations.internal.MakeNotStatic; -import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.DistributedSystem; import org.apache.geode.logging.internal.log4j.api.LogService; /** - * Instances of this class are like {@link Timer}, but are associated with a "swarm", which can be - * cancelled as a group with {@link #cancelSwarm(Object)}. + * Instances of this class are like {@link Timer}, but are associated with a DistributedSystem, + * which can be + * cancelled as a group with {@link #cancelTimers(DistributedSystem)}. * * @see Timer * @see TimerTask * - * TODO -- with Java 1.5, this will be a template type so that the swarm's class can be - * specified. */ public class SystemTimer { private static final Logger logger = LogService.getLogger(); @@ -49,12 +47,6 @@ public class SystemTimer { "IBM Corporation".equals(System.getProperty("java.vm.vendor")); /** - * Extra debugging for this class - */ - // private static final boolean DEBUG = true; - static final boolean DEBUG = false; - - /** * the underlying {@link Timer} */ private final Timer timer; @@ -62,119 +54,1
[geode] branch support/1.12 updated: GEODE-7884: server hangs due to IllegalStateException (#4822)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 6fec62f GEODE-7884: server hangs due to IllegalStateException (#4822) 6fec62f is described below commit 6fec62ff7b4b6ebc4f0f8079fcd67a2b0c3919b0 Author: Bruce Schuchardt AuthorDate: Fri Mar 20 09:05:24 2020 -0700 GEODE-7884: server hangs due to IllegalStateException (#4822) * GEODE-7884: server hangs due to IllegalStateException Added cancellation check before scheduling an idle-timeout or ack-wait-threshold timer task. I had to add a new method to SystemTimerTask and then noticed there were no tests for SystemTimer, so I cleaned up that class and added tests. * adding missing copyright header to new test * fixing LGTM issues * reinstating 'continue' when encountering a null timer during a sweep * addressing Bill's comments renamed swarm everwhere made the collection of timers associated with a DistributedSystem into a Set made timer task variables in Connection volatile added checks in tasks to cancel themselves if their Connection is closed (cherry picked from commit 2d2a3f80bd5053749963889c1898df48e9aa0be7) --- .../internal/InternalDistributedSystem.java| 2 +- .../org/apache/geode/internal/SystemTimer.java | 370 +++-- .../geode/internal/admin/StatAlertsManager.java| 2 +- .../geode/internal/cache/ExpirationScheduler.java | 2 +- .../geode/internal/cache/GemFireCacheImpl.java | 2 +- .../cache/partitioned/PRSanityCheckMessage.java| 2 +- .../internal/cache/tier/sockets/AcceptorImpl.java | 2 +- .../org/apache/geode/internal/tcp/Connection.java | 30 +- .../apache/geode/internal/tcp/ConnectionTable.java | 22 +- .../org/apache/geode/internal/SystemTimerTest.java | 162 + 10 files changed, 329 insertions(+), 267 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java index 823844f..e97bd02 100644 --- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java +++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java @@ -1625,7 +1625,7 @@ public class InternalDistributedSystem extends DistributedSystem // bug 38501: this has to happen *after* // the DM is closed :-( if (!preparingForReconnect) { -SystemTimer.cancelSwarm(this); +SystemTimer.cancelTimers(this); } } // finally timer cancelled } // finally dm closed diff --git a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java index 9ce3525..7eddf43 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java +++ b/geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java @@ -15,32 +15,30 @@ package org.apache.geode.internal; import java.lang.ref.WeakReference; -import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Set; import java.util.Timer; import java.util.TimerTask; import org.apache.logging.log4j.Logger; import org.apache.geode.CancelException; -import org.apache.geode.SystemFailure; import org.apache.geode.annotations.internal.MakeNotStatic; -import org.apache.geode.distributed.internal.InternalDistributedSystem; +import org.apache.geode.distributed.DistributedSystem; import org.apache.geode.logging.internal.log4j.api.LogService; /** - * Instances of this class are like {@link Timer}, but are associated with a "swarm", which can be - * cancelled as a group with {@link #cancelSwarm(Object)}. + * Instances of this class are like {@link Timer}, but are associated with a DistributedSystem, + * which can be + * cancelled as a group with {@link #cancelTimers(DistributedSystem)}. * * @see Timer * @see TimerTask * - * TODO -- with Java 1.5, this will be a template type so that the swarm's class can be - * specified. */ public class SystemTimer { private static final Logger logger = LogService.getLogger(); @@ -49,12 +47,6 @@ public class SystemTimer { "IBM Corporation".equals(System.getProperty("java.vm.vendor")); /** - * Extra debugging for this class - */ - // private static final boolean DEBUG = true; - static final boolean DEBUG = false; - - /** * the underlying {@link Timer} */ private final Timer timer; @@ -62,119 +54,1
[geode] branch support/1.12 updated: * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 68b8559 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) 68b8559 is described below commit 68b8559ef149acaee9b4f7846683d28cefff76f8 Author: Bill Burcham AuthorDate: Thu Nov 5 17:30:29 2020 -0800 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. - Added a new unit test, and a new concurrency test for ByteBufferSharingImpl: both ensure that ByteBuffers are returned to the pool exactly once. Added a new DUnit test for the interaction between ByteBufferSharingImpl and NioSslEngine and Connection. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt Co-authored-by: Dan Smith (cherry picked from commit af267c005a63317cbb8528cdb38eccf6a8747818) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 +++ .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 369 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 440 +++-- 17 files changed, 1428 insertions(+), 489 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEA
[geode] branch support/1.12 updated: * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 68b8559 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) 68b8559 is described below commit 68b8559ef149acaee9b4f7846683d28cefff76f8 Author: Bill Burcham AuthorDate: Thu Nov 5 17:30:29 2020 -0800 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. - Added a new unit test, and a new concurrency test for ByteBufferSharingImpl: both ensure that ByteBuffers are returned to the pool exactly once. Added a new DUnit test for the interaction between ByteBufferSharingImpl and NioSslEngine and Connection. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt Co-authored-by: Dan Smith (cherry picked from commit af267c005a63317cbb8528cdb38eccf6a8747818) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 +++ .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 369 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 440 +++-- 17 files changed, 1428 insertions(+), 489 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEA
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit d70cd816ff183033b059198c9db8302c76a7af65 Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List value = uncheckedCast(rawList); + +
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 8fb7f6c7db9ef2ec0ff8b618a578738e1426d801 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBl
[geode] 03/03: * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 32a8a55df4c0a5b8b1e5cfb746070804cbce5e0a Author: Bill Burcham AuthorDate: Thu Nov 5 17:30:29 2020 -0800 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. - Added a new unit test, and a new concurrency test for ByteBufferSharingImpl: both ensure that ByteBuffers are returned to the pool exactly once. Added a new DUnit test for the interaction between ByteBufferSharingImpl and NioSslEngine and Connection. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt Co-authored-by: Dan Smith (cherry picked from commit af267c005a63317cbb8528cdb38eccf6a8747818) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 365 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 432 +++-- 17 files changed, 1422 insertions(+), 486 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationPropertie
[geode] branch support/1.13 updated (4cedf9f -> 32a8a55)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 4cedf9f [BACKPORT] GEODE-8681: peer-to-peer message loss due to sending connection closi… (#5713) new d70cd81 GEODE-8136: Move UncheckedUtils to geode-common (#5123) new 8fb7f6c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new 32a8a55 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 +++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 365 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 432 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 ++ .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 ++- .../test/dunit/rules/DistributedBlackboard.java| 138 +++ 38 files changed, 2157 insertions(+), 753 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferConcurrencyTest.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 03/03: * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 32a8a55df4c0a5b8b1e5cfb746070804cbce5e0a Author: Bill Burcham AuthorDate: Thu Nov 5 17:30:29 2020 -0800 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. - Added a new unit test, and a new concurrency test for ByteBufferSharingImpl: both ensure that ByteBuffers are returned to the pool exactly once. Added a new DUnit test for the interaction between ByteBufferSharingImpl and NioSslEngine and Connection. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt Co-authored-by: Dan Smith (cherry picked from commit af267c005a63317cbb8528cdb38eccf6a8747818) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 365 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 432 +++-- 17 files changed, 1422 insertions(+), 486 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationPropertie
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit d70cd816ff183033b059198c9db8302c76a7af65 Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"); +rawList.add("2"); + +List value = uncheckedCast(rawList); + +
[geode] branch support/1.13 updated (4cedf9f -> 32a8a55)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 4cedf9f [BACKPORT] GEODE-8681: peer-to-peer message loss due to sending connection closi… (#5713) new d70cd81 GEODE-8136: Move UncheckedUtils to geode-common (#5123) new 8fb7f6c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new 32a8a55 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 +++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 365 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 432 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 ++ .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 ++- .../test/dunit/rules/DistributedBlackboard.java| 138 +++ 38 files changed, 2157 insertions(+), 753 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferConcurrencyTest.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 8fb7f6c7db9ef2ec0ff8b618a578738e1426d801 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboard().getMailbox("MBOX" + i)); + assertThat((Object) getBl
[geode] branch develop updated (9653a0b -> af267c0)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 9653a0b Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" add af267c0 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) No new revisions were added by this update. Summary of changes: .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 .../org/apache/geode/internal/tcp}/server.keystore | Bin ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 367 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 432 +++-- 17 files changed, 1423 insertions(+), 487 deletions(-) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferConcurrencyTest.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java
[geode] branch develop updated (9653a0b -> af267c0)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from 9653a0b Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" add af267c0 * GEODE-8652: NioSslEngine.close() Bypasses Locks (#5712) No new revisions were added by this update. Summary of changes: .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 .../org/apache/geode/internal/tcp}/server.keystore | Bin ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 168 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 367 - .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferConcurrencyTest.java| 165 .../internal/net/ByteBufferSharingImplTest.java| 179 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 432 +++-- 17 files changed, 1423 insertions(+), 487 deletions(-) create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferConcurrencyTest.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java
[geode] branch develop updated: Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)"
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 9653a0b Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" 9653a0b is described below commit 9653a0b6e490272fa77d375049f0e9f1cb6c8929 Author: Bill Burcham AuthorDate: Thu Nov 5 12:52:02 2020 -0800 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" This reverts commit 08e9e9673d0ed0a3d74c6d16e706817cab09. --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 .../org/apache/geode/internal/tcp/server.keystore | Bin 1256 -> 0 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 - .../geode/internal/net/ByteBufferSharing.java | 55 --- .../geode/internal/net/ByteBufferSharingImpl.java | 148 --- .../geode/internal/net/ByteBufferSharingNoOp.java | 52 --- .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 367 + .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 .../geode/internal/net/NioPlainEngineTest.java | 47 +-- .../geode/internal/net/NioSslEngineTest.java | 432 ++--- 16 files changed, 486 insertions(+), 1223 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java deleted file mode 100644 index 77fe9bf..000 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package org.apache.geode.internal.tcp; - -import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; -import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; -import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; -import static org.apache.geode.distributed.ConfigurationProperties.NAME; -import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; -import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD; -import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; -import static org.apache.geode.test.dunit.VM.getVM; -import static org.apache.geode.test.util.ResourceUtils.createTempFileFromResource; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Fail.fail; - -import java.io.File; -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.util.Properties; -import java.util.concurrent.TimeoutException; - -import org.apache.logging.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.geode.cache.Cache; -import org.apache.geode.cache.CacheFactory; -im
[geode] 01/03: Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)"
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit ef74657254c2b2707a31b43af52af1734b71e961 Author: Bill Burcham AuthorDate: Thu Nov 5 12:28:55 2020 -0800 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" This reverts commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7. --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 - .../org/apache/geode/internal/tcp/server.keystore | Bin 1256 -> 0 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 - .../geode/internal/net/ByteBufferSharing.java | 55 --- .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 --- .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 +-- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 - .../geode/internal/net/NioPlainEngineTest.java | 47 +-- .../geode/internal/net/NioSslEngineTest.java | 392 ++--- 16 files changed, 460 insertions(+), 1195 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java deleted file mode 100644 index 77fe9bf..000 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package org.apache.geode.internal.tcp; - -import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; -import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; -import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; -import static org.apache.geode.distributed.ConfigurationProperties.NAME; -import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; -import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD; -import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; -import static org.apache.geode.test.dunit.VM.getVM; -import static org.apache.geode.test.util.ResourceUtils.createTempFileFromResource; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Fail.fail; - -import java.io.File; -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.util.Properties; -import java.util.concurrent.TimeoutException; - -import org.apache.logging.log4j.Logger; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.apache.geode.cache.Cache; -import org.apache.geode.cache.CacheFactory; -import org.apache.geode.cache.Region; -import org.apache.geode.cache.RegionShortcut; -import org.apache.geode.distributed.DistributedSystemDisconnectedException; -import org.apache.g
[geode] 02/03: Revert "GEODE-8540: Create new DistributedBlackboard Rule (#5557)"
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 4886d2055f9cd0792694d0edb61537429a037439 Author: Bill Burcham AuthorDate: Thu Nov 5 12:28:55 2020 -0800 Revert "GEODE-8540: Create new DistributedBlackboard Rule (#5557)" This reverts commit cde469c6b6955a334e6bbf22accfc0735f0c70f4. --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 - .../org/apache/geode/test/dunit/Blackboard.java| 79 -- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 +-- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 -- 7 files changed, 101 insertions(+), 635 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index 5e151d7..ae78247 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,70 +14,83 @@ */ package org.apache.geode.test.dunit.internal; -import static java.util.concurrent.TimeUnit.SECONDS; -import static org.apache.geode.test.dunit.VM.getVM; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.catchThrowable; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; +import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; -@SuppressWarnings("serial") -public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { +public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { @Test - public void canPassDataBetweenVMs() { + public void canPassDataBetweenVMs() throws Exception { final String MBOX = "myMailbox"; -VM vm0 = getVM(0); -VM vm1 = getVM(1); +VM vm0 = Host.getHost(0).getVM(0); +VM vm1 = Host.getHost(0).getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); +String result = (String) vm1.invoke("get data from mailbox", () -> { + return getBlackboard().getMailbox(MBOX); +}); -assertThat(result).isEqualTo("testing"); +assertEquals("testing", result); } @Test - public void canSignalAnotherVM() { + public void canSignalAnotherVM() throws Exception { final String GATE = "myGate"; -VM vm0 = getVM(0); -VM vm1 = getVM(1); +VM vm0 = Host.getHost(0).getVM(0); +VM vm1 = Host.getHost(0).getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); - - Throwable thrown = catchThrowable(() -> { -getBlackboard().waitForGate(GATE, 1, SECONDS); - }); - - assertThat(thrown).isInstanceOf(TimeoutException.class); + assertFalse(getBlackboard().isGateSignaled(GATE)); + try { +getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); + } catch (TimeoutException e) { +// expected +return; + } catch (InterruptedException e) { +fail("unexpected interrupt"); + } + fail("unexpected success"); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", -() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); +vm1.invoke("wait on gate not yet signalled", () -> { + try { +getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); + } catch (TimeoutException e) { +fail("unexpected timeout"); + } catch (InterruptedException e) { +fail("unexpected interrupt"); + } + // success expected +}); } @Test - public void initBlackboardClearsEverything() { + public void initBlackboardClearsEverything() throws Exception { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertThat((Object) getBlackboard().getMailbox(&q
[geode] 03/03: Revert "GEODE-8136: Move UncheckedUtils to geode-common (#5123)"
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 986334e9198a1756b839d0d13028f4a846ea29b5 Author: Bill Burcham AuthorDate: Thu Nov 5 12:28:55 2020 -0800 Revert "GEODE-8136: Move UncheckedUtils to geode-common (#5123)" This reverts commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f. --- .../geode/util/internal/UncheckedUtilsTest.java| 60 -- .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 ++--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 -- .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 ++ .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 +-- .../cache/execute/util/TypedFunctionService.java | 37 - .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/cache/util}/UncheckedUtils.java | 19 +++ .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 134 insertions(+), 174 deletions(-) diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java deleted file mode 100644 index 7c282b7..000 --- a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ -package org.apache.geode.util.internal; - -import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.catchThrowable; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -@SuppressWarnings("unchecked") -public class UncheckedUtilsTest { - - @Test - public void uncheckedCast_rawList_empty() { -List rawList = new ArrayList(); - -List value = uncheckedCast(rawList); - -assertThat(value).isSameAs(rawList); - } - - @Test - public void uncheckedCast_rawList_nonEmpty() { -List rawList = new ArrayList(); -rawList.add("1"); -rawList.add("2"); - -List value = uncheckedCast(rawList); - -assertThat(value).isSameAs(rawList); - } - - @Test - public void uncheckedCast_rawList_wrongTypes() { -List rawList = new ArrayList(); -rawList.add(1); -rawList.add(2); -List wrongType = uncheckedCast(rawList); - -Throwable thrown = catchThrowable(() -> wrongType.get(0)); - -assertThat(thrown).isInstanceOf(ClassCastException.class); - } -} diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java index 43019bf..943c503 100755 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/PartitionedRegionSingleHopDUnitTest.java @@ -22,6 +22,7 @@ import static org.apache.geode.cache.RegionShortcut.PARTITION; import static org.apache.geode.cache.RegionShortcut.PARTITION_PERSISTENT; import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.internal.cache.util.UncheckedUtils.cast; import static org.apache.geode.internal.lang.SystemPropertyHelper.GEMFIRE_PREFIX; import static org.apache.geode.management.ManagementService.getExistingManagementService; import static org.apache.geode.test.awaitility.GeodeAwaitility.await; @@ -31,7 +32,6 @@ import stat
[geode] branch support/1.13 updated (6b8f5b0 -> 986334e)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 6b8f5b0 Revert "GEODE-8496: Bump jetty from 9.4.21.v20190926 to 9.4.33.v20201020 (#5574)" new ef74657 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" new 4886d20 Revert "GEODE-8540: Create new DistributedBlackboard Rule (#5557)" new 986334e Revert "GEODE-8136: Move UncheckedUtils to geode-common (#5123)" The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/geode/util/internal/UncheckedUtils.java | 34 -- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 - .../org/apache/geode/internal/tcp/server.keystore | Bin 1256 -> 0 bytes .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 - .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 ++- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../cache/execute/util/TypedFunctionService.java | 37 -- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../AbortBackup.java => util/UncheckedUtils.java} | 19 +- .../geode/internal/net/ByteBufferSharing.java | 55 --- .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 --- .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 +-- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 - .../geode/internal/net/NioPlainEngineTest.java | 47 +-- .../geode/internal/net/NioSslEngineTest.java | 392 ++--- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../org/apache/geode/test/dunit/Blackboard.java| 79 - .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +--- .../test/dunit/rules/DistributedBlackboard.java| 138 38 files changed, 696 insertions(+), 2037 deletions(-) delete mode 100644 geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java delete mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java delete mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java delete mode 100644 geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp/server.keystore delete mode 100644 geode-core/src/main/java/org/apache/geode/internal/cache/execute/util/TypedFunctionService.java copy geode-core/src/main/java/org/apache/geode/internal/cache/{backup/AbortBackup.java => util/UncheckedUtils.java} (70%) delete mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java delete mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java delete mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java delete mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java delete mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java delete mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/Blackboard.java delete mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] branch support/1.12 updated: Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)"
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new bec4704 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" bec4704 is described below commit bec47047dec2ddb64e000b71004fbef8ed3b2b88 Author: Bill Burcham AuthorDate: Thu Nov 5 12:28:21 2020 -0800 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" This reverts commit 06642ead279c500180f396c865b6277cb92ae27d. --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 1256 -> 0 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 ++- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 - .../geode/internal/net/ByteBufferSharing.java | 55 --- .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 --- .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 - .../geode/internal/net/NioPlainEngineTest.java | 47 +-- .../geode/internal/net/NioSslEngineTest.java | 397 ++--- 16 files changed, 462 insertions(+), 1199 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java deleted file mode 100644 index 586cd53..000 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. You may obtain a - * copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - */ - -package org.apache.geode.internal.tcp; - -import static java.util.concurrent.TimeUnit.MINUTES; -import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; -import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; -import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; -import static org.apache.geode.distributed.ConfigurationProperties.NAME; -import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; -import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; -import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_PASSWORD; -import static org.apache.geode.distributed.ConfigurationProperties.USE_CLUSTER_CONFIGURATION; -import static org.apache.geode.test.dunit.VM.getVM; -import static org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase.getBlackboard; -import static org.apache.geode.test.util.ResourceUtils.createTempFileFromResource; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Fail.fail; - -import java.io.File; -import java.io.Serializable; -import java.nio.ByteBuffer; -import java.util.Properties; -import java.util.concurrent.TimeoutException; - -import org.apache.logging.log4j.Logger; -import org.junit.After; -import org.junit.Before; -im
[geode] branch revert-5693-backport-1-13-GEODE-8652-and-friends created (now ba3b156)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch revert-5693-backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at ba3b156 Revert "GEODE-8136: Move UncheckedUtils to geode-common (#5123)" No new revisions were added by this update.
[geode] branch revert-5693-backport-1-13-GEODE-8652-and-friends created (now ba3b156)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch revert-5693-backport-1-13-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at ba3b156 Revert "GEODE-8136: Move UncheckedUtils to geode-common (#5123)" No new revisions were added by this update.
[geode] branch revert-5694-backport-1-12-GEODE-8652-and-friends created (now 9ef2718)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch revert-5694-backport-1-12-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at 9ef2718 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" No new revisions were added by this update.
[geode] branch revert-5694-backport-1-12-GEODE-8652-and-friends created (now 9ef2718)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch revert-5694-backport-1-12-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at 9ef2718 Revert "GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)" No new revisions were added by this update.
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PR
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PR
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboa
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_P
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PR
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_P
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboa
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"
[geode] branch support/1.12 updated: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.12 in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/support/1.12 by this push: new 06642ea GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) 06642ea is described below commit 06642ead279c500180f396c865b6277cb92ae27d Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 235 .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 357 +- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 397 +++-- 16 files changed, 1199 insertions(+), 462 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..586cd53 --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,235 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static java.util.concurrent.TimeUnit.MINUTES; +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PR
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboa
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_P
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"
[geode] branch support/1.13 updated (174c7cb -> b2af727)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git. from 174c7cb GEODE-8651: MsgReader's readHeader and readMessage should be synchron… (#5665) new 10af7ea GEODE-8136: Move UncheckedUtils to geode-common (#5123) new cde469c GEODE-8540: Create new DistributedBlackboard Rule (#5557) new b2af727 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../geode/util/internal}/UncheckedUtils.java | 19 +- .../geode/util/internal/UncheckedUtilsTest.java| 60 .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 +- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +--- ...oningWithColocationAndPersistenceDUnitTest.java | 12 +- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp}/server.keystore | Bin .../FunctionExecutionOnLonerRegressionTest.java| 27 +- ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 +-- .../cache/InternalCacheForClientAccess.java| 6 +- .../apache/geode/internal/cache/LocalRegion.java | 7 +- .../util/TypedFunctionService.java}| 20 +- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/ClusterAlertMessagingTest.java| 6 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 ++-- .../DistributedBlackboardDistributedTest.java | 297 .../InternalBlackboard.java => Blackboard.java}| 54 +-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 +-- .../test/dunit/internal/InternalBlackboard.java| 33 +- .../dunit/internal/InternalBlackboardImpl.java | 59 +++- .../test/dunit/rules/DistributedBlackboard.java| 138 37 files changed, 1930 insertions(+), 727 deletions(-) copy {geode-core/src/main/java/org/apache/geode/internal/cache/util => geode-common/src/main/java/org/apache/geode/util/internal}/UncheckedUtils.java (68%) create mode 100644 geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java create mode 100644 geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java copy {geode-dunit/src/main/resources/org/apache/geode => geode-core/src/distributedTest/resources/org/apache/geode/internal/tcp}/server.keystore (100%) rename geode-core/src/main/java/org/apache/geode/internal/cache/{util/UncheckedUtils.java => execute/util/TypedFunctionService.java} (61%) create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharing.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingImpl.java create mode 100644 geode-core/src/main/java/org/apache/geode/internal/net/ByteBufferSharingNoOp.java create mode 100644 geode-core/src/test/java/org/apache/geode/internal/net/ByteBufferSharingImplTest.java create mode 100644 geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/rules/tests/DistributedBlackboardDistributedTest.java copy geode-dunit/src/main/java/org/apache/geode/test/dunit/{internal/InternalBlackboard.java => Blackboard.java} (51%) mode change 100755 => 100644 create mode 100644 geode-dunit/src/main/java/org/apache/geode/test/dunit/rules/DistributedBlackboard.java
[geode] 03/03: GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit b2af727ce23fd155f3665e3db2ecee6e8f80fba7 Author: Bill Burcham AuthorDate: Thu Oct 29 16:38:25 2020 -0700 GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) - NioSslEngine.close() proceeds even if readers (or writers) are operating on its ByteBuffers, allowing Connection.close() to close its socket and proceed. - NioSslEngine.close() needed a lock only on the output buffer, so we split what was a single lock into two. Also instead of using synchronized we use a ReentrantLock so we can call tryLock() and time out if needed in NioSslEngine.close(). - Since readers/writers may hold locks on these input/output buffers when NioSslEngine.close() is called a reference count is maintained and the buffers are returned to the pool only when the last user is done. - To manage the locking and reference counting a new AutoCloseable ByteBufferSharing interface is introduced with a trivial implementation: ByteBufferSharingNoOp and a real implementation: ByteBufferSharingImpl. Co-authored-by: Bill Burcham Co-authored-by: Darrel Schneider Co-authored-by: Ernie Burghardt (cherry picked from commit 08e9e9673d0ed0a3d74c6d16e706817cab09) --- .../tcp/ConnectionCloseSSLTLSDUnitTest.java| 238 + .../org/apache/geode/internal/tcp/server.keystore | Bin 0 -> 1256 bytes ...LSocketHostNameVerificationIntegrationTest.java | 4 +- .../internal/net/SSLSocketIntegrationTest.java | 57 +-- .../apache/geode/codeAnalysis/excludedClasses.txt | 1 + .../geode/internal/net/ByteBufferSharing.java | 55 +++ .../geode/internal/net/ByteBufferSharingImpl.java | 148 .../geode/internal/net/ByteBufferSharingNoOp.java | 52 +++ .../org/apache/geode/internal/net/NioFilter.java | 69 ++-- .../apache/geode/internal/net/NioPlainEngine.java | 27 +- .../apache/geode/internal/net/NioSslEngine.java| 353 ++- .../org/apache/geode/internal/tcp/Connection.java | 34 +- .../org/apache/geode/internal/tcp/MsgReader.java | 15 +- .../internal/net/ByteBufferSharingImplTest.java| 163 + .../geode/internal/net/NioPlainEngineTest.java | 47 ++- .../geode/internal/net/NioSslEngineTest.java | 392 +++-- 16 files changed, 1195 insertions(+), 460 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java new file mode 100644 index 000..77fe9bf --- /dev/null +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/tcp/ConnectionCloseSSLTLSDUnitTest.java @@ -0,0 +1,238 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.internal.tcp; + +import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS; +import static org.apache.geode.distributed.ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION; +import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS; +import static org.apache.geode.distributed.ConfigurationProperties.NAME; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_BUFFER_SIZE; +import static org.apache.geode.distributed.ConfigurationProperties.SOCKET_LEASE_TIME; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_ENABLED_COMPONENTS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_KEYSTORE_PASSWORD; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_PROTOCOLS; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_REQUIRE_AUTHENTICATION; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE; +import static org.apache.geode.distributed.ConfigurationProperties.SSL_TRUSTSTORE_P
[geode] 02/03: GEODE-8540: Create new DistributedBlackboard Rule (#5557)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit cde469c6b6955a334e6bbf22accfc0735f0c70f4 Author: Kirk Lund AuthorDate: Wed Sep 30 09:39:30 2020 -0700 GEODE-8540: Create new DistributedBlackboard Rule (#5557) Package up DUnitBlackboard as a JUnit Rule named DistributedBlackboard. (cherry picked from commit 26cb822f2ee467545dd708ecc867cebbd2473c70) --- .../dunit/internal/DUnitBlackboardDUnitTest.java | 75 +++--- .../DistributedBlackboardDistributedTest.java | 297 + .../InternalBlackboard.java => Blackboard.java}| 54 ++-- .../apache/geode/test/dunit/DUnitBlackboard.java | 55 ++-- .../test/dunit/internal/InternalBlackboard.java| 33 ++- .../dunit/internal/InternalBlackboardImpl.java | 59 ++-- .../test/dunit/rules/DistributedBlackboard.java| 138 ++ 7 files changed, 584 insertions(+), 127 deletions(-) diff --git a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java index ae78247..5e151d7 100755 --- a/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java +++ b/geode-dunit/src/distributedTest/java/org/apache/geode/test/dunit/internal/DUnitBlackboardDUnitTest.java @@ -14,83 +14,70 @@ */ package org.apache.geode.test.dunit.internal; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.geode.test.dunit.VM.getVM; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; -import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Test; -import org.apache.geode.test.dunit.Host; import org.apache.geode.test.dunit.VM; - +@SuppressWarnings("serial") public class DUnitBlackboardDUnitTest extends JUnit4DistributedTestCase { + @Test - public void canPassDataBetweenVMs() throws Exception { + public void canPassDataBetweenVMs() { final String MBOX = "myMailbox"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm0.invoke("put data in mailbox", () -> getBlackboard().setMailbox(MBOX, "testing")); -String result = (String) vm1.invoke("get data from mailbox", () -> { - return getBlackboard().getMailbox(MBOX); -}); +String result = vm1.invoke("get data from mailbox", () -> getBlackboard().getMailbox(MBOX)); -assertEquals("testing", result); +assertThat(result).isEqualTo("testing"); } @Test - public void canSignalAnotherVM() throws Exception { + public void canSignalAnotherVM() { final String GATE = "myGate"; -VM vm0 = Host.getHost(0).getVM(0); -VM vm1 = Host.getHost(0).getVM(1); +VM vm0 = getVM(0); +VM vm1 = getVM(1); vm1.invoke("wait on gate not yet signalled", () -> { - assertFalse(getBlackboard().isGateSignaled(GATE)); - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -// expected -return; - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - fail("unexpected success"); + assertThat(getBlackboard().isGateSignaled(GATE)).isFalse(); + + Throwable thrown = catchThrowable(() -> { +getBlackboard().waitForGate(GATE, 1, SECONDS); + }); + + assertThat(thrown).isInstanceOf(TimeoutException.class); }); vm0.invoke("signal gate", () -> getBlackboard().signalGate(GATE)); -vm1.invoke("wait on gate not yet signalled", () -> { - try { -getBlackboard().waitForGate(GATE, 1, TimeUnit.SECONDS); - } catch (TimeoutException e) { -fail("unexpected timeout"); - } catch (InterruptedException e) { -fail("unexpected interrupt"); - } - // success expected -}); +vm1.invoke("wait on gate not yet signalled", +() -> getBlackboard().waitForGate(GATE, 1, SECONDS)); } @Test - public void initBlackboardClearsEverything() throws Exception { + public void initBlackboardClearsEverything() { for (int i = 0; i < 100; i++) { getBlackboard().setMailbox("MBOX" + i, "value" + i); - assertEquals("value" + i, getBlackboa
[geode] 01/03: GEODE-8136: Move UncheckedUtils to geode-common (#5123)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a commit to branch support/1.13 in repository https://gitbox.apache.org/repos/asf/geode.git commit 10af7ea015ec85ef02b2e972c7a3dd3ec23bcb7f Author: Kirk Lund AuthorDate: Tue May 26 10:24:44 2020 -0700 GEODE-8136: Move UncheckedUtils to geode-common (#5123) Create UncheckedUtilsTest to unit test UncheckedUtils. Extract FunctionExecution methods to new TypedFunctionService in geode-core. (cherry picked from commit 253d667b27423e55601e925f7a20f2fd6f0efc31) --- .../geode/util/internal}/UncheckedUtils.java | 19 --- .../geode/util/internal/UncheckedUtilsTest.java| 60 ++ .../cache/PartitionedRegionSingleHopDUnitTest.java | 14 ++--- ...istributedRegionFunctionExecutionDUnitTest.java | 59 +++-- ...oningWithColocationAndPersistenceDUnitTest.java | 12 ++--- .../FunctionExecutionOnLonerRegressionTest.java| 27 ++ .../client/internal/ClientMetadataService.java | 4 +- .../geode/internal/cache/GemFireCacheImpl.java | 49 -- .../cache/InternalCacheForClientAccess.java| 6 +-- .../apache/geode/internal/cache/LocalRegion.java | 7 ++- .../util/TypedFunctionService.java}| 20 +--- .../tier/sockets/CacheClientProxyFactory.java | 4 +- .../internal/ClusterAlertMessagingTest.java| 6 +-- .../apache/geode/internal/tcp/TCPConduitTest.java | 4 +- 14 files changed, 151 insertions(+), 140 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java similarity index 68% copy from geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java copy to geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java index c03e990..61dbd8d 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/util/UncheckedUtils.java +++ b/geode-common/src/main/java/org/apache/geode/util/internal/UncheckedUtils.java @@ -12,18 +12,23 @@ * or implied. See the License for the specific language governing permissions and limitations under * the License. */ -package org.apache.geode.internal.cache.util; - -import org.apache.geode.cache.execute.Execution; +package org.apache.geode.util.internal; +/** + * Utilities for casting and working with unchecked raw types. + */ @SuppressWarnings({"unchecked", "unused"}) public class UncheckedUtils { - public static T cast(Object object) { -return (T) object; + protected UncheckedUtils() { +// do not instantiate } - public static Execution cast(Execution execution) { -return execution; + /** + * Casts an instance of a raw type to a parameterized type. Preference should be given to + * converting all code from using raw types to using parameterized types when possible. + */ + public static T uncheckedCast(Object object) { +return (T) object; } } diff --git a/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java new file mode 100644 index 000..7c282b7 --- /dev/null +++ b/geode-common/src/test/java/org/apache/geode/util/internal/UncheckedUtilsTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.util.internal; + +import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +@SuppressWarnings("unchecked") +public class UncheckedUtilsTest { + + @Test + public void uncheckedCast_rawList_empty() { +List rawList = new ArrayList(); + +List value = uncheckedCast(rawList); + +assertThat(value).isSameAs(rawList); + } + + @Test + public void uncheckedCast_rawList_nonEmpty() { +List rawList = new ArrayList(); +rawList.add("1"
[geode] branch backport-1-12-GEODE-8652-and-friends created (now 1395c6a)
This is an automated email from the ASF dual-hosted git repository. burcham pushed a change to branch backport-1-12-GEODE-8652-and-friends in repository https://gitbox.apache.org/repos/asf/geode.git. at 1395c6a GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) This branch includes the following new commits: new 1395c6a GEODE-8652: NioSslEngine.close() Bypasses Locks (#5666) The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.