MINIFICPP-1434: Fix flaky CSite2SiteTests on macOS#994
MINIFICPP-1434: Fix flaky CSite2SiteTests on macOS#994martinzink wants to merge 2 commits intoapache:mainfrom
Conversation
|
The issue is that on macOS the default sigpipe handler crashes the application. I've tested this on my fork with custom CI, on both macos-xcode12.0 and macos-xcode11.2.1 with 200 runs |
| TEST_CASE("TestSiteToBootStrap", "[S2S3]") { | ||
|
|
||
| #ifndef WIN32 | ||
| signal(SIGPIPE, SIG_IGN); |
There was a problem hiding this comment.
Could you elaborate how this fixes the issue?
There was a problem hiding this comment.
Sure, a SIGPIPE is sent to a process if it tried to write to a socket that had been shutdown for writing or isn't connected (anymore), this can easily happen in multithreaded enviroment.
The issue is that on macOS the default sigpipe handler crashes the application.
In production code we are already ignoring this signal by setting the sigpipe handle to nothing. see https://github.com/apache/nifi-minifi-cpp/blob/main/main/MiNiFiMain.cpp#L181
Given that in production code we are ignoring the signal, I think it would be best to ignore it here as well.
I've tested this on my fork with custom CI, on both macos-xcode12.0 and macos-xcode11.2.1 with 200 runs
make test ARGS="--timeout 300 -j4 --output-on-failure -R CSite2SiteTests --repeat-until-fail 200
Without the fix both configuration failed (both around the 100th run), with the fix they passed 3 times (that's 1200 runs without failure)
There was a problem hiding this comment.
Thanks for the details, makes sense!
At least whoever finds this change lager, will see the reasoning here.
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically main)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.