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

bugfix: Try to fix Mill flaky test #5661

Merged
merged 1 commit into from
Oct 6, 2023
Merged

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Sep 21, 2023

My guess is that the test failed because it takes a while for the build server to connect. Let's see if this helps.

Comment on lines 46 to 55
_ <- server.server.buildServerPromise.future
.withTimeout(2, TimeUnit.MINUTES)
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't didOpen wait for the buildServerPromise anyway? I though it's more of a when the bsp compiles and publishes things not the connection itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might be, but I can't figure out where does the test actually hang :/

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add printing of the bsp trace on error. That could provide some insight.

@tgodzik tgodzik force-pushed the fix-mill-test branch 2 times, most recently from d419f7f to 7a8c6b7 Compare September 22, 2023 09:18
@tgodzik
Copy link
Contributor Author

tgodzik commented Sep 29, 2023

I think I finally found the reason the tests hung and weren't retried. Looks like Mill will sometimes throw an exception which is forwarded to Metals and causes tests to hange, this should make the tests stop hanging and make retries work.

@kasiaMarek
Copy link
Contributor

Still seems a mill test failed do you know why?

@tgodzik
Copy link
Contributor Author

tgodzik commented Sep 29, 2023

Still seems a mill test failed do you know why?

Damn, no idea. I need to figure out where it hangs, but I don't see any other possibility. I will add a manual timeout maybe.

@tgodzik tgodzik force-pushed the fix-mill-test branch 6 times, most recently from f429b30 to a84b7e1 Compare October 4, 2023 14:36
@tgodzik
Copy link
Contributor Author

tgodzik commented Oct 4, 2023

Looks like finally the approach worked and I run the mill tests 3 times and tests didn't fail. What do you think @kasiaMarek ?

@kasiaMarek
Copy link
Contributor

Looks like finally the approach worked and I run the mill tests 3 times and tests didn't fail. What do you think @kasiaMarek ?

If it's mill that throws for undisclosed reasons, then it's fine I think. However, I would be great to explain it in a comment and take some steps to try and resolve the underlying problem. Maybe create an issue in mill?

@tgodzik
Copy link
Contributor Author

tgodzik commented Oct 5, 2023

Looks like finally the approach worked and I run the mill tests 3 times and tests didn't fail. What do you think @kasiaMarek ?

If it's mill that throws for undisclosed reasons, then it's fine I think. However, I would be great to explain it in a comment and take some steps to try and resolve the underlying problem. Maybe create an issue in mill?

I opened up an issue in mill com-lihaoyi/mill#2826 I am not 100% that's the reason, but this is the only stack I've seen recently. I added a comment around that test suite, so people might see it's problematic.

Looks like Mill will sometimes throw an exception which is forwarded to Metals and causes tests to hange, this should make the tests stop hanging and make retries work.
Copy link
Contributor

@kasiaMarek kasiaMarek left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -1034,6 +1034,7 @@ final case class TestingServer(
filename: String,
maxRetries: Int = 4,
): Future[List[l.CodeLens]] = {
Debug.printEnclosing(filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain to me what does this thing do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just prints that this method has been invoked together with the filename.

This is where things like 2023.10.06 10:30:46 INFO tests.BaseLspSuite#initialize come from.

@tgodzik tgodzik merged commit 7039e03 into scalameta:main Oct 6, 2023
24 checks passed
@tgodzik tgodzik deleted the fix-mill-test branch October 6, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants