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

Refactor code server to use a single queue #8744

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

josevalim
Copy link
Contributor

Prior to this patch, the code server had two
internal queues, one to track module loading
and another to track on_load callbacks. This
pull requests refactors the code to have a
single queue, in order to fix bugs and improve
maintainability.

Closes #7466.
Closes #8510.

Copy link
Contributor

github-actions bot commented Aug 25, 2024

CT Test Results

    2 files     70 suites   1h 5m 36s ⏱️
1 554 tests 1 313 ✅ 241 💤 0 ❌
1 770 runs  1 497 ✅ 273 💤 0 ❌

Results for commit 72c91bb.

♻️ 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

@josevalim
Copy link
Contributor Author

Ideally this would be merged on maint because it fixes a regression on OTP 27 but it is a conceptually large change. My suggestion is to merge it to master and, once 27.1 is out, backport it to maint, which should give us time to battle test it for 27.2.

Prior to this patch, the code server had two
internal queues, one to track module loading
and another to track on_load callbacks. This
pull requests refactors the code to have a
single queue, in order to fix bugs and improve
maintainability.

Closes erlang#7466.
Closes erlang#8510.
@kikofernandez
Copy link
Contributor

Thanks for your contribution. I plan to look at this after ICFP (in 10 days) approx

@josevalim
Copy link
Contributor Author

Please don't merge this yet. I have tried this branch in a project and, while I didn't notice any bugs, compilation times for Elixir (which loads several modules) was affected negatively.

@josevalim
Copy link
Contributor Author

False alarm, I had mixed my Erlang versions. Overall, I didn't measure any performance degradation in my usual code loading benchmarks. :)

@kikofernandez
Copy link
Contributor

Looking into it this week

@kikofernandez
Copy link
Contributor

This was on hold due to other investigations regarding current issues in code_server.
As soon as I am given green light, I review this PR

@kikofernandez kikofernandez added stalled waiting for input by the Erlang/OTP team testing currently being tested, tag is used by OTP internal CI and removed stalled waiting for input by the Erlang/OTP team labels Oct 16, 2024
@lucioleKi lucioleKi removed the testing currently being tested, tag is used by OTP internal CI label Oct 17, 2024
@kikofernandez kikofernandez added the testing currently being tested, tag is used by OTP internal CI label Oct 18, 2024
Copy link
Contributor

@kikofernandez kikofernandez left a comment

Choose a reason for hiding this comment

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

Looks good to me
These changes make the code_server easier to follow.
We are running some internal tests and will merge next week if all is green

@josevalim
Copy link
Contributor Author

Glad to hear so! 🎉 Code loading is a state machine and the previous version was encoding the states via anonymous functions and in two separate queues, which made it very hard to follow. :)

@kikofernandez
Copy link
Contributor

Completely agree, it was pretty tricky to follow the logic. This was a great improvement.

Since the next OTP release 27.2 is around beginning of December, I am wondering if we can place this already on maint, instead of master. That gives us close to two months of testing

@josevalim
Copy link
Contributor Author

As long as we are comfortable with potentially doing a 27.2.1 with this commit reverted, it sounds good to me. :D

adds a test that deadlocks on OTP-26 (fixes erlangGH-7466)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Crash in code_server.erl (badmatch: error) Loading a module that contains on_load may hang
5 participants