Details
Description
mender-connect obtains Mender server JWT and URL via D-Bus API
mender-connect logic to detect if a reconnect is needed relies only on the length of the JWT token being > 0, which means that:
- It will not trigger a re-connect on changes to ServerURL
- It will not trigger a re-connect on changes to the JWT token itself
See:
- https://github.com/mendersoftware/mender-connect/blob/b6c22bebcd2f30d07e25993797d36d90df6090c9/app/daemon.go#L254
- https://github.com/mendersoftware/mender-connect/blob/b6c22bebcd2f30d07e25993797d36d90df6090c9/app/daemon.go#L322
It can easily be triggered by manually restarting mender-client service few times after mender-connect has already established the websocket connection.
We suspect that this is the cause for TestAccessEnterprise::test_upgrades to sometimes hang forever waiting for mender-connect to re-connect. See sample log here.
Note that this bug was present already before MEN-5216 and affects currently released versions of mender-connect. However before MEN-5216 the scenarios when this would affect the user are very few.
Acceptance criteria:
- Bug is fixed
- New integration test
- checking that mender-connect reconnects when JWT returned over D-Bus changes
- checking that mender-connect reconnects when ServerURL changes
- checking that mender-connect reconnects when both ServerURL and JWT change