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

Preference Transactions Failing when Run in Parallel #10824

Closed
colin-grant-work opened this issue Mar 1, 2022 · 2 comments · Fixed by #10884
Closed

Preference Transactions Failing when Run in Parallel #10824

colin-grant-work opened this issue Mar 1, 2022 · 2 comments · Fixed by #10884
Assignees
Labels
preferences issues related to preferences

Comments

@colin-grant-work
Copy link
Contributor

A user posted this, and although the answer works, the idea of the PR linked there was actually to reliably allow rapid preference setting, rather than causing errors when preferences are set rapidly.

I'm currently facing this issue while setting CustomPreference. I'm having a CustomDialog which sets multiple preference using for loop upon clicking OK. The first three preferences sets just fine. However, post that it throws the following error. This dialog used to work fine with previous theia version. Any help would be appreciated.

Thanks

Canceled: Canceled
    at new Transaction (http://localhost:3000/vendors-node_modules_theia_preferences_lib_browser_preference-frontend-module_js.bundle.js:1017:46)
    at new PreferenceTransaction (http://localhost:3000/vendors-node_modules_theia_preferences_lib_browser_preference-frontend-module_js.bundle.js:1123:29)
    at _createInstance (http://localhost:3000/bundle.js:78216:12)
    at Object.resolveInstance (http://localhost:3000/bundle.js:78236:18)
    at http://localhost:3000/bundle.js:78331:42
    at Object.resolve (http://localhost:3000/bundle.js:78355:12)
    at http://localhost:3000/bundle.js:77374:37
    at Container.__webpack_modules__.../../node_modules/inversify/lib/container/container.js.Container._get (http://localhost:3000/bundle.js:77365:44)
    at Container.__webpack_modules__.../../node_modules/inversify/lib/container/container.js.Container.get (http://localhost:3000/bundle.js:77282:21)
    at UserPreferenceProvider.transactionFactory (http://localhost:3000/vendors-node_modules_theia_preferences_lib_browser_preference-frontend-module_js.bundle.js:952:22)
                Object.keys(values).forEach(async (ele) => {
                    await preferenceService.set('instance.search.' + ele, values[ele], PreferenceScope.Workspace)
                })

Originally posted by @maheshrajrp in #10744

@colin-grant-work colin-grant-work self-assigned this Mar 1, 2022
@vince-fugnitto vince-fugnitto added the preferences issues related to preferences label Mar 2, 2022
@colin-grant-work
Copy link
Contributor Author

@msujew, you mentioned having had the same problem - do you recall any details?

@msujew
Copy link
Member

msujew commented Mar 15, 2022

@colin-grant-work this was the old code from the Arduino-IDE, which led to the race condition (at least I assume it to be a race condition).

I'm not fully sure anymore what I saw during debugging, before I simply decided to run everything in sequence, but I think some variables inside of some preference provider were set outside of the transaction, which led to the preferences not being applied correctly.

By the way, have you noticed this message when quickly changing preferences (like quickly changing the color theme)?

image

I didn't catch it during review, but it appears almost every time when changing color/icon themes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preferences issues related to preferences
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants