Giter VIP home page Giter VIP logo

Comments (6)

cynron avatar cynron commented on August 26, 2024

pc_client_cleanup will wait the uv loop to terminate, if you call pc_client_cleanup in callbacks, it will deadlock.

from libpomelo2.

xpol avatar xpol commented on August 26, 2024

it is pc_notify_with_timeout this time, not pc_client_cleanup.

from libpomelo2.

cynron avatar cynron commented on August 26, 2024

there are two mutexes here, polling_event_queue_mutex and tcp_send_queue_mutex
there are two threads, polling thread, uv loop thread

polling thread:
acquire event queue mutex -> invoke callback -> call pc_notify_with_timeout -> want send queue mutex

uv loop thread:
accquire send queue mutex -> uv tcp send ok -> add send complete event -> want event queue mutex

then, deadlock!

solution:
uv loop thread: after fetch a send item, release the send queue mutex

from libpomelo2.

cynron avatar cynron commented on August 26, 2024

solution 2:
when polling the event queue, release the event_mutex before pc__handle_event and re-acquire it after pc__handle_event finished.

from libpomelo2.

xpol avatar xpol commented on August 26, 2024

here is a pr for solution 2: #67.

from libpomelo2.

cynron avatar cynron commented on August 26, 2024

ok, goto #67 ,closing here

from libpomelo2.

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.