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

Change stack size on all desktop platforms to at least 1.5MB #98007

Merged
merged 21 commits into from
Feb 12, 2024

Conversation

hamarb123
Copy link
Contributor

@hamarb123 hamarb123 commented Feb 5, 2024

Fixes #87879
Fixes #2084
Fixes #1417

Changes the stack size on desktop platforms to a certain minimum.

Specific changes we've landed on:

  • macOS secondary thread stack size is upped to match Windows thread size at 1.5MB (and other Apple platforms, mono was already 2MB for these since they're all 64-bit)
  • Windows NAOT is upped to the standard 1.5MB
  • Allow IlcDefaultStackSize to be used to specify the stack size for NAOT on all platforms

Plan:

  • Change stack size on all 64-bit desktop platforms to 4MB and add tests
  • Make sure tests all run
  • Make sure tests all pass
  • Remove API changes
  • Determine if we want to keep it at 4MB, and if not, reduce it, also determine if we want to change 32-bit platforms too
  • Re-enable any tests previously disabled due to stack size

(Already reverted) Note: I've currently made some changes to System.Reflection.Metadata's API, I don't plan to keep these - I had noticed that NAOT seemed to only be giving 1MB on Windows though when I built it a test console app, so I am seeing if it fixes that before doing a more proper fix.

- Change stack size to 4MB on 64-bit desktop
- Add tests to check stack size
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Feb 5, 2024
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Feb 5, 2024
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@hamarb123
Copy link
Contributor Author

hamarb123 commented Feb 6, 2024

(force push & empty commit were to workaround #98009)
(edit: it didn't work lol)

@jkotas
Copy link
Member

jkotas commented Feb 6, 2024

As I have mentioned in #87879 (comment), I think that we should only fix macOS. Bumping the stack size on Windows is likely to introduce as many problems as it fixes.

@jkotas jkotas requested a review from janvorli February 6, 2024 00:59
@jkotas jkotas added area-VM-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Feb 6, 2024
- Fix test definition
- Fix NAOT apps stack size
- Add `<UseAppHost>false</UseAppHost>` version of non-NAOT tests
- Pre-emptively move second test project to a seperate folder to avoid build issues
@hamarb123
Copy link
Contributor Author

@janvorli what are your thoughts on the stack sizes we should change? I currently have them all at 4MB for 64-bit desktop platforms, but this is mainly for testing (not that I would complain if we ended up on this number 😆). Would you be happy with 2MB for all desktop platforms?

As I have mentioned in #87879 (comment), I think that we should only fix macOS. Bumping the stack size on Windows is likely to introduce as many problems as it fixes.

@jkotas would you accept 2MB also? It is only marginally higher than the current Windows value (1.5MB). I think it is a good middle ground, and should be enough to account for the ever-expanding usage of the stack that I mentioned in #87879 (comment) for the time being (and we could obviously re-visit it in the future if we wanted to increase it again).

@hamarb123
Copy link
Contributor Author

I've found these 3 disabled tests due to macOS stack size, are there any others which I should re-enable with this fixed?

@jkotas
Copy link
Member

jkotas commented Feb 6, 2024

@jkotas would you accept 2MB also? It is only marginally higher than the current Windows value (1.5MB

I don't see a good reason for changing the Windows stacksize. We would need to file a breaking change notice for it and it would be hard to come up with a good justification.

@hamarb123 hamarb123 marked this pull request as ready for review February 7, 2024 08:03
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM otherwise. Thank you!

- Remove the NAOT specific test, since NAOT runs for the main test also
@jkotas
Copy link
Member

jkotas commented Feb 10, 2024

/azp run runtime-nativeaot-outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@hamarb123
Copy link
Contributor Author

Should runtime-extra-platforms be run also @jkotas? (I can't run it, but I would think it makes sense, right?)

@jkotas
Copy link
Member

jkotas commented Feb 12, 2024

I just wanted to double check that the new test is running as part of runtime-nativeaot-outerloop (confirmed - it does).

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

Thank you!

@jkotas jkotas merged commit e5df956 into dotnet:main Feb 12, 2024
197 of 202 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-VM-coreclr community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation
Projects
None yet
6 participants