You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When it send the very long data at once from the client, it causes error with JSON data or warning with MessagePack format.
In my environment, this always happens when I send more than 256 KB at once.
To Reproduce
It just sends data using following code
# frozen_string_literal: truerequire"socket"require"json"require"msgpack"FORMAT=:jsonUNIX_SOCKET_PATH="/tmp/fluentd-unix.sock"DATA_LENGTH=1024 * 256defdata_generaterd=['test',Time.now.to_i,{"length_#{DATA_LENGTH}": "a" * DATA_LENGTH}]caseFORMATwhen:jsond.to_jsonwhen:msgpackMessagePack.pack(d)elseraise"unknown format: #{FORMAT}"endendbegins=UNIXSocket.new(UNIX_SOCKET_PATH)loopdodata=s.send(data_generater,0)sleep1endrescueErrno::EPIPE=>epeensures&.closeend
The data received by the cool.io gem is delimited to 16384 bytes or less and passed to the application.
However, Fluentd might not handle it properly, I think.
require'bundler/inline'gemfiledosource'https://rubygems.org'gem'cool.io'endrequire"socket"require"json"require'fileutils'UNIX_SOCKET_PATH="/tmp/fluentd-unix.sock"DATA_LENGTH=1024 * 256FileUtils.rm_f(UNIX_SOCKET_PATH)classClientdefdata_generaterd=['test',Time.now.to_i,{"length_#{DATA_LENGTH}": "a" * DATA_LENGTH}]d.to_jsonenddefrunThread.newdos=UNIXSocket.new(UNIX_SOCKET_PATH)sleep0.5data=data_generaters.send(data,0)puts"[client] sent size = #{data.size}"s.closeputs"[client] Finished!!"endendendclassServerConnection < Cool.io::UNIXSocketdefon_connectputs"[server] connected"enddefon_closeputs"[server] disconnected"exitenddefon_read(data)puts"[server] received size = #{data.size}"endendserver=Cool.io::UNIXServer.new(UNIX_SOCKET_PATH,ServerConnection)server.attach(Cool.io::Loop.default)Client.new.runCool.io::Loop.default.run
$ ruby coolio.rb
/home/watson/.rbenv/versions/3.3.5/lib/ruby/3.3.0/json/common.rb:3: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add ostruct to your Gemfile or gemspec to silence this warning.
[server] connected
[client] sent size = 262184
[server] received size = 16384
[client] Finished!!
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 16384
[server] received size = 6272
[server] disconnected
Describe the bug
When it send the very long data at once from the client, it causes error with JSON data or warning with MessagePack format.
In my environment, this always happens when I send more than 256 KB at once.
To Reproduce
It just sends data using following code
client side
Fluentd side
Expected behavior
No errors
Your Environment
Your Configuration
Your Error Log
JSON
Send JSON data from client
MessagePack
Send MessagePack data from client
Additional context
No response
The text was updated successfully, but these errors were encountered: