{"record":{"id":"0eab3195b5a41f02","repo":"fluent/fluentd","slug":"bug-send-keepalive-packet-is-available-for-tcp-tl","errorCode":null,"errorMessage":"BUG: send_keepalive_packet is available for tcp/tls","messagePattern":"BUG: send_keepalive_packet is available for tcp/tls","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/fluent/plugin_helper/socket_option.rb","lineNumber":42,"sourceCode":"      # ref: https://docs.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-linger\n      FORMAT_STRUCT_LINGER_WINDOWS  = 'S!S!' # { u_short l_onoff; u_short l_linger; }\n      FORMAT_STRUCT_LINGER  = 'I!I!' # { int l_onoff; int l_linger; }\n      FORMAT_STRUCT_TIMEVAL = 'L!L!' # { time_t tv_sec; suseconds_t tv_usec; }\n\n      def socket_option_validate!(protocol, resolve_name: nil, linger_timeout: nil, recv_timeout: nil, send_timeout: nil, receive_buffer_size: nil, send_keepalive_packet: nil)\n        unless resolve_name.nil?\n          if protocol != :tcp && protocol != :udp && protocol != :tls\n            raise ArgumentError, \"BUG: resolve_name in available for tcp/udp/tls\"\n          end\n        end\n        if linger_timeout\n          if protocol != :tcp && protocol != :tls\n            raise ArgumentError, \"BUG: linger_timeout is available for tcp/tls\"\n          end\n        end\n        if send_keepalive_packet\n          if protocol != :tcp && protocol != :tls\n            raise ArgumentError, \"BUG: send_keepalive_packet is available for tcp/tls\"\n          end\n        end\n      end\n\n      def socket_option_set(sock, resolve_name: nil, nonblock: false, linger_timeout: nil, recv_timeout: nil, send_timeout: nil, receive_buffer_size: nil, send_keepalive_packet: nil)\n        unless resolve_name.nil?\n          sock.do_not_reverse_lookup = !resolve_name\n        end\n        if nonblock\n          sock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)\n        end\n        if Fluent.windows?\n          # To prevent closing socket forcibly on Windows,\n          # this options shouldn't be set up when linger_timeout equals to 0 (including nil).\n          # This unintended behavior always occurs on Windows when linger_timeout.to_i == 0.\n          # This unintended behavior causes \"Errno::ECONNRESET: An existing connection was forcibly\n          # closed by the remote host.\" on Windows.\n          if linger_timeout.to_i > 0","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/fluent/fluentd/blob/dd45c6e18dc7be33b5e5a0f0767bf46307ff5626/lib/fluent/plugin_helper/socket_option.rb#L24-L60","documentation":"Error \"BUG: send_keepalive_packet is available for tcp/tls\" thrown in fluent/fluentd.","triggerScenarios":"Thrown at lib/fluent/plugin_helper/socket_option.rb:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"dd45c6e18dc7be33b5e5a0f0767bf46307ff5626","analyzedAt":"2026-08-21T16:22:07.332Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}