Coder Social home page Coder Social logo

Comments (5)

thunderstumpges avatar thunderstumpges commented on September 17, 2024

From what I recall of the design, and from a cursory look at the code, there is only ever one single thread per Producer that is in SendLoop() (each Producer instance has one sender thread). It is also normal for a producers send thread to wait on that event if there are no messages to send.

How many producers are being created by serilog-sinks-kafka? Can you verify the number of Producer instances? In general, you should share a single producer instance across the application (or at least major subsystem of the application). This may very well be an issue with serilog-sinks-kafka. We are using kafka4net heavily from IIS for logging many events, and see none of this issue.

from kafka4net.

thunderstumpges avatar thunderstumpges commented on September 17, 2024

a 5 minute look at serilog-sinks-kafka (I don't know serilog, or how many of these KafkaClient objects are created, but their method GetOrCreateKafkaProducerAsync does NOT perform double-check-locking and has a very possible race condition allowing many producers to be created.

https://github.com/wespday/serilog-sinks-kafka/blob/5b0d311fa3eb4e1d76a8a694cab99d9bed544d3f/src/Serilog.Sinks.Kafka/Sinks/Kafka/KafkaClient.cs#L98

from kafka4net.

sungam3r avatar sungam3r commented on September 17, 2024

Thank you for explanation! I will verify the number of Producer instances created by serilog-sinks-kafka.
And just for the sake of interest what about infinite wait timeout?

from kafka4net.

sungam3r avatar sungam3r commented on September 17, 2024

Yep, double-check-locking in serilog-sinks-kafka source code in GetOrCreateKafkaProducerAsync with some other minor modifications helped to solve this problem. Thank you again.

from kafka4net.

thunderstumpges avatar thunderstumpges commented on September 17, 2024

Great Glad to hear it.

from kafka4net.

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.