Skip to content

Commit

Permalink
In the case a session disconnects during a replay, downgrade error ha…
Browse files Browse the repository at this point in the history
…ndler logging
  • Loading branch information
marc-adaptive committed Jan 2, 2025
1 parent d9ef124 commit d05ced1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import io.aeron.logbuffer.ControlledFragmentHandler.Action;
import org.agrona.DirectBuffer;
import org.agrona.ErrorHandler;
import org.agrona.collections.Long2ObjectHashMap;
import uk.co.real_logic.artio.DebugLogger;
import uk.co.real_logic.artio.LogTag;
Expand All @@ -35,7 +34,6 @@ class FixSenderEndPoints implements AutoCloseable
"SEPs.missReplayComplete, connId=%s, corrId=%s, slow=%s");

private final Long2ObjectHashMap<FixSenderEndPoint> connectionIdToSenderEndpoint = new Long2ObjectHashMap<>();
private final ErrorHandler errorHandler;
private final LongToIntFunction libraryLookup = this::libraryLookup;

private int libraryLookup(final long sessionId)
Expand All @@ -53,11 +51,6 @@ private int libraryLookup(final long sessionId)

private long timeInMs;

FixSenderEndPoints(final ErrorHandler errorHandler)
{
this.errorHandler = errorHandler;
}

public void add(final FixSenderEndPoint senderEndPoint)
{
connectionIdToSenderEndpoint.put(senderEndPoint.connectionId(), senderEndPoint);
Expand Down Expand Up @@ -134,21 +127,8 @@ Action onReplayMessage(
{
return endPoint.onReplayMessage(buffer, offset, length, timeInMs, sequenceNumber);
}
else
{
logReplayError(connectionId, buffer, offset, length);

return CONTINUE;
}
}
return CONTINUE;

private void logReplayError(final long connectionId, final DirectBuffer buffer, final int offset, final int length)
{
errorHandler.onError(new IllegalArgumentException(String.format(
"Failed to replay message on conn=%1$d [%2$s], this probably indicates the connection has disconnected " +
"from Artio whilst this message was in the process of being replayed",
connectionId,
buffer.getStringWithoutLengthUtf8(offset, length))));
}

Action onReplayComplete(final long connectionId, final long correlationId, final boolean slow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class Framer implements Agent, EngineEndPointHandler, ProtocolHandler
this.agentNamePrefix = agentNamePrefix;
this.inboundCompletionPosition = inboundCompletionPosition;
this.outboundLibraryCompletionPosition = outboundLibraryCompletionPosition;
this.fixSenderEndPoints = new FixSenderEndPoints(errorHandler);
this.fixSenderEndPoints = new FixSenderEndPoints();
this.countersReader = countersReader;
this.inboundIndexRegistrationId = inboundIndexRegistrationId;
this.outboundIndexRegistrationId = outboundIndexRegistrationId;
Expand Down

0 comments on commit d05ced1

Please sign in to comment.