Comments (5)
Closing this issue as I didn't get a response to my last question.
from paho.mqtt.c.
Hey guys..
I ran into same issue mentioned here. This issue occurs after SSL_write() in SSLSocket_putdatas() fails, paho adds failed write to the "writes" list which should be written later through SSLSocket_continueWrite() function. If paho client gets disconnected before SSLSocket_continueWrite() finishes its job, SSLSocket_close() will free same SSL structure (net->ssl) which is added in"writes" list SSLSocket_putdatas. When paho reconnects and tries to finish write from "writes" list in SSLSocket_continueWrite(), crash usually occurs in SSL_write(pw->ssl,...) bcs passed argument "pw->ssl" is actually freed SSL structure pointer from SSLSocket_close() which is freed when disconnection occurred. So, now pw->ssl structure fields now contain some random values which cause app to crash mostly with SIGSEGV while dereferencing ((int*)pw->ssl)[2].. sometimes also with SIGBUS, SIGILL or memory leak occurs and app freezes at some point... depends on new random values in pw->ssl...
I simply added SocketBuffer_writeComplete(net->socket) in SSLSocket_close() which fixed this issue.. Not sure if that's best possible solution though but removing that unfinished write from a list prevented app to crash for me at least....
Also, I haven't mentioned that we are using QoS1..
Best Regards,
Goran
from paho.mqtt.c.
I'll reopen as a result of Goran's comment.
from paho.mqtt.c.
Added
SocketBuffer_writeComplete(socket);
to SocketBuffer_cleanup() which is called by Socket_close();
from paho.mqtt.c.
Fix added to the develop branch.
from paho.mqtt.c.
Related Issues (20)
- The crash in macOS occurs after the MQTTProtocol_emptyMessageList method. HOT 3
- 'Disconnected' callback not firing HOT 7
- Client not honoring server keep alive in CONNACK HOT 3
- Building Paho MQTT 1.3.13 client with OpenSSL 1.0.2 on Windows 11 HOT 3
- v1.3.13 official example "Connect failed, rc -1"
- Solution for #1383 causes build to fail on LibreSSL (missing OPENSSL_thread_stop())
- Some improvements and cleanup of CMake build
- V1.3.13: Memory leak when call MQTTAsync_sendMessage with QOS0 HOT 5
- long connection latency when setting up multiple mqtt connections
- Memory leak in Protocol_processPublication() HOT 2
- Releases: win64-1.3.13 contains static libs instead of dlls
- Using both Paho-C and Paho-CPP HOT 1
- update log or doc HOT 3
- Get segfaults when the network is weak in SSL_CTX_set_info_callback HOT 1
- MQTT client has a long delay time to retransmit in-flight message when using MQTTCLIENT_PERSISTENCE_DEFAULT flag
- How to stop the reconnection of MQTTClient? HOT 5
- [Question] Must MQTTAsync_destroy be called after the disconnect operation completed? HOT 2
- The asynchronous 'SetCallbacks' function requires a 'MessageArrived' function even in a publication scenario
- Time logging once per 20 msgs alternatives HOT 1
- Occasional Crash in Main Program Calling paho.mqtt.c Library HOT 2
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 paho.mqtt.c.