-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Run Sourcekitd-tests in a non dispatch thread #25224
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
Run Sourcekitd-tests in a non dispatch thread #25224
Conversation
|
CC: @akyrtzi @benlangmuir |
|
@swift-ci please test |
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.
This is unfortunate, it's going to be creating a new pthread every time to query the AST. Is there no way to make it work without making this change ?
I find strange that dispatch threads have limited stack also on Darwin but we did not have issues with querying the AST.
If there is no way around it I'd at least suggest to only have this change in effect when compiling for Windows.
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.
This is hardcoded into libdispatch. There is no way to adjust the stack size. It is very likely that you are skimming past pretty close to the limit.
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.
That's my current theory. A sample count of frame sizes seems to vouch to that. But why Windows uses slightly more memory, I'm not sure yet.
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.
That stack trace looks to be from syntactic parsing, it is unrelated to ASTUnit::Implementation::consumeAsync.
Is the change inside consumeAsync really necessary or are the other changes making it redundant ?
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.
The consume async change is needed here. "S:\b\swift\bin\sourcekitd-test.EXE" "-req=cursor" "-pos=9:25" "S:\swift\test\SourceKit\CursorInfo\rdar_30248264.swift" "--" "S:\swift\test\SourceKit\CursorInfo\rdar_30248264.swift" stack overflows without it on windows. I'm currently trying to find a better way to make the change though. At worst, I'll #if defined(_WIN32) it, but I'd rather do something nicer.
The stack trace was more an example from another test that was stack overflowing showing that Windows typically does currently use more stack memory than Darwin. It was relatively representative of what I've seen in other areas.
|
Build failed |
Since Dispatch threads have a 64k stack size, tests were failing due to blowing the stack on Windows. This runs the tests in thread with a larger stack size. This fixes some 90ish sourcekit tests on Windows.
d1122a6 to
fa513db
Compare
|
Bleh, no idea what's causing the difference in stack sizes. I sadly just put it behind an if defined WIN32. @swift-ci please test |
|
Build failed |
Since Dispatch threads have a 64k stack size, tests were failing due to
blowing the stack on Windows. This runs the tests in thread with a
larger stack size. This fixes some 90ish sourcekit tests on Windows.