-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encapsulated package breaks the gateway #17
Comments
Please retry with "develop" branch. I will work on making the connection to a broker being a "lazy" one, i.e. established only when there is a data to be sent to a broker. |
Hi, Though another problem appeared. After connecting I let the client idle and the gateway crashed with SIGSEGV stdout:
stack trace:
Mosquitto Broker Log:
It looks like, the dongle (forwarded node) connects twice but I guess only one of them gets the PINGREQ/PINGRESP. In the log of my dongle I see the PINGREQ/PINGRESP packages. Thanks a lot for this feature, I'm more than happy to help you resolving the remaining issues. |
Thanks, I appreciate your help. My ability to properly test the forwarding encapsulation support is limited. I kind of reluctant and don't have much time to implement proper forwarding application to be able to reproduce problems in my environment. I've added some extra assert statements to the GatewaySession.cpp (on develop branch) which might help detect the problem. I won't have much time tomorrow, but on Friday I think I'll introduce the lazy broker connection I mentioned. After that it should be easier to get to the bottom of it. |
One thing that differs between "normal" node and forwarded node is the line in the gateway log
With the new changes I get the following logs:
And mosquitto log
So there is a client from port 58270, than the forwarded node connects from port 58256 and immediately disconnects and than connects again from port 41516. As we can see the dongle does not exceeds its timeout but the unknown client. I guess the one from port 58270. |
I think I know what the problem is, please try updated "develop" branch again. |
Did not solve it for me, my device does not get any PING/RESP/PINGREQ after the session is terminated for the dongle Gateway log:
mosquitto log:
|
I was talking about the crash / assert. I'll continue to work on it on
Friday
…On Wed, 28 Aug 2024, 21:24 trivialkettle, ***@***.***> wrote:
Did not solve it for me, my device does not get any PING/RESP/PINGREQ
after the session is terminated for the dongle
Gateway log:
[INFO]: New UDP client connection from: 127.0.0.1:43269
[INFO]: Connected client: dongle-D4:3E:27:6E:03:C3
[ERROR]: TCP/IP read error: End of file
[ERROR]: TCP/IP read error: End of file
[INFO]: Terminating session for client:
[INFO]: Terminating session for client: dongle-D4:3E:27:6E:03:C3
[INFO]: Terminated UDP client connection from: 127.0.0.1:43269
[INFO]: New UDP client connection from: 127.0.0.1:43269
[ERROR]: TCP/IP read error: End of file
[INFO]: Terminating session for client:
[INFO]: Terminating session for client:
[INFO]: Terminated UDP client connection from: 127.0.0.1:43269
mosquitto log:
broker-1 | 1724843537: New connection from 192.168.32.1:48172 on port 1883.
broker-1 | 1724843537: New connection from 192.168.32.1:48156 on port 1883.
broker-1 | 1724843537: New client connected from 192.168.32.1:48156 as dongle-D4:3E:27:6E:03:C3 (p2, c1, k10).
broker-1 | 1724843538: Client dongle-D4:3E:27:6E:03:C3 disconnected.
broker-1 | 1724843538: New connection from 192.168.32.1:48180 on port 1883.
broker-1 | 1724843538: New client connected from 192.168.32.1:48180 as dongle-D4:3E:27:6E:03:C3 (p2, c0, k10).
broker-1 | 1724843633: Client <unknown> has exceeded timeout, disconnecting.
broker-1 | 1724843633: Client dongle-D4:3E:27:6E:03:C3 closed its connection.
broker-1 | 1724843638: New connection from 192.168.32.1:52264 on port 1883.
broker-1 | 1724843638: New connection from 192.168.32.1:52280 on port 1883.
broker-1 | 1724843729: Client <unknown> has exceeded timeout, disconnecting.
broker-1 | 1724843729: Client <unknown> has exceeded timeout, disconnecting.
—
Reply to this email directly, view it on GitHub
<#17 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASJKGQYAU753N2D3LYZ37TZTWXNJAVCNFSM6AAAAABNGCMMP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJVGA2DSNJQGI>
.
You are receiving this because you commented.Message ID: <commschamp/cc.
***@***.***>
|
Introduced the following changes on "develop" branch:
|
Hi, But one issue still exists: Gateway log:
and mosquitto log:
I let it run for some hours to see if anything breaks. |
The "End of file" TCP/IP error usually means that the remote end (broker) closes its TCP/IP socket (connection). When such closure happens the gateway detects it and automatically re-connects using the recorded credentials picked up by the CONNECT / CONNACK messages exchange without notifying the client. That's why your client is not aware of it. I thought about implementing gateway logic to send DISCONNECT message to the client and then let the client to preform re-connection logic. However, it can create corner case races where client sends DISCONNECT message to enter sleep mode and if right after receiving such DISCONNECT message from the gateway, the client will perceive it as a sleep mode confirmation, while for gateway the client will be disconnected, not asleep. That's why I decided against it. There is a need to perform a thorough analysis of why the broker disconnects the client. The first step should be analyzing the MQTT v3.1.1 messages exchanged between the gateway and the broker. I guess you can use wireshark for that purpose, or you can use CommsChampion Tools for that purpose. To do so you can build the all the projects of CommsChampion Ecosystem in one go using cc.cmake project.
After the build is complete use Please let me know if you see any discrepancies between what you expect in those messages and when is actually been sent. Is "keep alive" configuration as expected? |
I've added an ability to emulate encapsulated session to the pub / sub client applications.
The output from the gateway is:
Add two "pub" clients sending from the same port but claiming different node IDs:
The output from the gateway is:
After a while when keep-alive value expires the "publish" clients are disconnected by the gateway (before the broker forces disconnection):
Everything seems to be working as expected, no unexpected termination from the broker. |
I'm closing this ticket. If after a thorough traffic analysis you come to a conclusion that the gateway doesn't behave as expected, please open a new ticket. |
Hi, |
Hi, After connect I use |
That makes sense. The MQTT v3.1.1 doesn't have an ability to change a will on the fly, requiring disconnection and re-connection from the gateway. However, the client should set its will through the connection procedure, rather than updating it after the connection is established. It will result in a single connection to the broker without reconnection later. |
Due to some system design decisions, I need to subscribe some topics first, to know what my |
Hi,
when I send the following encapsulated package to the gateway
the gateway crashes with the message
This is the first package my forwarder sends, so it did not connect or anything before.
Thanks for you help.
The text was updated successfully, but these errors were encountered: