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

ASF GitHub Bot commented on GEODE-8846:
---------------------------------------

DonalEvans commented on a change in pull request #5927:
URL: https://github.com/apache/geode/pull/5927#discussion_r562786691



##########
File path: 
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientServerTransactionDistributedTest.java
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.cache;
+
+import static org.apache.geode.test.dunit.VM.getHostName;
+import static org.apache.geode.test.dunit.VM.getVM;
+import static org.junit.Assert.assertEquals;
+
+import java.io.Serializable;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.geode.cache.PartitionAttributes;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.client.ClientRegionFactory;
+import org.apache.geode.cache.client.ClientRegionShortcut;
+import org.apache.geode.cache.client.PoolFactory;
+import org.apache.geode.cache.client.PoolManager;
+import org.apache.geode.cache.client.internal.PoolImpl;
+import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.distributed.internal.ServerLocation;
+import org.apache.geode.logging.internal.log4j.api.LogService;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.rules.CacheRule;
+import org.apache.geode.test.dunit.rules.ClientCacheRule;
+import org.apache.geode.test.dunit.rules.DistributedRule;
+import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
+
+@SuppressWarnings("serial")
+public class ClientServerTransactionDistributedTest implements Serializable {
+
+  private String hostName;
+  private String uniqueName;
+  private String regionName;
+  private VM server1;
+  private int port1;

Review comment:
       Yeah, this is fine, thanks for addressing the feedback!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Transaction commit fail when uniqueID integer overflow to negative value
> ------------------------------------------------------------------------
>
>                 Key: GEODE-8846
>                 URL: https://issues.apache.org/jira/browse/GEODE-8846
>             Project: Geode
>          Issue Type: Bug
>          Components: client/server
>    Affects Versions: 1.13.0, 1.13.1
>            Reporter: Jakov Varenina
>            Assignee: Jakov Varenina
>            Priority: Major
>              Labels: pull-request-available
>
> When client increments *uniqId* above Integer.MAX_VALUE (2147483647) then due 
> to memory overflow the *uniqId* is set to negative value Integer.MIN_VALUE 
> (-2147483648). TransactionID (uniqId) is  sent to the server as a part of 
> transaction message.
> {code:java}
> public class TXManagerImpl implements CacheTransactionManager, 
> MembershipListener {
> ...
>   // The unique transaction ID for this Manager
>   private final AtomicInteger uniqId;
> ....
>     TXId id = new TXId(this.distributionMgrId, this.uniqId.incrementAndGet());
> ....
> {code}
> Currently server will interpret any negative value of transactionID (uniqID) 
> as non-transactional traffic. Please notice that getTransactionID() actually 
> retrieves uniqID value that is set by client.
> {code:java}
> /**
>  * checks to see if this thread needs to masquerade as a transactional 
> thread. clients after
>  * GFE_66 should be able to start a transaction.
>  *
>  * @return true if thread should masquerade as a transactional thread.
>  */
> protected boolean shouldMasqueradeForTx(Message clientMessage,
>     ServerConnection serverConnection) {
>   return 
> serverConnection.getClientVersion().isNotOlderThan(KnownVersion.GFE_66)
>       && clientMessage.getTransactionId() > TXManagerImpl.NOTX; // ---> NOTX 
> is equal -1
> }
> {code}
> After overflow happens all subsequent commit actions from the client are 
> rejected with exception:
> [vm0] [fatal 2021/01/14 15:28:41.967 CET  <ServerConnection on port 39093 
> Thread 2> tid=0x52] Server connection from 
> [identity(192.168.90.23(29826:loner):48210:6c694c01,connection=1; port=48212] 
> : Unexpected Error on server
> [vm0] org.apache.geode.InternalGemFireError
> [vm0]     at org.apache.geode.internal.Assert.throwError(Assert.java:91)
> [vm0]     at org.apache.geode.internal.Assert.assertTrue(Assert.java:55)
> [vm0]     at 
> org.apache.geode.internal.cache.tier.sockets.command.CommitCommand.cmdExecute(CommitCommand.java:82)
> [vm0]     at 
> org.apache.geode.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:183)
> [vm0]     at 
> org.apache.geode.internal.cache.tier.sockets.ServerConnection.doNormalMessage(ServerConnection.java:848)
> [vm0]     at 
> org.apache.geode.internal.cache.tier.sockets.OriginalServerConnection.doOneMessage(OriginalServerConnection.java:72)
> [vm0]     at 
> org.apache.geode.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1214)
> [vm0]     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> [vm0]     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> [vm0]     at 
> org.apache.geode.internal.cache.tier.sockets.AcceptorImpl.lambda$initializeServerConnectionThreadPool$3(AcceptorImpl.java:691)
> [vm0]     at 
> org.apache.geode.logging.internal.executors.LoggingThreadFactory.lambda$newThread$0(LoggingThreadFactory.java:120)
> [vm0]     at java.lang.Thread.run(Thread.java:748)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to