Fix tcpflood crash detection during RELP TLS tests#149
Fix tcpflood crash detection during RELP TLS tests#149
Conversation
* treat tcpflood signal exits as fatal so the harness fails tests even when no core file is written.\n* ensure tcpflood stops sending after RELP connection setup errors by cleaning up the client handle and propagating the failure across worker threads.\n\nAI-Agent: Codex
Summary of ChangesHello @rgerhards, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the robustness of Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces two important fixes. First, it correctly detects tcpflood crashes from signals during tests, making the test suite more robust. Second, it fixes a resource leak in tcpflood's RELP connection handling and ensures that connection failures in worker threads are properly propagated, preventing tests from silently succeeding when they should fail. The changes in tcpflood.c are solid. In diag.sh, the error handling logic is correct, but could be refactored to reduce code duplication, which I've suggested.
| if [ "$res" -ge 128 ]; then | ||
| sig=$(( res - 128 )) | ||
| echo "tcpflood terminated by signal ${sig} on port ${TCPFLOOD_PORT}!" | ||
| if [ -f "${RSYSLOG_OUT_LOG}" ]; then | ||
| cp "${RSYSLOG_OUT_LOG}" "${RSYSLOG_OUT_LOG}.save" | ||
| fi | ||
| error_exit 1 stacktrace | ||
| fi | ||
| if [ "$check_only" == "yes" ]; then | ||
| echo "error during tcpflood on port ${TCPFLOOD_PORT}! But test continues..." | ||
| return 0 | ||
| fi | ||
| echo "error during tcpflood on port ${TCPFLOOD_PORT}! see ${RSYSLOG_OUT_LOG}.save for what was written" | ||
| if [ -f "${RSYSLOG_OUT_LOG}" ]; then | ||
| cp "${RSYSLOG_OUT_LOG}" "${RSYSLOG_OUT_LOG}.save" | ||
| fi | ||
| error_exit 1 stacktrace |
There was a problem hiding this comment.
The error handling logic here is correct, but there's some code duplication in how errors are reported and handled. The cp command and error_exit call are repeated. This can be refactored to make the code cleaner and easier to maintain.
| if [ "$res" -ge 128 ]; then | |
| sig=$(( res - 128 )) | |
| echo "tcpflood terminated by signal ${sig} on port ${TCPFLOOD_PORT}!" | |
| if [ -f "${RSYSLOG_OUT_LOG}" ]; then | |
| cp "${RSYSLOG_OUT_LOG}" "${RSYSLOG_OUT_LOG}.save" | |
| fi | |
| error_exit 1 stacktrace | |
| fi | |
| if [ "$check_only" == "yes" ]; then | |
| echo "error during tcpflood on port ${TCPFLOOD_PORT}! But test continues..." | |
| return 0 | |
| fi | |
| echo "error during tcpflood on port ${TCPFLOOD_PORT}! see ${RSYSLOG_OUT_LOG}.save for what was written" | |
| if [ -f "${RSYSLOG_OUT_LOG}" ]; then | |
| cp "${RSYSLOG_OUT_LOG}" "${RSYSLOG_OUT_LOG}.save" | |
| fi | |
| error_exit 1 stacktrace | |
| if [ "$check_only" == "yes" ] && [ "$res" -lt 128 ]; then | |
| echo "error during tcpflood on port ${TCPFLOOD_PORT}! But test continues..." | |
| return 0 | |
| fi | |
| if [ "$res" -ge 128 ]; then | |
| sig=$(( res - 128 )) | |
| echo "tcpflood terminated by signal ${sig} on port ${TCPFLOOD_PORT}!" | |
| else | |
| echo "error during tcpflood on port ${TCPFLOOD_PORT}! see ${RSYSLOG_OUT_LOG}.save for what was written" | |
| fi | |
| if [ -f "${RSYSLOG_OUT_LOG}" ]; then | |
| cp "${RSYSLOG_OUT_LOG}" "${RSYSLOG_OUT_LOG}.save" | |
| fi | |
| error_exit 1 stacktrace |
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_6905f1c160608332b12889717631addb