Comments (9)
Ok, I switched my code from paho-mqtt to gmqtt, ...and no issues anymore.
from flashmq.
Did you mean the log segment from #83 you created and closed to be for this ticket?
I can't really follow what you're saying. Your log shows your clients connects with a keep-alive timeout of 60s. The MQTT specs says the clients should be kicked after 1.5 times that, which FlashMQ does. I don't see any log lines to that effect. Instead, your clients connect and disconnect cleanly, about every 15 seconds. They connect and disconnect within 1 ms.
Can you show more client-side code? And, if the log I was looking at is not the correct one, can you also show logs?
from flashmq.
Did you mean the log segment from #83 you created and closed to be for this ticket?
Not really. I thought the bug of #83 was that the fd's were exactly the same, like it looked like it kept closing the same file descriptor. I thought that was potentially a bug. But I understood why it was creating new connections (being the one shot, mqttclient.publish method).
The issue I have here is the opposite, long running subscribers suddenly disconnecting, or being disconnected.
I can't really follow what you're saying. Your log shows your clients connects with a keep-alive timeout of 60s. The MQTT specs says the clients should be kicked after 1.5 times that, which FlashMQ does. I don't see any log lines to that effect. Instead, your clients connect and disconnect cleanly, about every 15 seconds. They connect and disconnect within 1 ms.
I'll try to come with with something reproducable... as in a few lines of code. If it is really as easy as 15 vs 60s that must be possible.
from flashmq.
You could post some FlashMQ log lines already. Perhaps I can already see something abnormal in them, and that saves you time.
from flashmq.
You could post some FlashMQ log lines already. Perhaps I can already see something abnormal in them, and that saves you time.
[2024-02-16 17:47:17.440] [NOTICE] Removing client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]'. Reason(s): Connection reset by peer
[2024-02-16 17:47:18.442] [NOTICE] Client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]' logged in successfully
[2024-02-16 17:47:48.556] [NOTICE] Removing client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]'. Reason(s): epoll says socket is in ERR or HUP state.
[2024-02-16 17:47:49.558] [NOTICE] Client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]' logged in successfully
[2024-02-16 17:48:19.636] [NOTICE] Removing client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]'. Reason(s): epoll says socket is in ERR or HUP state.
[2024-02-16 17:48:20.638] [NOTICE] Client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]' logged in successfully
[2024-02-16 17:48:31.500] [NOTICE] Removing client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]'. Reason(s): epoll says socket is in ERR or HUP state.
[2024-02-16 17:48:49.170] [NOTICE] Client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=1]' logged in successfully
from flashmq.
Interesting. A keep-alive of 15s is rather short BTW. I don't know if that's on purpose or not.
The interval between connecting and breaking the connection is 30s and 10s. Not constant.
Note: your clientid is too predictable. It opens up the door for somebody knowing it and kicking it out. Or, if you have two clients, they will be kicking each other out. You need to add a random string. Or, since you're using MQTT5, you can leave it empty, and the server will assign one.
from flashmq.
Interesting. A keep-alive of 15s is rather short BTW. I don't know if that's on purpose or not.
I hoped it would get better, not worse. Default in paho is 60.
The interval between connecting and breaking the connection is 30s and 10s. Not constant.
Note: your clientid is too predictable. It opens up the door for somebody knowing it and kicking it out. Or, if you have two clients, they will be kicking each other out. You need to add a random string. Or, since you're using MQTT5, you can leave it empty, and the server will assign one.
This is a single proces with a single client_id. So that was 'kind of' expected.
from flashmq.
@halfgaar can you check my following hypothesis?
- connect a client_id "1" (lets same this A)
- connect another client with the same client_id "1" (lets name this B)
- observe that both A and B get disconnected, while the user would expect that only A (the first) would get disconnected
from flashmq.
That doesn't happen. You can check that in the logs. The log fragment you posted says (note the reason):
[2024-02-16 17:48:31.500] [NOTICE] Removing client '[ClientID='triggers_portal', username='portal_publisher', fd=29, keepalive=15s, transport='TCP/Non-SSL', address='127.0.0.1', prot=5.0, clean=0]'. Reason(s): epoll says socket is in ERR or HUP state.
If you connect with an existing id, it says:
[2024-02-17 15:14:40.483] [NOTICE] Removing client '[ClientID='myfixedid', username='', fd=26, keepalive=60s, transport='TCP/Non-SSL', address='127.0.0.1', prot=3.1.1, clean=1]'. Reason(s): Another client with this ID connected, Server initiating disconnect with reason code '142'
The fact that the socket is an error state, suggests something is wrong with your connection or client.
from flashmq.
Related Issues (20)
- Fails to build with gcc 13 HOT 1
- Topic specific statistics
- flashmq_poll_remove_fd incorrect descriptor type HOT 3
- How can I bridge FlashMQ to another MQTT broker? HOT 6
- Multi-level wildcard out of spec HOT 5
- Is there a maximum number of retained messages? HOT 14
- Build of 1.7.2 fails with gcc 13.1.1 HOT 1
- Support lua scripting HOT 6
- Check if retained message has the same contents don't resend it
- If you connect to the broker with a Last Will and Testament (LWT) and correct username, the LWT is published even if the password is wrong. HOT 2
- docker hub image for flashmq
- Huge amount of rentained messages and restarting HOT 1
- Topic prefix stripping in server-to-server connections HOT 18
- FlashMQ keeps disconnecting the same socket?
- Last Will not working correctly? HOT 4
- Install on Raspberry Pi HOT 21
- Add armhf and arm64 builds to the apt repo for Raspberry Pi OS HOT 10
- Deal with empty user names some way HOT 1
- FlashMQ randomly dropping incoming SSL connections HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flashmq.