thingsboard / tbmq

Open-source, scalable, and fault-tolerant MQTT broker able to handle 4M+ concurrent client connections, supporting at least 3M messages per second throughput per single cluster node with low latency delivery. The cluster mode supports more than 100M concurrently connected clients.
https://thingsboard.io/products/mqtt-broker/
Apache License 2.0
570 stars 46 forks source link

[Bug] TBMQ Sessions Tab does not show #129

Closed gaizkasi closed 2 months ago

gaizkasi commented 2 months ago

In the latest weeks I have been testing TBMQ as a possible integration for my Thingsboard Professional instance.

I used Basic Auth configuration enabled and _mosquittosub and _mosquittopub locally in order to see how the UI interface shows connections or messages. While I was testing I found that the UI does not work as I expect and they might be bugs:

I attach screenshots of what is happening below.

What is happening? Is it a bug? Could you help me?

This is what I used to open TBMQ UI in the browser:

I simulate a device using Mosquitto command in the same server in what TBMQ is running.

Steps to reproduce the behavior:

  1. Create DEVICE credentials.
  2. Subscribe with Check Connection example command.
  3. Check if a sessions is open in Sessions Tab.
  4. Try to publish a message by mosquitto command to the same topic which is subscribed.
  5. Check if a sessions still does not appear.

The sessions should appear in TBMQ UI as well as the incoming messages.

Screenshots Credentials Subscription PUB PublishInSUB Sessions MessageMonitoring

dmytro-landiak commented 2 months ago

hi @gaizkasi !

Thank you for raising this issue.

Please verify whether the Mosquitto broker is running, as it appears the messages might be directed there instead of TBMQ. To check this, modify the credentials (username/password) for your mosquitto_pub and mosquitto_sub commands to invalid ones for TBMQ. If the clients are connecting to TBMQ, you should see an "unauthorized" error. However, if the connections are successful and messages are being transferred, it likely means they are being sent to the Mosquitto broker.

The Mosquitto broker might be running from the setup process of the Mosquitto client.

If this is the case, please ensure the Mosquitto broker is stopped and then reproduce your steps.

If you have any more questions, please let me know.

Regards!

gaizkasi commented 2 months ago

Hi Dima,

Thanks for your fast response. If I try to run mosquito broker it reports an error because its port is already in use. It means that the port and broker used is TBMQ.

@.***

@.***

What coud be happening?

I looking forward to hearing from you.

Thank you so much!

Gaizka

