-
Notifications
You must be signed in to change notification settings - Fork 256
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
Chore: Fixed a spurious CI failure #5685
Chore: Fixed a spurious CI failure #5685
Conversation
I don't understand how the exception you linked to in the PR details, and the new exception that this PR build triggers (https://github.com/dafny-lang/dafny/actions/runs/10361859583/job/28683650633?pr=5685), could ever occur. The option Maybe the real issue is that the dictionaries in |
I looks like the CI identified another similar issue. The exception that is thrown comes from
Note the On
that is actually assigning I hope this helps! |
Update: I realized there were many many more cases with RegisterOption and RegisterGlobalOption. I updated the PR to fix them all and also add a comment on static constructors so that if ever one wants to do the same, they will see this comment and hopefully update the code in DafnyNewCli.cs. |
Update: Seems like the calls using reflection did not work. Using real calls to ensure options are correctly registered, but without async issues. |
As I mentioned before, I don't draw that conclusion. Because of the way static initialization works, I do think the registration was run before the check. What can explain the failures is that the assignment While I do think the changes in this PR resolve the issue, since they prevent the concurrent registrations, I think a simpler and more future proof solution is to make the dictionaries in OptionsRegistry a ConcurrentDictionary |
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.
_
a25389f
to
6effa12
Compare
Oh that's a brilliant observation too, now it makes sense to me. Let's try this simple fix first and see whether the issue reappears. I've force pushed it to this branch. |
Updated the doo files and (sorry) snuck in a Boogie update |
The boogie update changed the count of verifiable, which failed everything. |
Jep, sorry. |
### Description I recently stumbled on this random Mac failure: https://github.com/dafny-lang/dafny/actions/runs/10359400713/job/28675744622?pr=5684 After careful investigation of the stack trace, it looks like the static constructor of `DafnyFile` did not run before `OptionRegistry.CheckOptionsAreKnown(AllOptions);`, resulting in the option `DoNotVerifyDependencies` to not be registered. This PR fixes that by forcing the execution of the static `DafnyFile` constructor, guaranteed to not run if that constructor was already called. https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.runtimehelpers.runclassconstructor?view=net-8.0 ### How has this been tested? I can't think of a way this change can be tested, the failure happens extremely rarely. Please make yourself convinced that this PR solves the issue given in the link. <small>By submitting this pull request, I confirm that my contribution is made under the terms of the [MIT license](https://github.com/dafny-lang/dafny/blob/master/LICENSE.txt).</small>
Description
I recently stumbled on this random Mac failure:
https://github.com/dafny-lang/dafny/actions/runs/10359400713/job/28675744622?pr=5684 After careful investigation of the stack trace, it looks like the static constructor of
DafnyFile
did not run beforeOptionRegistry.CheckOptionsAreKnown(AllOptions);
, resulting in the optionDoNotVerifyDependencies
to not be registered. This PR fixes that by forcing the execution of the staticDafnyFile
constructor, guaranteed to not run if that constructor was already called. https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.runtimehelpers.runclassconstructor?view=net-8.0How has this been tested?
I can't think of a way this change can be tested, the failure happens extremely rarely. Please make yourself convinced that this PR solves the issue given in the link.
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.