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
[FLINK-16423][e2e] Introduce timeouts for HA tests #11831
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 8c3475f (Mon Apr 20 14:36:20 UTC 2020) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
Since this error can happen also on travis, we should probably set the timeout to 9 minutes (as Travis has a timeout of 10 minutes) |
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.
Hi, thanks for opening this PR. It would help a lot to find the failure cause of e2e test.
I'm not an expert of Bash programming. I tried to review the PR with the help of Google. I left a couple of comments. Correct me if I was wrong :)
@@ -23,10 +23,9 @@ source "${END_TO_END_DIR}"/test-scripts/common.sh | |||
# flag indicating if we have already cleared up things after a test | |||
CLEARED=0 | |||
|
|||
JM_WATCHDOG_PID=0 |
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.
Just a curiosity, what's the reason of this change?
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.
The JM_WATCHDOG_PID
is used in the stop_watchdogs
function, which is called from different bash-processes.
Because of that, if the variable is set in one process, it's not available in the other one.
That's why I decided to store the PID in a file.
on_exit kill_test_watchdog | ||
|
||
( | ||
cmdpid=$BASHPID; |
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.
BASHPID
does not work on my Mac. It's introduced in Bash 4, however the version of Bash on my Mac is 3.2. Maybe we could use $$
when BASHPID
is not supported? $$
is more general, however sometimes it does not work well as expected, like executing in background.
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.
Yes, these changes require bash 4. Bash on mac is pretty outdated sadly.
I think $$
won't work, as it will return the PID of the bash-process, not of the subshell I'm launching there:
When you want to find out the PID of your current shell session, even from subshells, that’s when you use $$. Any subshell has its own PID as well, and you can access it via the $BASHPID variable.
https://bashwizard.com/shells-subshells-pids/
But I will add a warning to the script, that is requires at least bash 4
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.
Ah, you are right. It's in another sub-process.
I come up with a work-around way. It probably works that executing the watchdog in original main process and executing the testing scripts in sub-process. We can get the sub-process pid in main process.
But I guess it's not a big deal, as MacOS is not a main scenario. I hope this PR could be merged asap. I would help a lot.
echo "Test (pid: $cmdpid) did not finish after $TEST_TIMEOUT_SECONDS seconds." | ||
echo "Printing Flink logs and killing it:" | ||
cat ${FLINK_DIR}/log/* | ||
kill "$cmdpid") & watchdog_pid=$! |
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.
Another curiosity, is there any magic of inline watchdog_pid=$!
?
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.
That's a good question. I don't know if this has to be in the same line or not. Probably not.
It is okay for you, I would not change this, because it would mean that I have to test the scripts again (I manually tested that they are behaving as expected in failure / timeout / success cases.)
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.
That's OK for me :)
Before this change, HA tests were waiting indefinetly for certain conditions to be met. This change introduces a timeout in the test scripts that kills the test and prints the Flink logs for debugging.
8c3475f
to
9632975
Compare
Thanks a lot for your review. I rebased to current master and added a comment for the Bash 4+ requirement. |
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.
Thanks for response and updating. LGTM
echo "Test (pid: $cmdpid) did not finish after $TEST_TIMEOUT_SECONDS seconds." | ||
echo "Printing Flink logs and killing it:" | ||
cat ${FLINK_DIR}/log/* | ||
kill "$cmdpid") & watchdog_pid=$! |
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.
That's OK for me :)
on_exit kill_test_watchdog | ||
|
||
( | ||
cmdpid=$BASHPID; |
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.
Ah, you are right. It's in another sub-process.
I come up with a work-around way. It probably works that executing the watchdog in original main process and executing the testing scripts in sub-process. We can get the sub-process pid in main process.
But I guess it's not a big deal, as MacOS is not a main scenario. I hope this PR could be merged asap. I would help a lot.
Thanks for the review. Let's wait till Azure is green, then I'll merge it. |
What is the purpose of the change
Before this change, HA tests were waiting indefinitely for certain conditions to be met.
This change introduces a timeout (10 minutes) in the test scripts that kills the test and prints the Flink logs for debugging.
Brief change log