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

CompileStringAsyc() and race conditions when used in package build #328

Closed
nshahan opened this issue May 24, 2018 · 2 comments
Closed

CompileStringAsyc() and race conditions when used in package build #328

nshahan opened this issue May 24, 2018 · 2 comments

Comments

@nshahan
Copy link
Contributor

nshahan commented May 24, 2018

I'm working on implementing an AsyncImporter to use in package sass_builder. I've got a working synchronous importer by wrapping async calls with waitFor from dart:cli but I would like to compare the performance with an async version.

For a given build target I am finding that calls to canonicalize() continue after the call CompileStringAsyc() has returned a value. This causes an error in package build:

Concurrent modification during iteration: Instance of 'SplayTreeSet<AssetId>'

I don't have a proper stack trace to point to the call site in package sass because the error arises from the iteration site in package build. I do believe it is a call to canonicalize() that is causing the problem.

How can we investigate this more?

@nex3
Copy link
Contributor

nex3 commented May 24, 2018

If a call to canonicalize() is the root cause, then there are two ways it could stay alive after the compilation has finished: either the compilation logic could fail to wait on the returned future, or the implementation of canonicalize() could have asynchronous logic that doesn't get piped into the returned future. It looks like the asynchronous _EvaluateVisitor awaits both of its calls to .canonicalize(), so it seems like the first place to look is probably your canonicalize() implementation.

@nshahan
Copy link
Contributor Author

nshahan commented May 24, 2018

False alarm. The unawaited future in my code has been found. Now the question is why didn't the lint give any feedback for it.

dart-lang/sdk#57711

@nshahan nshahan closed this as completed May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants