QuickFixN has session disconnection event that doesn't call OnLogout - quickfix

In the QF event log there are session layer events:
20180418-13:30:51.268 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #
20180418-13:31:21.293 : Connection failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond #.#.#.#:#
20180418-13:31:00.288 : Connecting to #.#.#.# on port #
What's the event handler to use to report / react to these events? The OnLogout handler is not being called.
I don't want to use FromEarlyIntercept that I guess would catch the event?

This behavior is by design - there was no connection established, no logon done, so no OnLogout event after network failure when connecting.
You can see the source code for that part - FromEarlyIntercept is also not triggered in this case. QuickFix/n just logs the error and will try to reconnect after ReconnectInterval seconds.
try
{
t.Connect();
t.Initiator.SetConnected(t.Session.SessionID);
t.Session.Log.OnEvent("Connection succeeded");
t.Session.Next();
while (t.Read())
{ }
if (t.Initiator.IsStopped)
t.Initiator.RemoveThread(t);
t.Initiator.SetDisconnected(t.Session.SessionID);
}
catch (IOException ex) // Can be exception when connecting, during ssl authentication or when reading
{
t.Session.Log.OnEvent("Connection failed: " + ex.Message);
}
catch (SocketException e)
{
t.Session.Log.OnEvent("Connection failed: " + e.Message);
}

Related

Unable to initialize the Alt unity Driver using Appium

Failed to connect to AltUnity Tester on host: 127.0.0.1 port: 13000.
private void connectunity() {
AltUnityPortForwarding.forwardAndroid();
try {
altdriver = new AltUnityDriver();
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
I'm trying to connect to AltUnity server using appium, Im connect to port 13000 and "the AltUnity pop up waiting for connection on port 13000" disappearing after connection but still unable to initiate the driver getting the error.
note: I've referred the docs related to altunity but and tried different ways to initialize the alt unity driver but none of them are working

System.IO.IOException: Unable to read data from the transport connection

Using IIS, ASP.NET Core 2.2 and RestSharp V106.6.10 via Nuget on multiple servers getting exceptions after a period of time. My API calls with RestSharp work for a while then all of a sudden they start failing with common exception messages such as...
"ErrorException:System.Net.WebException: An error occurred while sending the request. Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
This occurs on multiple servers and I have yet to determine the source of the issue.
I have tried to create RestClient per call and also as a singleton with the same exception in both cases. I have also tried using syncrhonously as well as async all the way from the controller to the server call. In all cases I continue to get the above failure messages after a period of time.
Restarting the apppool does not resolve the issue. The only thing that will resolve this is a server reboot. I believe it has something to do with http client connections and reaching some limit but have yet to determine why i continue to have this issue.
Any help would be greatly appreciated. (Reference also https://github.com/restsharp/RestSharp/issues/1322)
Code currently looks like...
var defaultTimeout = 5 * 60 * 1000;
_restClientTimeout = defaultTimeout;
_restClientReadWriteTimeout = defaultTimeout;
_requestTimeout = defaultTimeout;
_client = new RestClient(_fastFieldBaseUrl);
_client.Timeout = _restClientTimeout;
_client.ReadWriteTimeout = _restClientReadWriteTimeout;
var request = new RestRequest(url, Method.POST);
request.Timeout = _requestTimeout;
request.ReadWriteTimeout = _requestTimeout;
request.AddHeader("Content-Type", "application/json");
request.AddParameter("body", json, ParameterType.RequestBody);
try
{
var response = await _client.ExecuteTaskAsync(request);
if (response.StatusCode == HttpStatusCode.Created)
{
return response.RawBytes;
}
else
{
var message= $"ExecuteTaskAsync raw bytes is null GetResponseMessage(response)}";
Log(message, traceIdentifier, null, Microsoft.Extensions.Logging.LogLevel.Error);
return null;
}
}
catch (Exception e)
{
var message = $"Error: {e.ToString()}";
Log(message, traceIdentifier, e, Microsoft.Extensions.Logging.LogLevel.Error);
}

scan4.coverity.com - Connection failed

I'm trying to do Static Analysis using Coverity Scan.
When "View defects" is executed, the following message will be displayed.
How can I resolve to view defects?
scan4.coverity.com - Connection failed
Error code 8
The proxy failed to connect to the web server, due to TCP connection rejection (TCP Reset).

How to handle the error "UNet Client Disconnect Error: Timeout"?

How to handle the error "UNet Client Disconnect Error: Timeout"? How not reboot the application, when it occurs?
I now resolve this issue.
I think this can help you too.
myClient.RegisterHandler(MsgType.Error, OnError);
void OnError(NetworkMessage msg){
//Error handler code
}
This Error client receive with "UNET Client Disconnect Error: Timeout".
My solution: If i not have server. I set current client as Server.

Connection failure has been detected: HQ119014: Did not receive data from invm:0

actually I have a TimerWS running correctly, but in a few hours I have this error
WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212037: Connection failure has been detected: HQ119014: Did not receive data from invm:0. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT]
WARN [org.hornetq.jms.server] (Thread-3 (HornetQ-client-global-threads-451033388)) Notified of connection failure in xa discovery, we will retry on the next recovery: HornetQException[errorType=NOT_CONNECTED message=HQ119006: Channel disconnected]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Any idea?
Something is going wrong with a client's connection to the server.
These warnings are generated from the server which determines that a client is no longer responding.When that happens, the server cleans up the server-side resources related to the client's connections.
I have seen this many times by clients which are not properly coded to close their resources when they exit (finally block).
Have a look also for network problems which break the connection.