Close OPC-UA connections before create a new one - qt

Using the example Qt OPC UA Viewer Example if I kill the process without disconnecting the client, for some time I cannot connect anymore to the OpcUA server:
qt.opcua.plugins.open62541.sdk.client: "Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: Good"
qt.opcua.plugins.open62541.sdk.client: "Selected Endpoint opc.tcp://192.168.1.50:4840 with SecurityMode None and SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None"
qt.opcua.plugins.open62541.sdk.client: "Selected UserTokenPolicy Anonymous-[0]-None-None with UserTokenType Anonymous and SecurityPolicy http://opcfoundation.org/UA/SecurityPolicy#None"
qt.opcua.plugins.open62541.sdk.client: "Received a ServiceFault response"
qt.opcua.plugins.open62541.sdk.client: "The ServiceResult has the StatusCode BadTooManySessions"
qt.opcua.plugins.open62541.sdk.client: "Client Status: ChannelState: Open, SessionState: Closed, ConnectStatus: BadTooManySessions"
qt.opcua.plugins.open62541.sdk.client: "Client Status: ChannelState: Closed, SessionState: Closed, ConnectStatus: BadTooManySessions"
qt.opcua.plugins.open62541: Open62541: Failed to connect
As far as I understand this is because the server accept only one connection and if it's not properly closed it does not accept new connections.
Because during development it may happen to kill the process (or it just crashes due to a bug) is there a way to close the pending connection (if any) before attempt a new one?
I'm running Qt 6.2.0 under Ubuntu 20.04.

Related

