[Urgent]PubSub Subscribe MQTT Connection is automatically closed after 10 minutes

48 views
Skip to first unread message

Chirantan Joshi

unread,
Jul 26, 2024, 10:54:57 AM7/26/24
to open62541
Hi Team,
I am using Open62541 SDK to create a PUBSUB MQTT based connection. 

For 10 minutes the connection works smoothly but after 10 minutes, suddenly the TCP and MQTT connections are closed and new connections are not getting established.

Any help will be appreciated...

Thanks,
Chirantan

Julius Pfrommer

unread,
Jul 26, 2024, 11:04:04 AM7/26/24
to open62541
Please enable (debug) logging and post the log output here.
That way we can establish if the OPC UA server closed the application or the remote side.

Chirantan Joshi

unread,
Jul 29, 2024, 7:26:31 AM7/29/24
to open62541
Thanks Julius for quick reply.
Please find below the screenshots of logs...

Logs till messages are received successfully:

Screenshot 1.png

Logs on connection close:

Screenshot 2.png

After message "Created broker connection", the server stopped.

Waiting for your response..

Thanks,
Chirantan

Jacky Bek

unread,
Jul 31, 2024, 2:17:52 AM7/31/24
to Chirantan Joshi, open62541
I experienced this errors a few years ago .. seemed not fixed yet after so long.
Sent from my iPhone

On 29 Jul 2024, at 19:26, Chirantan Joshi <jchiran...@gmail.com> wrote:

Thanks Julius for quick reply.
Please find below the screenshots of logs...

Logs till messages are received successfully:

<Screenshot 1.png>


Logs on connection close:

<Screenshot 2.png>


After message "Created broker connection", the server stopped.

Waiting for your response..

Thanks,
Chirantan
On Friday, July 26, 2024 at 8:34:04 PM UTC+5:30 Julius Pfrommer wrote:
Please enable (debug) logging and post the log output here.
That way we can establish if the OPC UA server closed the application or the remote side.

Chirantan Joshi schrieb am Freitag, 26. Juli 2024 um 16:54:57 UTC+2:
Hi Team,
I am using Open62541 SDK to create a PUBSUB MQTT based connection. 

For 10 minutes the connection works smoothly but after 10 minutes, suddenly the TCP and MQTT connections are closed and new connections are not getting established.

Any help will be appreciated...

Thanks,
Chirantan

--
You received this message because you are subscribed to the Google Groups "open62541" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open62541+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/open62541/a166956f-ed91-4014-82c7-9a9a8457e569n%40googlegroups.com.
<Screenshot 1.png>
<Screenshot 2.png>

Chirantan Joshi

unread,
Jul 31, 2024, 2:18:00 AM7/31/24
to open62541
Some other user also facing the same problem..
Screenshot 3.png

Please provide some help on this...

Julius Pfrommer

unread,
Jul 31, 2024, 2:20:13 AM7/31/24
to open62541
So the remote-side is closing the socket.
Do you get logs from the MQTT broker also?

It might be that we do not send out heartbeat messages to keep the connection open.

Regards, Julius

Julius Pfrommer

unread,
Jul 31, 2024, 2:44:02 AM7/31/24
to open62541
Chirantan,

we *do* send a ping as keep-alive.

And/or see if you can get logs from the broker why he closes the connection.

Regards, Julius

Chirantan Joshi

unread,
Aug 2, 2024, 5:23:31 AM8/2/24
to open62541
Thanks Julius for your help

I tested with the changes you suggested, but it did not work.

Below is the analysis which I have done:
  • I went through the broker logs and found that broker was terminating the connection due to timeout.
  • In the eventloop_mqtt.c file you have added cyclic callback which has keep alive count as (bc->keepalive * 0.75 * UA_DATETIME_SEC)
  • So, I just checked the value of UA_DATETIME_SEC which turned out to be 10,000,000 milliseconds.
Screenshot 5.png
  • So, the keepalive time was calculated to (Default keepalive)400*10,000,000 milliseconds = 40,000seconds
  • That was the reason that ping was never triggered and after 10 minutes the broker was closing the connection.

  • When I used UA_DATETIME_USEC instead of UA_DATETIME_SEC, it worked fine.
Screenshot 4.png

Can you please consider this change and add it to the code?

Thanks,
Chirantan

Julius Pfrommer

unread,
Aug 2, 2024, 5:24:10 AM8/2/24
to open62541
Dang. You are right.
This now corrected on the 1.4 branch.

Thanks for the report.

Regards, Julius
Reply all
Reply to author
Forward
0 new messages