kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jun Rao <jun...@gmail.com>
Subject so_linger in socket
Date Fri, 22 Jul 2011 17:05:44 GMT

We noticed that when we close the producer (and therefore the underlying
socket), the last batch of messages sometimes are not delivered to the
broker. We are not completely sure what's causing this, but suspect that may
have to do with the so_linger flag in socket. The following is a link and an
excerpt about the flag.


Lingers on a *close*()<https://email.corp.linkedin.com/owa/redir.aspx?C=881a0d1e0e574952ac705b9d4e935272&URL=http%3a%2f%2fpubs.opengroup.org%2fonlinepubs%2f009695399%2ffunctions%2fclose.html>
data is present. This option controls the action taken when unsent messages
queue on a socket and
performed. If SO_LINGER is set, the system shall block the calling thread
during *close*()<https://email.corp.linkedin.com/owa/redir.aspx?C=881a0d1e0e574952ac705b9d4e935272&URL=http%3a%2f%2fpubs.opengroup.org%2fonlinepubs%2f009695399%2ffunctions%2fclose.html>
it can transmit the data or until the time expires. If SO_LINGER is not
specified, and *close*()<https://email.corp.linkedin.com/owa/redir.aspx?C=881a0d1e0e574952ac705b9d4e935272&URL=http%3a%2f%2fpubs.opengroup.org%2fonlinepubs%2f009695399%2ffunctions%2fclose.html>
issued, the system handles the call in a way that allows the calling thread
to continue as quickly as possible. This option takes a*linger* structure,
as defined in the
to specify the state of the option and linger interval.

Anybody knows more about the socket stuff? Should so_linger be set to make
sure that the last unsent messages are delivered before close? Any downside
to enable so_linger?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message