[
https://issues.apache.org/jira/browse/GEODE-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16286610#comment-16286610
]
ASF GitHub Bot commented on GEODE-4072:
---------------------------------------
nabarunnag closed pull request #1148: GEODE-4072: Fixed race condition in
AckThreadReader shutdown.
URL: https://github.com/apache/geode/pull/1148
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
index a86f430c6e..3a15342675 100644
---
a/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
+++
b/geode-wan/src/main/java/org/apache/geode/internal/cache/wan/GatewaySenderEventRemoteDispatcher.java
@@ -749,8 +749,8 @@ public void shutdown() {
// we need to destroy connection irrespective of we are listening on it
or
// not. No need to take lock as the reader thread may be blocked and we
might not
// get chance to destroy unless that returns.
- if (connection != null) {
- Connection conn = connection;
+ Connection conn = connection;
+ if (conn != null) {
shutDownAckReaderConnection();
if (!conn.isDestroyed()) {
conn.destroy();
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Race condition in AckReaderThread.shutdown
> -------------------------------------------
>
> Key: GEODE-4072
> URL: https://issues.apache.org/jira/browse/GEODE-4072
> Project: Geode
> Issue Type: Bug
> Components: wan
> Reporter: nabarun
> Assignee: nabarun
>
> *+Issue+*
> {code:title=AckReaderThread.java}
> if (connection != null) {
> Connection conn = connection;
> shutDownAckReaderConnection();
> if (!conn.isDestroyed()) {
> conn.destroy();
> sender.getProxy().returnConnection(conn);
> }
> }
> {code}
> The global connection variable may be set to null before it is assigned to
> the local variable, resulting in NPE.
> *Solution*:
> --set the local variable to the connection variable and use that local
> variable for null checks.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)