Hemendik: Dima Landiak @.> Bidaltze-data: jueves, 20 de junio de 2024 10:15 Hona: thingsboard/tbmq @.> Cc: Gaizka Suarez Iparragirre (Ingeteam R&D Europe) @.>; Mention @.> Gaia: Re: [thingsboard/tbmq] [Bug] TBMQ Sessions Tab does not show (Issue #129)

This email comes from an external source.

hi @gaizkasihttps://github.com/gaizkasi !

Thank you for raising this issue.

Please verify whether the Mosquitto broker is running, as it appears the messages might be directed there instead of TBMQ. To check this, modify the credentials (username/password) for your mosquitto_pub and mosquitto_sub commands to invalid ones for TBMQ. If the clients are connecting to TBMQ, you should see an "unauthorized" error. However, if the connections are successful and messages are being transferred, it likely means they are being sent to the Mosquitto broker.

The Mosquitto broker might be running from the setup process of the Mosquitto client.

If this is the case, please ensure the Mosquitto broker is stopped and then reproduce your steps.

If you have any more questions, please let me know.

Regards!

— Reply to this email directly, view it on GitHubhttps://github.com/thingsboard/tbmq/issues/129#issuecomment-2180085703, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANLZ4L56VRHIWZJYVLEGPJDZIKFPHAVCNFSM6AAAAABJTNCBC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBQGA4DKNZQGM. You are receiving this because you were mentioned.Message ID: @.**@.>>

Gaizka Suarez Iparragirre Digital Transformation Ingeteam Research Institute

[cid:logo_ingeteam_no_claim_24684692-cdd2-4135-a085-5629b9c82597.png]

[Firma 2023-10.png] +34944039600

[Firma 2023-11.png] Parque Tecnológico de Bizkaia, Edificio 106 48170, Zamudio, Spain

https://www.linkedin.com/[cid:firma2023-12_4315b2dd-c257-4deb-9674-67b01fd4b114.png]https://es.linkedin.com/company/ingeteam-s-a [cid:Ingeteam_LogoX_967888ea-dec5-4cb9-a2f6-f165f950fc18.png] https://twitter.com/ingeteam https://www.youtube.com/ [cid:firma2023-14_8a2e8fc2-6879-44f4-9dd8-1e8c8966ce5b.png] https://www.youtube.com/channel/UClw6UQfVayy-jXSSBkd97Nw [cid:firma2023-15_5ebc2c9e-9a31-49e4-864b-1760197e6d57.png] https://www.instagram.com/ingeteam [cid:QR0bfa9786-8367-4b49-be1f-09bdcb06edda.png][cid:MyCard60x25_MyCard-2-60x25px_MyCard-2-60x25px_8a646492-d763-4a24-9462-d38d5bbffecc.png] https://www.ingeteam.com/es-es/marketing/50aniversario.aspx[cid:NuevoLogoTRDTnegrita_9b13c2ef-c1a5-4e74-af08-d8e04043f784.png]

Este e-mail puede contener información reservada o confidencial destinada exclusivamente al destinatario o a la persona encargada de distribuirlo. Si por error usted no fuera el destinatario le rogamos nos lo comunique al mail @.**@.>, sin difundir, almacenar o copiar su contenido. Consulte aquí nuestra Política de Privacidadhttps://www.ingeteam.com/es-es/legal/politicadeprivacidad.aspx.

This e-mail may contain reserved or confidential information intended exclusively for the addressee or the person in charge of distributing it. If by mistake you are not the addressee, please inform us at @.**@.>, without spreading, storing or copying its content. See our privacy policyhttps://www.ingeteam.com/en-us/legal/privacypolicy.aspx here.

dmytro-landiak commented 2 months ago

@gaizkasi could you point me to the instruction guide you used for tbmq deployment?

is it this one - https://thingsboard.io/docs/mqtt-broker/install/docker/?

gaizkasi commented 2 months ago

Yes! It exactly this one.

The TBMQ is running properly, the only thing I don’t understand is why the UI do not show connections and traffic.

Regards,

Gaizka

Hemendik: Dima Landiak @.> Bidaltze-data: jueves, 20 de junio de 2024 10:36 Hona: thingsboard/tbmq @.> Cc: Gaizka Suarez Iparragirre (Ingeteam R&D Europe) @.>; Mention @.> Gaia: Re: [thingsboard/tbmq] [Bug] TBMQ Sessions Tab does not show (Issue #129)

This email comes from an external source.

@gaizkasihttps://github.com/gaizkasi could you point me to the instruction guide you used for tbmq deployment?

is it this one - https://thingsboard.io/docs/mqtt-broker/install/docker/?

— Reply to this email directly, view it on GitHubhttps://github.com/thingsboard/tbmq/issues/129#issuecomment-2180127728, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANLZ4L7M6F47YGDVWTYUCP3ZIKH6TAVCNFSM6AAAAABJTNCBC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBQGEZDONZSHA. You are receiving this because you were mentioned.Message ID: @.**@.>>

Gaizka Suarez Iparragirre Digital Transformation Ingeteam Research Institute

[cid:logo_ingeteam_no_claim_24684692-cdd2-4135-a085-5629b9c82597.png]

[Firma 2023-10.png] +34944039600

[Firma 2023-11.png] Parque Tecnológico de Bizkaia, Edificio 106 48170, Zamudio, Spain

https://www.linkedin.com/[cid:firma2023-12_4315b2dd-c257-4deb-9674-67b01fd4b114.png]https://es.linkedin.com/company/ingeteam-s-a [cid:Ingeteam_LogoX_967888ea-dec5-4cb9-a2f6-f165f950fc18.png] https://twitter.com/ingeteam https://www.youtube.com/ [cid:firma2023-14_8a2e8fc2-6879-44f4-9dd8-1e8c8966ce5b.png] https://www.youtube.com/channel/UClw6UQfVayy-jXSSBkd97Nw [cid:firma2023-15_5ebc2c9e-9a31-49e4-864b-1760197e6d57.png] https://www.instagram.com/ingeteam [cid:QRd99967c9-59e8-4cb8-b5dd-aa5f95296dfa.png][cid:MyCard60x25_MyCard-2-60x25px_MyCard-2-60x25px_8a646492-d763-4a24-9462-d38d5bbffecc.png] https://www.ingeteam.com/es-es/marketing/50aniversario.aspx[cid:NuevoLogoTRDTnegrita_9b13c2ef-c1a5-4e74-af08-d8e04043f784.png]

Este e-mail puede contener información reservada o confidencial destinada exclusivamente al destinatario o a la persona encargada de distribuirlo. Si por error usted no fuera el destinatario le rogamos nos lo comunique al mail @.**@.>, sin difundir, almacenar o copiar su contenido. Consulte aquí nuestra Política de Privacidadhttps://www.ingeteam.com/es-es/legal/politicadeprivacidad.aspx.

This e-mail may contain reserved or confidential information intended exclusively for the addressee or the person in charge of distributing it. If by mistake you are not the addressee, please inform us at @.**@.>, without spreading, storing or copying its content. See our privacy policyhttps://www.ingeteam.com/en-us/legal/privacypolicy.aspx here.

dmytro-landiak commented 2 months ago

@gaizkasi,

There are no known issues related to this matter, so the problem likely stems from a misconfiguration on your host machine.

Could you meanwhile try to use the WebSocket client and connect the default connection to TBMQ: image

Note, that you do not need to update the details of the connection in case the default installation steps were used.

Then check if the client session appears in the Session tab.

gaizkasi commented 2 months ago

@dmytro-landiak

Firstly, this interface reports me always this message: irudia

But, if I close it and I try to create new connection then, despite it does not appear in WebSocket client tab, credentials are created: irudia

But, I do not know how to do there...

dmytro-landiak commented 2 months ago

@gaizkasi,

It seems there might be issues with the DB schema and tables. Did you upgrade from a previous version of TBMQ to 1.3.0? That could explain the issue. Did the upgrade process complete successfully?

Please provide the TBMQ logs with the error message for the confirmation.

If this is a development server, I recommend redeploying TBMQ from scratch. Ensure you remove the data storage volumes first, as a new installation won't occur otherwise.

image

gaizkasi commented 2 months ago

Hi @dmytro-landiak !

I solved the error reinstalling again everything. Now I could work in WebSocket screen but, I try to connect and it reports always reconnecting.

irudia

Now, after upgrade to 1.3.0 I have got TBMQ WebSockets MQTT Credentials created by default. I've followed the basic guide of TBMQ and I've created new credentials for Getting Started Credentials, step by step. This is the link: https://thingsboard.io/docs/mqtt-broker/getting-started/

irudia

But when I used this commands in the server the sessions tab does not change, there is nothing there:

irudia

It is unbelievable how such a simple tasks does not work. It is impossible for me to identify what I'm doing wrongly...

dmytro-landiak commented 2 months ago

@gaizkasi,

Could you please try to use the following command and show me the screenshot of the console as you showed above?

mosquitto_pub -d -h localhost -p 1883 -t sensors/temperature -m 32 -q 1 -u wrongusername -P password
gaizkasi commented 2 months ago

This is the result...

irudia

dmytro-landiak commented 2 months ago

as I can see the message is delivered successfully even though the wrong username is used because you do not have the credentials created in the TBMQ with the specified username.

Could you please execute the following command and show the result?

sudo lsof -i :1883
gaizkasi commented 2 months ago

Hi @dmytro-landiak !

I have solved it... I do not why but, as you guessed, MOSQUITTO was running and the MQTT traffic was going to this broker instead of TBMQ. I do not understand why UI reports that it was running MQTT Broker at 1883 when the port was using by external mosquitto. Now I can see the sessions and if I execute the command: irudia

I stop system service stop I changed in docker compose the port to from 1884:1884 to 1883:1883 and I restart the dockers. I think UI should be changed in order to report the regarding MQTT port, the one that it is configured in docker compose.

Besides, I have got an extra question. It is compulsory to have a credential created by UI before subscribing or publishing or not?

Thank you so much for your help and fast responses!

dmytro-landiak commented 2 months ago

Hi @gaizkasi,

The user interface displays the port configured for the application running inside the container. Currently, it does not detect if the port is forwarded from the host to the Docker container (that's why it shows 1883 instead of 1884 or anything else). We understand this can be confusing and will revisit this issue for future improvements.

In the meantime, you can set the environment variable SECURITY_MQTT_BASIC_ENABLED to false. This will disable authentication for clients and remove the need to create credentials via the UI.

If you have any more questions, please let me know.

Best regards,

gaizkasi commented 2 months ago

Thank you so much @dmytro-landiak! Every doubt solved, we can close the issue :)