GithubHelp home page GithubHelp logo

deadlock on event_del_nolock_() about libevent HOT 2 OPEN

legale avatar legale commented on September 24, 2024
deadlock on event_del_nolock_()

from libevent.

Comments (2)

liudongmiao avatar liudongmiao commented on September 24, 2024 1

@legale I suggest you don't reuse the ac->events.mqtt_loop.ev. use event_new, then use event_free, avoid use event_del and event_assign.

You add an event for EV_READ and EV_WRITE, and select in the callback. Please note, most of the time, the sock can be writable, so the callback would be called, then I see you do a select in the callback.

And I suggest you use different events like ev_write and ev_read, then disable ev_write if there is nothing to write. Otherwise, you use the same event for both ev_read and ev_write, you need do select in the callback, then why do you use libevent? (That's the way of bufferevent_socket.) If the underlying socket is udp, you can use other magic way.

from libevent.

azat avatar azat commented on September 24, 2024

Looks like lines does not match.

Anyway it is hard to say something based on provided samples. But you can try to compile with TSan at least, and see what it will report about deadlocks. Also if you have threads, please make that you enabled pthread support (evthread_use_pthreads())

from libevent.

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.