Is there any problem with using Fluent::MessagePackFactory#msgpack_packer.pack
in format
of output plugin ??
#4019
-
I experienced frequent SEGV crashes (double-free/use after free) with the out-cloudwatch-logs plugin at high log traffic (around 70k logs per minute or more). After trying various solutions, I found that modifying the CloudwatchLogsOutput#format method fixed the crash issue. def format(tag, time, record)
record = inject_values_to_record(tag, time, record)
# original code
# Fluent::MessagePackFactory.msgpack_packer.pack([tag, time, record]).to_s
# my modification preventing SEGV
[tag, time, record].to_msgpack
end The modification involved replacing the original Though there is not much difference between the two codes, the original code uses a cached factory while my modification uses a local one. Is there any potential problem in the original code? my configs and crash logs is here.
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
here's a example of crash log . crash_log.log |
Beta Was this translation helpful? Give feedback.
-
You mean like this?: def format(tag, time, record)
record = inject_values_to_record(tag, time, record)
- Fluent::MessagePackFactory.msgpack_packer.pack([tag, time, record]).to_s
+ [tag, time, record].to_msgpack
end |
Beta Was this translation helpful? Give feedback.
-
How about replacing it with |
Beta Was this translation helpful? Give feedback.
-
finally, I found that my fix does not fix the crash issue. |
Beta Was this translation helpful? Give feedback.
finally, I found that my fix does not fix the crash issue.
it seems that the actual cause of crash is double free in garbage collecting C ext objects, e.g. msgpack buffer, yajl.
I couldn't inspect in detail yet, but my fix is not relevant.