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

Enable timeout ensureSynchronized everywhere (Solution #1) #12278

Closed
wants to merge 1 commit into from

Conversation

curtisman
Copy link
Member

@curtisman curtisman commented Oct 5, 2022

Provide the mocha test timeout LoaderContainerTracker to limit how long to wait for ensureSynchronized. Currently it is set to half of test time. The purpose is to provide a better error message and stack if ensureSynchronized got stuck.

Also, change the behavior for timeoutPromise, when duration is <=0 or Infinity. Instead of waiting for the default amount, it will now mean it won't timeout at all. This is so that we can avoid timeout when debugging.

Fix AB#2175

@curtisman curtisman requested review from msfluid-bot and a team as code owners October 5, 2022 20:30
@github-actions github-actions bot added area: dds: propertydds area: tests Tests to add, test infrastructure improvements, etc dependencies Pull requests that update a dependency file public api change Changes to a public API base: next PRs targeted against next branch labels Oct 5, 2022
@curtisman curtisman force-pushed the timeout branch 2 times, most recently from 4c8960c to 2f77477 Compare October 5, 2022 22:34
@vladsud
Copy link
Contributor

vladsud commented Oct 5, 2022

Timeouts usually do not work :) Is the reason to add them - aid in debuggability where it's hard to figure out for developers why tests hang? Anything we can do to improve it without using timeouts? Like maybe mocha has some facility to run code when test fails and for code like that to provide extra info for easier debugging?

@curtisman
Copy link
Member Author

curtisman commented Oct 6, 2022

@vladsud yes, the purpose is to aid in debuggability so that they know where it hangs. mocha test has timeout, but when it does, it only kill the test and show a generic timeout message. It doesn't give you any idea where it hangs, especially around promises. With this, we will have the stack and a message at least.

@anthony-murphy added the timeout concept for promises used in test, and I am just follow the same pattern here, not inventing something new. I don't know if he has other alternatives. I did a quick search and didn't see any mocha functionality to trap (near) timeout and kill the test. We can implement our own "test" timeout mechanism that and have our Promise reject when we reach the test timeout overall, but that is similar idea to what we have here as well.

I understand timeout can be unreliable generally, and abort the promise wait on test timeout would be better. Barring we found an alternative mechanism get mocha notifying before timing out , I think this way works most of the time and probably good enough for test purpose at the moment?

@curtisman
Copy link
Member Author

curtisman commented Oct 6, 2022

@vladsud @anthony-murphy I did an alternative change. Please look at #12303, which instead of estimating using a half the timeout. #12303 will trap test run and calculate how long until the test would timeout and set the duration for promise wait until just before the test timeout.

@curtisman curtisman changed the title Enable timeout ensureSynchronized everywhere Enable timeout ensureSynchronized everywhere (Solution #1) Oct 6, 2022
@curtisman
Copy link
Member Author

Closing in favor of #12303

@curtisman curtisman closed this Oct 8, 2022
@curtisman curtisman deleted the timeout branch October 19, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: propertydds area: driver Driver related issues area: odsp-driver area: tests Tests to add, test infrastructure improvements, etc base: next PRs targeted against next branch dependencies Pull requests that update a dependency file public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants