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

compiler: fix nondeterministic behaviour #8585

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

delitrem
Copy link
Contributor

Fixes nondeterministic behaviour related to new doc system. See #8579.

@CLAassistant
Copy link

CLAassistant commented Jun 16, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

github-actions bot commented Jun 16, 2024

CT Test Results

    2 files    324 suites   10m 16s ⏱️
  817 tests   815 ✅ 2 💤 0 ❌
5 420 runs  5 418 ✅ 2 💤 0 ❌

Results for commit ed02c1a.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@garazdawi
Copy link
Contributor

Hello! Thanks for the fix! Would you mind adding a testcase to lib/compiler/test/beam_doc_SUITE.erl that tests that it works?

@garazdawi garazdawi self-assigned this Jun 17, 2024
@garazdawi
Copy link
Contributor

Also, would you mind targeting maint instead of master so that we can get a fix out before next year :)

@delitrem
Copy link
Contributor Author

Hello and thank you very much for the feedback. I will write a testcase.

@delitrem delitrem changed the base branch from master to maint June 17, 2024 08:42
@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Jun 17, 2024
@delitrem
Copy link
Contributor Author

Still I have no great idea how to reproduce 'bad behaviour'. I've used the following code:

    {ok, _, Reference} = compile:file("ssh", [binary]),

    false =
        lists:all(fun(_) ->
                     {ok, _, Testing} = compile:file("ssh", [binary]),
                     Testing =:= Reference
                  end,
                  lists:seq(1, 100)),

Meanwhile, it can be reproduced easily when using erlc from shell with the same files:

## the following files are from lib/ssh/src/
$ ls
ssh.erl  ssh.hrl  ssh_connect.hrl
$ for a in $(seq 1 100); do $ERL_TOP/bin/erlc ssh.erl; md5=$(md5sum ssh.beam | awk '{print $1}'); mv ssh.beam ssh.beam.${md5}; done
$ ls
ssh.beam.0c2b4dbfa37b12c2478782670083c40b  ssh.beam.6e58cd3ec2f0ba1de51959191be6a128  ssh.erl  ssh.hrl	ssh_connect.hrl

Any ideas, advices, etc.?

@garazdawi
Copy link
Contributor

The behaviour relies on two different VMs being started when compiling so that the atom indexes end up being different for the metadata. You can use the ?CT_PEER macro to start a new node in your testcase.

@delitrem
Copy link
Contributor Author

You can use the ?CT_PEER macro to start a new node in your testcase.

Thank you very much for you hint! It helped.

I will test a little bit more and then commit a test case into my branch.

@delitrem
Copy link
Contributor Author

Pushed changes to the compile.erl and test suite.

@garazdawi garazdawi added fix testing currently being tested, tag is used by OTP internal CI labels Jun 18, 2024
@garazdawi garazdawi added testing currently being tested, tag is used by OTP internal CI and removed testing currently being tested, tag is used by OTP internal CI labels Jun 19, 2024
@garazdawi garazdawi merged commit d93958b into erlang:maint Jun 20, 2024
13 checks passed
@garazdawi garazdawi added this to the OTP-27.0.1 milestone Jun 20, 2024
@garazdawi
Copy link
Contributor

I rebased your commit on maint-27, so that it will be part of the 27.0.1 release and added the primary bootstrap.

@delitrem
Copy link
Contributor Author

Thank you very much for your assistance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants