Giter VIP home page Giter VIP logo

Comments (5)

icraggs avatar icraggs commented on June 12, 2024

Closing this issue as I didn't get a response to my last question.

from paho.mqtt.c.

choka85 avatar choka85 commented on June 12, 2024

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.

icraggs avatar icraggs commented on June 12, 2024

I'll reopen as a result of Goran's comment.

from paho.mqtt.c.

icraggs avatar icraggs commented on June 12, 2024

Added

SocketBuffer_writeComplete(socket);

to SocketBuffer_cleanup() which is called by Socket_close();

from paho.mqtt.c.

icraggs avatar icraggs commented on June 12, 2024

Fix added to the develop branch.

from paho.mqtt.c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.