ProfilesCache does not handle race conditions #2831
Labels
bug
Something isn't working
priority-high
Production outage - this quarter or at least next quarter
severity-high
Bug for which there may be workaround but limits the usage of the Zowe for major use cases
Describe the bug
Although JavaScript and Node.js are single-threaded, multiple VS Code extensions can activate in parallel. Extensions that grab the static
ProfilesCache
instance from Zowe Explorer might compete with one another when performing operations on the cache (such asrefresh
), causing undefined behavior in the cache (such as missing or incorrect profile values, etc.)To Reproduce
Have two or more extensions that access the
ProfilesCache
instance through Zowe Explorer's extension exports (vscode.extensions.getExtension("zowe.vscode-extension-for-zowe").exports
). Try to callrefresh
on this cache instance for each extension, as soon as the extensions are activated.Expected behavior
The ProfilesCache instance should fill the cache successfully during refresh, and return an instance with valid profiles.
Desktop (please complete the following information):
Additional context
A few internal developers have reported this issue. Due to the nature of VS Code extensions and asynchronous code in Node.js, we likely need to add multi-threading support to prevent any problems that may surface from ProfilesCache race conditions.
The text was updated successfully, but these errors were encountered: