-
Notifications
You must be signed in to change notification settings - Fork 845
Fix race condition causing interleaved logs #11432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a4011d0 to
b4335e5
Compare
|
LSan detected a memory leak in the ImageMagick plugin. |
bneradt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. It's a big bonus that this makes things more efficient when debug logging is on.
|
The regression test PARENT_SELECTION failed. |
bneradt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I'll let a non-Yahoo reviewer chip in.
Releasing my blocking review because all changes are done.
This removes the unused heap argument and updates calls across the whole codebase accordingly.
This constifies some arguments to mime_field_print and mime_hdr_print and updates usage throughout the codebase accordingly.
This removes the heap argument from the method and updates the usage throughout the codebase.
This marks the hdr argument to http_hdr_print as const.
The output of the `DUMP_HEADER` macro was being written in multiple calls to
fprintf() that raced with other logging, resulting in interleaved output that
intermittently failed the ja3_fingerprint AuTest on CI. Whether other AuTest
failures were related to the same issue is unknown at this point.
This fixes the race condition by batching the calls to a single fprintf() call.
This also refactors the macro to two inline functions. In a benchmark using an
expanded version of the headers in the HttpTransact tests, a 60% speedup was
measured over the macro if all the header data fit in the buffer. In the worst
case that the buffer could only hold a byte at a time, the speedup was 80%.
The benchmark was compiled with -O3 and stderr was piped to /dev/null.
These were the headers used for the benchmark:
```
header input1[] = {
{"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "111111111111111111111111"},
{"BBB", "222" },
{"CCC", "333" },
{"DDD", "333" },
{"EEE", "333" },
{"FFF", "333" },
{"GGG", "333" },
{"HHH", "333" },
{"III", "333" },
{"JJJ", "333" },
{"KKK", "333" },
};
```
This fixes apache#11431.
This makes the following changes: * The length parameter to string::append is used instead of adding a null terminator. * Some erroneous logic left over from testing is fixed.
This is an API change. The parameter is no longer used, so this commit removes it and updates the developer documentation and core plugins accordingly.
7661666 to
4b8cfe5
Compare
|
Rebased and did the changes requested by @zwoop. |
bneradt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Since the API changed, the example plugins now need updating as well.
|
The AuTest bad_chunked_encoding failed with a very interesting message: |
|
Cherry-picked to v10.0.x |
* Remove unused argument from mime_hdr_print
This removes the unused heap argument and updates calls across the whole
codebase accordingly.
* Constify some arguments for MIME printing
This constifies some arguments to mime_field_print and mime_hdr_print and
updates usage throughout the codebase accordingly.
* Remove unused argument from http_hdr_print
This removes the heap argument from the method and updates the usage
throughout the codebase.
* Constify argument to http_hdr_status_get
* Constify argument to http_hdr_print
This marks the hdr argument to http_hdr_print as const.
* Constify the HTTPHdr::print method
* Fix race condition causing interleaved logs
The output of the `DUMP_HEADER` macro was being written in multiple calls to
fprintf() that raced with other logging, resulting in interleaved output that
intermittently failed the ja3_fingerprint AuTest on CI. Whether other AuTest
failures were related to the same issue is unknown at this point.
This fixes the race condition by batching the calls to a single fprintf() call.
This also refactors the macro to two inline functions. In a benchmark using an
expanded version of the headers in the HttpTransact tests, a 60% speedup was
measured over the macro if all the header data fit in the buffer. In the worst
case that the buffer could only hold a byte at a time, the speedup was 80%.
The benchmark was compiled with -O3 and stderr was piped to /dev/null.
These were the headers used for the benchmark:
```
header input1[] = {
{"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "111111111111111111111111"},
{"BBB", "222" },
{"CCC", "333" },
{"DDD", "333" },
{"EEE", "333" },
{"FFF", "333" },
{"GGG", "333" },
{"HHH", "333" },
{"III", "333" },
{"JJJ", "333" },
{"KKK", "333" },
};
```
This fixes #11431.
* Implement changes requested by Brian Neradt
This makes the following changes:
* The length parameter to string::append is used instead of adding a
null terminator.
* Some erroneous logic left over from testing is fixed.
* Fix formatting
* Add log output to dump_header for invalid hdrs
* Remove bufp parameter from TSMimeHdrPrint
This is an API change. The parameter is no longer used, so this commit removes
it and updates the developer documentation and core plugins accordingly.
* Fix the example plugins
Since the API changed, the example plugins now need updating as well.
(cherry picked from commit 054b6a8)
This is for apache#8066, apache#8804, apache#9509 and apache#11432.
The output of the
DUMP_HEADERmacro was being written in multiple calls tofprintf() that raced with other logging, resulting in interleaved output that
intermittently failed the ja3_fingerprint AuTest on CI. Whether other AuTest
failures were related to the same issue is unknown at this point.
This fixes the race condition by batching the calls to a single fprintf() call.
This also refactors the macro to two inline functions. In a benchmark using an
expanded version of the headers in the HttpTransact tests, a 60% speedup was
measured over the macro if all the header data fit in the buffer. In the worst
case that the buffer could only hold a byte at a time, the speedup was 80%.
The benchmark was compiled with -O3 and stderr was piped to /dev/null.
These were the headers used for the benchmark:
This fixes #11431.