-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Extensions cannot get workspace configurations of their own #5649
Comments
it seems like the main side doesn't send the full configuration to the extension host, esp. the default values which should have been derived from the extensions (package.json) are missing. The snapshot shows what we send to the extension host. No mentioning of |
I believe this was introduced with 31ce12f. We now send the configuration over to the extension host before we have loaded the values/defaults from the extensions (their package.json). This happens when extensions are detected and when the |
⚡ |
@alexandrudima @jrieken would appreciate a second look on my change (a6d7403). Basically what we always did before was to reload the entire configuration from disk as soon as the This means, for each extension with configuration we would do a full reload of all configuration from disk even though that was not needed because the only thing that changes is the default values, not the actual values in the configuration files. I did a bad change to buffer this event because I noticed it is fired once per extension. So I would wait for 50ms before reloading the configuration from disk on such an event and this causes a race condition, because the extension might come up before 50ms and expect the configuration settings to be there. Now, with my new change, instead of reloading the configuration from disk each time, I just update my cached configuration with all the new default values I get from the extensions. In other words, the new cached configuration is the total set of defaults with the actual changed values mixed in. |
My extension (Guides) is working properly on 1.1.0-insider (1865ad0) without any code changes |
@shardulm94 can you share your extensions where this still happens? |
@shardulm94 I cannot reproduce, are you sure you are on latest insider? |
@bpasero Yes, I am on the latest one. |
@alexandrudima @jrieken this is a race condition that only reproduces on Windows for me, likely because the timing for spawning the extension host is different. When I debug the Is there any chance that the In other words, the extension host should only start activating extensions if the configuration service had a chance to |
@alexandrudima @jrieken I now instrumented the When I look into the implementation in version 1.0.0, I would argue that we have been lucky that the exception did not occur, because I wonder if the fact that the configuration service was long running in 1.0.0 prevented the race condition because the Again I would argue that no extension should get activated before all configurations have been synchronised to the extension host. We need to somehow flush the configuration to the extension host if possible. |
I was always under that assumption. That's why there is the early return which should have been an assertion. Tho, I believe the first configuration has been set, but the extension specific config might be missing so that this happens |
To recap (am I understanding this?):
I think we need to add something around https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/node/extensionHostMain.ts#L142 where we'd call |
@jrieken yes, it should be an assertion at that point @alexandrudima yes, extensions get scanned for configuration and they end up in the configuration service on the main side that merges them into the cached configuration (the one that is loaded right on startup). this works all fine, but the configuration is not sent back to the extension host in-time before the extension accesses this configuration.
Yes, however I think the issue is more generic: We see an extension accessing the configuration service before the configuration service had a chance to send its configuration over to the extension host. That results in NPEs. +1 for having a way to flush all configuration values to the extension host and only then continue to activate extensions. |
…cknowledges its receival of the ext descriptions
@bpasero We could get it to reproduce only on the insiders build (not from dev, not from built without minification, really, only in the insiders build). Steps to verify:
|
@alexandrudima thanks, I was able to reproduce from insiders on windows too. |
Extensions cannot get their configuration settings due to
vscode.workspace.getConfiguration
returnsundefined
.This is the error trace from running the extension...
This is the variable dumps from debug mode of
guides
extension while request forless
,explorer
andguides
configurations... (you can see thatguides
variable has no member whileless
andexplorer
have their members)However, the default configurations contain those keys...
Related issue on
guides
repo: spywhere/vscode-guides#3Known extensions affect by this issue (thanks to @andischerer):
Steps to Reproduce:
guides
)The text was updated successfully, but these errors were encountered: