-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Serialize expression compilation requests #18618
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
Conversation
PTAL, hopefully this will help @DanTup. |
@aam Btw, I presume this issue was specific to how evaluations are routed back to Flutter and didn't affect non-Flutter apps? I noticed the fix was in flutter_tools; but I can't repro any issues when running directly on the desktop VM. |
_CompileExpressionRequest(this.completer, this.expression, this.definitions, | ||
this.typeDefinitions, this.libraryUri, this.klass, this.isStatic); | ||
|
||
Completer<CompilerOutput> completer; |
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 field can be in the base classs?
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.
Sure, done. PTAL if you have a chance
@DanTup wrote
That's right. For standalone Dart VM(non-Flutter apps) there is different(conceptually similar) wrapper. We might have to have similar fix applied to that wrapper(kernel service) too. |
Hello, I realize this PR is from quite a while ago, but could someone explain why this was necessary (@DanTup)? This PR introduced a code comment that says that we serialize compilation requests, but it doesn't explain why we need to. Looking at #18595, I'm guessing that we need recompilation requests to be processed in-order because one compilation request can depend on a previous one. Is that a correct reading? This has come up because of #151255, which is blocking fixing the top crasher of the flutter tool. I'm considering refactoring the tool's |
Looking at the original issue I'm not certain, but here's a guess (possible @aam can correct me). I think this might be because the way the expression compilation is done is by just sending strings over a stream bare and a response is received:
Since these aren't wrapped in anything to indicate which request a response relates to, having multiple requests trying to send requests at the same time might mess things up:
My guess is that serialising these into a queue like this was an easy way to fix the issue. It would probably be better if these requests were more structured though (I think we have another open issue somewhere that newlines in an expression will break?). We use something like JSON-RPC for many other tools (like the Flutter daemon), maybe something similar would work here? (I'm not sure how this is causing your issue though, but I'm not all that familiar with either parts of this code) |
Thanks for the response!
Sorry for not elaborating here. I think you are already familiar with dart-lang/sdk#54911 (writing to a process risks an uncatchable error that will often have no meaningful stacktrace), which is affecting the |
Requests to compile expressions for debugger evaluation can come to flutter while previously submitted requests are still being handled. This PR serializes all compilation requests to the compiler.
This fixes #18595