Skip to content
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

Make sure chip-all-clusters-app is ready before we try to do PASE setup with it. #7561

Merged

Conversation

bzbarsky-apple
Copy link
Contributor

We were racing startup of chip-tool against that of
chip-all-clusters-app, and if the former started faster it would send
the first PASE handshake message before the latter was ready. Then it
would wait 5 seconds before resending, which slowed the test down
quite a bit

Problem

chip-tool would try to talk to chip-all-clusters-app before chip-all-clusters-app was ready.

Change overview

Wait until chip-all-clusters-app logs that it's waiting for a PASE handshake before talking to it.

Testing

Manual testing of the script locally, and CI runs.

@bzbarsky-apple
Copy link
Contributor Author

@Damian-Nordic @andy31415 @jepenven-silabs @mspang could you take a look please?

@bzbarsky-apple bzbarsky-apple force-pushed the better-waiting-for-server branch 5 times, most recently from f8fb35c to 988fa34 Compare June 15, 2021 18:15
@bzbarsky-apple
Copy link
Contributor Author

@msandstedt @woody-apple @mrjerryjohns Note that I just updated the PR with a change to exactly how background_pid is read: now we read it out of the file after the server has started up, to avoid reading it before the write to the file has actually happened.

@bzbarsky-apple bzbarsky-apple force-pushed the better-waiting-for-server branch from 988fa34 to 46c5b8c Compare June 15, 2021 18:18
…up with it.

We were racing startup of chip-tool against that of
chip-all-clusters-app, and if the former started faster it would send
the first PASE handshake message before the latter was ready. Then it
would wait 5 seconds before resending, which slowed the test down
quite a bit
@bzbarsky-apple bzbarsky-apple force-pushed the better-waiting-for-server branch from 46c5b8c to 385c8ea Compare June 15, 2021 18:23
# Clear out our temp files so we don't accidentally do a stale
# read from them before we write to them.
rm -rf /tmp/all-clusters-log
rm -rf /tmp/pid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this do a 'sync' or a 'flush' to ensure the deletion actually happened?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not seem relevant in that we don't care what the on-disk state is, just what happens when we open the filename, and that part should be all set once rm returns. In particular, I was running into issues where we were seeing a "Server Listening" still in the all-clusters-log from a previous iteration once I moved reading that to before reading /tmp/pid..... But if we rm that should not happen, as far as I know.

while ! grep -q "Server Listening" /tmp/all-clusters-log; do
:
done
# Now read $background_pid from /tmp/pid; presumably it's
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term 'presumably' doesn't inspire confidence...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it does not! We are racing the I/O redirection to /tmp/pid in the background shell against the all-clusters-app/tee combo that is writing to /tmp/all-clusters-log. I would expect the former to win the race and put the PID in the right place before we see "Server Listening" in pretty much all cases, but there's no guarantee here. :(

We need to figure out a better setup for this....

@woody-apple woody-apple merged commit 2064256 into project-chip:master Jun 15, 2021
@bzbarsky-apple bzbarsky-apple deleted the better-waiting-for-server branch June 16, 2021 01:28
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
…up with it. (project-chip#7561)

We were racing startup of chip-tool against that of
chip-all-clusters-app, and if the former started faster it would send
the first PASE handshake message before the latter was ready. Then it
would wait 5 seconds before resending, which slowed the test down
quite a bit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants