ARTEMIS-1368 Artemis gets to state when it doesn't respond to producer
There is a leak on replication tokens in the moment when a backup is shutdowned or killed and the ReplicationManager is stopped. If there are some tasks (holding replication tokens) in the executor, these tokens are simply ignored and replicationDone method isn't called on them. Because of this, some tasks in OperationContextImpl cannot be finished.
This commit is contained in:
parent
cfdd9fb5bc
commit
d6cbc0aa88
|
@ -350,34 +350,26 @@ public final class ReplicationManager implements ActiveMQComponent {
|
|||
}
|
||||
|
||||
private OperationContext sendReplicatePacket(final Packet packet, boolean lineUp) {
|
||||
if (!enabled)
|
||||
if (!enabled) {
|
||||
packet.release();
|
||||
return null;
|
||||
boolean runItNow = false;
|
||||
}
|
||||
|
||||
final OperationContext repliToken = OperationContextImpl.getContext(executorFactory);
|
||||
if (lineUp) {
|
||||
repliToken.replicationLineUp();
|
||||
}
|
||||
|
||||
if (enabled) {
|
||||
replicationStream.execute(() -> {
|
||||
if (enabled) {
|
||||
pendingTokens.add(repliToken);
|
||||
flowControl(packet.expectedEncodeSize());
|
||||
replicatingChannel.send(packet);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Already replicating channel failed, so just play the action now
|
||||
runItNow = true;
|
||||
packet.release();
|
||||
}
|
||||
|
||||
// Execute outside lock
|
||||
|
||||
if (runItNow) {
|
||||
repliToken.replicationDone();
|
||||
}
|
||||
replicationStream.execute(() -> {
|
||||
if (enabled) {
|
||||
pendingTokens.add(repliToken);
|
||||
flowControl(packet.expectedEncodeSize());
|
||||
replicatingChannel.send(packet);
|
||||
} else {
|
||||
packet.release();
|
||||
repliToken.replicationDone();
|
||||
}
|
||||
});
|
||||
|
||||
return repliToken;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue