https://bugzilla.balabit.com/show_bug.cgi?id=278 --- Comment #15 from Xufeng Zhang <xufeng.zhang@windriver.com> 2014-06-03 05:24:12 --- (In reply to comment #14)
For the above 3) case, I think there is a memory leak problem in modules/affile/logproto-file-writer.c: Take the following scenario, we call log_proto_file_writer_post() to post a message, if we have consumed the previous data and after register the new message, consumed variable will be TRUE, this indicates we will allocate a new self->line_buffer->str buffer in log_writer_flush() after we return from log_proto_file_writer_post(), but there are cases that the new message has not been copied to the partial buffer and freed in log_proto_file_writer_flush(), one case is log_proto_file_writer_flush() return LPS_ERROR when I/O error happened, I think this is the reason why my previous patch "Don't allocate a new buffer if fails to consume current item" partially works. How would we handle this situation?
My above statement is not correct, from my test result, the below memory leak: 3). ==888== 77,312 bytes in 151 blocks are definitely lost in loss record 607 of 607 ==888== at 0x4A05F58: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==888== by 0x3AE26478F4: g_malloc (in /lib64/libglib-2.0.so.0.2600.0) ==888== by 0x3AE1E41838: log_writer_flush (logwriter.c:949) ==888== by 0x3AE1E418EC: log_writer_work_perform (logwriter.c:129) ==888== by 0x3AE1E41957: log_writer_io_flush_output (logwriter.c:209) ==888== by 0x3AE1E5EC29: iv_run_tasks (iv_task.c:48) ==888== by 0x3AE1E60E7B: iv_main (iv_main_posix.c:106) ==888== by 0x3AE1E41E16: main_loop_run (mainloop.c:737) ==888== by 0x4017A0: main (main.c:267) logwriter.c:949 self->line_buffer->str = g_malloc(self->line_buffer->allocated_len); is still come from the text-client, not from file-writer, so the fix ("logwriter: still free the unconsumed item during reloading configuration") on git branch f/memory-leak-fixes only partly works. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.