To avoid a potential race condition, updates and changes are recommended for users of the SDK and for customers who use the Direct and Optimize agents.
In certain situations, agents do not automatically reconnect when the gateway connection is lost. The race condition occurs when the agent code attempts to reconnect to the gateway before the previous connection is closed.
To avoid the race condition if you are an SDK user, add the code in blue to the reconnection code for your custom agent:
if (alreadySeenStreamClosedCall.compareAndSet(false, true)) {
System.out.println("Passed compareAndSet test");
final CI360StreamInterface ci360StreamInterface=this;
Thread startThread=new Thread() {
public void run() {
try
{ Thread.sleep(15000); }
catch (InterruptedException e)
{ }
alreadySeenStreamClosedCall.set(false);
try {
//Try to reconnect to the event stream.
agent.startStream(ci360StreamInterface, true);
} catch (CI360AgentException e)
{ System.err.println("ERROR " + e.getErrorCode() + ": " + e.getMessage()); }
}
};
startThread.setName("AgentRestart-");
startThread.start();
}
To avoid the race condition if you use Direct or Optimize agents, update to a version from 24.05 or later.
No action is required if you use General or Diagnostics agents.