Offline Firestore : Stream closed with status: Status{code=UNAVAILABLE

I am getting those error messages when I am using my App offline (it is working when I am online):
W/Firestore(23675): (24.0.1) [WatchStream]: (da69cba) Stream closed
with status: Status{code=UNAVAILABLE, description=End of stream or
IOException, cause=null}. W/Firestore(23675): (24.0.1) [WriteStream]:
(9780b0d) Stream closed with status: Status{code=UNAVAILABLE,
description=End of stream or IOException, cause=null}.
W/Firestore(23675): (24.0.1) [WriteStream]: (9780b0d) Stream closed
with status: Status{code=UNAVAILABLE, description=Unable to resolve
host firestore.googleapis.com, cause=java.lang.RuntimeException:
java.net.UnknownHostException: Unable to resolve host
"firestore.googleapis.com": No address associated with hostname
Here is my main.dart :
await Firebase.initializeApp();
FirebaseFirestore.instance.settings = Settings(cacheSizeBytes: Settings.CACHE_SIZE_UNLIMITED);
FirebaseFirestore.instance.settings = Settings(persistenceEnabled: true);
What did I miss ? (I have the last version of flutter and cloud_firestore package)
Is it because I am in debug mode using Android Emulator ?
It could be a server error or it could be related to this issue on Github.
As you can see the issue on Github is still open and under investigation, if you can update to the latest version of flutter.
For the UNAVAILABLE Firebase ErrorCode documentation says:
UNAVAILABLE (HTTP error code = 503) The server is overloaded. The server couldn't process the request in time. Retry the same request, but you must:
- Honor the Retry-After header if it is included in the response from the FCM Connection Server.
- Implement exponential back-off in your retry mechanism. (e.g. if you waited one second before the first retry, wait at least two second before the next one, then 4 seconds and so on). If you're sending multiple messages, delay each one independently by an additional random amount to avoid issuing a new request for all messages at the same time. Senders that cause problems risk being denylisted.
Check here for more about Error codes
Also,basic but worth a test, make sure that the device connection is stable with no drops.

In Jmeter's TCP Sampler: what's the difference between no "Re-use connection" vs "Re-use + Close connection"?

I'm new to using JMeter, and I found that in the TCP Sampler (Jmeter version 2.11) there are 2 checkboxes labeled "Re-use Connection" and "Close Connection". So the documentation says this:
Re-use connection: If selected, the connection is kept open. Otherwise it is closed when the data has been read.
Close connection: If selected, the connection will be closed after running the sampler.
So from what I understand, it is the same to not check Re-use Connection than to check both Re-use Connection and Close Connection, is it? Then what's the point of checking both?
Basically each thread group can have several threads running under it, so the re-use mean It get reused. Please read the following explanation.
If "Re-use connection" is selected, connections are shared between Samplers in the same thread, provided that the exact same host name string and port are used. Different hosts/port combinations will use different connections, as will different threads. If both of "Re-use connection" and "Close connection" are selected, the socket will be closed after running the sampler. On the next sampler, another socket will be created. You may want to close a socket at the end of each thread loop. If an error is detected - or "Re-use connection" is not selected - the socket is closed. Another socket will be reopened on the next sample.

WebSocket Server: Is Close Always Called?

I'm building an iPhone app called AcaniChat. The server uses Node.js ws module. Can I assume that the Node.js ws close callback function is guaranteed to be called for every connection that ends? What if all of a sudden, I blew up my iPhone with a grenade? Would close get called on the server?
No. If the client closes its socket, the TCP connection would be closed, but the server socket would remain "open", although any further operations on the socket would result in an error (or an indication that the client closed the connection).
If the phone was blown up with a granade, the TCP connection wouldn't be closed gracefully, and any further operations on the server socket would result in an error (one different from the error if the client closed its socket).
So a close on a socket does two things: it closes the connection (if it isn't closed already), and releases any local system resources used for the socket object. So you should call close in all cases.

How to force close inactive Oracle sessions with ODP.NET

asp.net 2.0 using odp.net 10.1.04 to connect to Oracle 10g.
Our web application has once a day this problem: ODP-1000 "Connection request timed out".
As we know, this is a memory leak problem, caused due open connections that don't get closed and disposed.
We have double checked our code and all connections after open are closed and disposed. All odp.net objects like OracleCommand, Oracledatareader are disposed after used.
On web.config, this is our connection string:
<add key="ConnectionString" value="user id=xxxx;data source=XXXX;password=xxxxx;Pooling=True;Connection Timeout=15;Incr Pool Size=5;Decr Pool Size=3;Max Pool Size=300;Min Pool Size=10;Validate Connection=true;"/>
We have increased Connection Timeout to 60.
As we can't find in our code any unclosed connection, is there any way to close or destroy inactive Oracle sessions when conn.Open gets error "Connection request timed out"?
According to some information:
http://rainmanalex.wordpress.com/2008/11/13/odpnet-connection-string-attributes/
"The regulator thread is spawned every 3 minutes and closes up to Decr Pool Size amount of pooled connections if they are not used. "
Instead of waiting 3 minutes, is there any way to force close an inactive connection when getting error "Connection request timed out"?
Something like:
If conn.Open gets error "Connection request timed out"
Then
Destroy inactive Oracle session
Try again conn.Open
End If

MSDTC fails intermittently

I have a Windows 2003 server where MSDTC is running. I have set it to No Authentication Mode, with allow inbound-outbound settings. My MSDTC works but it fails for the 1st transaction of the day. On immediate another transaction it will start working.
Error is : The transaction has already been implicitly or explicitly committed or
aborted (Exception from HRESULT: 0x8004D00E).
So I started MSDTC tracing, in trace file it shows this :
pid=2144;tid=2528;time=12/02/2011-10:49:39.140;seq=531;eventid=TRACING_STARTED;;"MSDTC is resuming the tracing of long -lived transactions"
pid=2144;tid=2528;time=12/02/2011-10:49:39.140;seq=532; eventid=TRANSACTION_BEGUN; tx_guid=4df1b0cf-26a0-43ba-8f41-965d80f92441;"transaction got begun, description : ''"
pid=2144;tid=3288;time=12/02/2011-10:49:39.140;seq=533 ; eventid=RM_ENLISTED_IN_TRANSACTION; tx_guid=4df1b0cf-26a0-43ba-8f41-965d80f92441 ;"resource manager #1002 enlisted as transaction enlistment #1. RM guid = '4e45a393-b02a-42bf-8f66-62bcb17fee8e'"
pid=2144;tid=4164;time=12/02/2011-0:49:58.390;seq=534; eventid=TRANSACTION_PROPOGATION_FAILED_CONNECTION_DOWN_FROM_REMOTE_TM ;tx_guid=4df1b0cf-26a0-43ba-8f41-965d80f92441 ;"failed to propogate transaction to child node 'DBSERVER' because the connection with the remote transaction manager went down"
pid=2144;tid=4164;time=12/02/2011-10:49:58.390;seq=535; eventid=TRANSACTION_ABORTING;tx_guid=4df1b0cf-26a0-43ba-8f41-965d80f92441;"transaction is aborting"
pid=2144;tid=4164;time=12/02/2011-10:49:58.390;seq=536; eventid=RM_ISSUED_ABORT;tx_guid=4df1b0cf-26a0-43ba-8f41-965d80f92441 ;"abort request issued to resource manager #1002 for transaction enlistment #1"
pid=2144;tid=2528;time=12/02/2011-10:49:58.422;seq=537; eventid=RM_ACKNOWLEDGED_ABORT;tx_guid=4df1b0cf-26a0-43ba-8f41-965d80f92441;"received acknowledgement of abort request from the resource manager #1002 for transaction enlistment #1"
pid=2144;tid=2528;time=12/02/2011-10:49:58.422;seq=538; eventid=TRANSACTION_ABORTED;tx_guid=4df1b0cf-26a0-43ba-8f41-965d80f92441 ;"transaction has been aborted"
pid=2144;tid=3640;time=12/02/2011-10:50:29.437;seq=539;eventid=TRACING_STOPPED;;"MSDTC is suspending the tracing of long - lived transactions due to lack of activity"
I have applied hack of Davy Brion from here, http://davybrion.com/blog/2010/03/msdtc-woes-with-nservicebus-and-nhibernate/
Also set timeout interval to 10 minutes in Transaction Options.
If the server remains idle for a while again the transaction will fail.
Thanks in advance..
Here is the KB article that helped: 922430
If the MS DTC transaction trace log file contains this data, follow these steps:
Click Start, click Run, type regedit, and then click OK.
Locate the following registry subkey:
HKEY_LOCAL_MACHINE\Software\Microsoft\MSDTC
Right-click MSDTC, point to New, and then click DWORD Value.
Type CmMaxNumberBindRetries, and then press ENTER.
Right-click CmMaxNumberBindRetries, and then click Modify.
Click Decimal.
In the Value data box, type 60.
This value increases the length of time that the client computer waits for the bind packet response from the server computer. This value is double the number of seconds before the client computer stops the transaction if the client computer does not receive the bind packet response. For example, a value of 60 equals 30 seconds.
Note The value of 60 is only a recommended value. Additional testing on your configuration may be required.
Click OK.
Restart MS DTC.
Note For the slow response scenario, make sure that the ports that are required by Kerberos authentication (UDP 88 and TCP 88) are open when a firewall is involved in the Perimeter Network. The ports UDP 389 and TCP 389 (both for LDAP to find KDC) must also be open.

Resources