-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Investigate noIterationTypes crash #36388
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
115d980
to
8a1ea3e
Compare
8a1ea3e
to
2ceee04
Compare
@typescript-bot pack this |
@dbaeumer, @falsandtru: Once @typescript-bot indicates the tarball for the proposed fix has completed, would you be able to try it out in your local workspace and report back as to whether this has improved stability in the editor? |
Hey @rbuckton, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build. |
Looks like the problem disappeared 👍 |
I'd like to verify whether this issue was indeed related to @typescript-bot pack this |
Hey @rbuckton, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build. |
I can repro with the reverted version. As I wrote in #32953, I can repro also with yesterday's build. |
Unfortunately, I still am unable to repro this issue following the steps you provided. |
@typescript-bot pack this |
@falsandtru, @dbaeumer: Unfortunately I've been unable to repro this using either @falsandtru's repro steps or by manually making changes to the ESLint VSCode extension that @dbaeumer was working on in their issue. While it looks like we have verified that we can resolve this specific issue by moving So far I have identified 3 possible culprits that could leak a
I've just pushed up a commit that adds a number of checks to the |
Hey @rbuckton, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build. |
Not reproducible as expected. |
The issue no longer exists as of this build? That indicates the issue was one of the three mentioned above. |
Yes. The build for debugging should output debug log to discover the problem. |
Another, the log of #32953 (comment) doesn't help to investigate how to repro? |
@rbuckton we have endgame this week so not too much programming. But I will make sure I use the latest build and have an eye on stale problems. From my experience I think I got hit by the cancellation. The traces even showed that a semantic diagnostic operation got canceled before. So may it can be reproduce by setting a break point into the server that results in the client to cancel the operation. |
9551f19
to
96c5542
Compare
Unfortunately I don't have a test that can repro this behavior, so I am hoping at the very least that the guards that I've added will be enough to catch future leaks of this kind. |
96c5542
to
d9d796b
Compare
src/compiler/checker.ts
Outdated
@@ -317,21 +317,6 @@ namespace ts { | |||
const emitResolver = createResolver(); | |||
const nodeBuilder = createNodeBuilder(); | |||
|
|||
const globals = createSymbolTable(); |
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.
NOTE: I needed to move these after the const checker = {...}
declaration as createSymbol
now depends on checker
to ensure we add the current TypeChecker
to all symbols to make sure we are always using the correct checker.
@typescript-bot perf test |
Heya @rbuckton, I've started to run the perf test suite on this PR at d9d796b. You can monitor the build here. It should now contribute to this PR's status checks. Update: The results are in! |
…rect type checker
d9d796b
to
31273ab
Compare
@rbuckton Here they are:Comparison Report - master..36388
System
Hosts
Scenarios
|
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.
Also, let's make sure performance isn't impacted.
I'm not totally sold on the value of the |
I can pull the API verification for now, but we really should consider ensuring our public API doesn't allow you to try to mix and match types/signatures/symbols produces by other checkers. |
381df1f
to
847f876
Compare
847f876
to
e826553
Compare
@ahejlsberg: Any other comments after having reverted the |
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.
Looks good, but curious about my question below.
if (typeSymbol.members) result.members = typeSymbol.members; | ||
if (valueSymbol.exports) result.exports = valueSymbol.exports; | ||
if (typeSymbol.members) result.members = cloneMap(typeSymbol.members); | ||
if (valueSymbol.exports) result.exports = cloneMap(valueSymbol.exports); |
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.
Why do we need to clone here?
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.
if typeSymbol
or valueSymbol
are not TransietSymbol
s, then their symbol tables consist only of non-transient symbols and persist through multiple checks. If we only copy the reference to the table into a new TransientSymbol
, when we later stuff more things into the table (as is possible for transient symbols), we'll pollute the supposedly "immutable" symbol table from the original non-transient symbol with new transient members (which will then outlive the checker they were created within).
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 was one of 3 possible leaks. We assume elsewhere in the checker that any SymbolTable
attached to a TransientSymbol
is safe to mutate, and sometimes add new symbols to it. combineValueAndTypeSymbols
currently just blindly assigns the reference to the symbol table to result
(which is a TransientSymbol
), ignoring whether typeSymbol
or valueSymbol
were created by the binder. As a result, there is the possibility of some other function in checker later mutating the SymbolTable
.
Need to reopen this on master since I used release-3.8 primarily for providing a stable drop for testers. @typescript-bot cherry-pick this to master |
Hey @rbuckton, I couldn't open a PR with the cherry-pick. (You can check the log here). You may need to squash and pick this PR into master manually. |
Closing in favor of #36491, which ports this change to |
This has been merged into |
Investigating a crash related to the
noIterationTypes
sentinel.Fixes #32953