GithubHelp home page GithubHelp logo

Comments (7)

webmakersteve avatar webmakersteve commented on June 3, 2024 1

Awesome. I'll include the read-write locks in the next release.

from node-rdkafka.

martinambrus avatar martinambrus commented on June 3, 2024

Judging from this comment, which says:

Each broker has its own thread so the initial blocking connect() does not affect any other part of the library.

I assume those threads, while trying to connect initially, will block the execution in librdkafka itself. But I would still like to know your opinion, as this is just my assumption here.

from node-rdkafka.

webmakersteve avatar webmakersteve commented on June 3, 2024

.produce queues up a poll to get information about deliveries, etc. from kafka. I think what is happening potentially is that you are producing a message, which then queues up a poll. Poll is waiting for the connection to finish to actually get the next message, so the subsequent poll is blocking.

Can you make a test case that reproduces this behavior? If it is happening reliably, it is definitely unwanted behavior and I would like to fix it.

from node-rdkafka.

martinambrus avatar martinambrus commented on June 3, 2024

librdkafka-blocking-pool-poc.zip

here it comes... since we're working in Docker on Windows, I've included a docker file with instructions (2 lines of comments on top of Dockerfile) if you'd like to build this from scratch. Otherwise, this should work fine if you have librdkafka with NodeJS 6 on your machine.

from node-rdkafka.

webmakersteve avatar webmakersteve commented on June 3, 2024

It looks like this is a bug related to a deadlock. In the meantime, the Producer.produce method is not meant to be used outside of a closure for the on('ready') event or a callback from .connect. In this situation, it would throw anyway.

However, that doesn't mean I don't want to fix the deadlock!

from node-rdkafka.

webmakersteve avatar webmakersteve commented on June 3, 2024

I implemented a read/write lock instead of the single mutex for connections. You can try running your application with the code at this branch here:

https://github.com/Blizzard/node-rdkafka/tree/deadlock-dr-cb

There are a few other fixes I need to put in before it is merge-able, but for the time being it will be there. Let me know how it works for you.

from node-rdkafka.

martinambrus avatar martinambrus commented on June 3, 2024

seems to work fine now, I'm getting info about brokers being offline without anything being blocked, thumbs up and thank you!

from node-rdkafka.

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.