Skip to content
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

MQTT subscriptions disconnected from mqtt broker #1427

Open
thinkingmik opened this issue Aug 31, 2023 · 1 comment
Open

MQTT subscriptions disconnected from mqtt broker #1427

thinkingmik opened this issue Aug 31, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@thinkingmik
Copy link

thinkingmik commented Aug 31, 2023

Hi,

I have some problems with MQTT subscriptions. I'm using Orion-LD:1.4.0 and Mosquitto as MQTT Broker.

I created a subscription on Orion-LD with api call:

POST /ngsi-ld/v1/subscriptions HTTP/1.1
Host: localhost:3626
NGSILD-Tenant: acme
Content-Type: application/json
Content-Length: 545

{
    "description": "Notify MQTT",
    "type": "Subscription",
    "entities": [
        {
            "type": "Vehicle"
        }
    ],
    "watchedAttributes": [
        "vname",
        "latitude",
        "longitude"
    ],
    "notification": {
        "attributes": [
            "vname",
            "latitude",
            "longitude"
        ],
        "format": "normalized",
        "endpoint": {
            "uri": "mqtt://mosquitto:3638/positions",
            "accept": "application/json"
        }
    }
}

When I trigger the subscription on Orion-LD everythings goes well and I see on the MQTT Broker this log:

New client connected from x.x.x.x as Orion-LD (p2, c1, k20).
Received PUBLISH from Orion-LD (d0, q0, r0, m0, 'positions', ... (591 bytes))

So, if the connection stay idle for more than 20 seconds and after I trigger the subscription, the MQTT Broker says (and there is no way to reconnect the subscriptions without restarting Orion-LD):

Client Orion-LD has exceeded timeout, disconnecting.

I think that Orion-LD don't send the PINGREQ to MQTT Broker for keeping alive the connection (in the MQTT Broker logs I don't see any incoming calls of type PINGREQ from Orion-LD like others clients do).
I don't find any variable to set the keepalive k20 (seems to be the default). I see in the Orion version that exists a -mqttMaxAge but in the Orion-LD implementations I don't find this property.

Furthermore, if I'm restarting the MQTT Broker, the Orion-LD subscriptions loose the connection to the MQTT Broker and the only way for reconnecting is restarting Orion. I saw in the past issues #723 that this was fixed but in this version I encountered the same problem.

Thanks.

@kzangeli kzangeli self-assigned this Aug 31, 2023
@kzangeli kzangeli added the bug Something isn't working label Aug 31, 2023
@kzangeli
Copy link
Collaborator

ok!
Thanks for reporting.
Seems like you've found a bug indeed.
I will look into this asap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants