Code-settings-sync: [bug] open browser when setting is locked

Created on 16 Jul 2017  ·  13Comments  ·  Source: shanalikhan/code-settings-sync

Code Settings Sync Version : 2.8.2

When I open vscode second instance, it show error message and open url http://shanalikhan.github.io/2017/02/19/Option-to-ignore-settings-folders-code-settings-sync.html:

Lock is not acquired/owned by you: Error: Lock is not acquired/owned by you
    at canonicalPath (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:254:43)
    at Object.realpath (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\lib\syncFs.js:17:9)
    at canonicalPath (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:21:16)
    at unlock (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:245:5)
    at Function.unlockSync (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:302:5)
    at Commons.<anonymous> (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\out\src\commons.js:69:26)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\out\src\commons.js:4:58)

expected:

do not open url if the file is locked.

bug 🐛 fixed

All 13 comments

When I open vscode second instance

Can you write down all the steps from start so i can reproduce it at my end.

Thanks

  1. Open vscode from windows folder context menu.
  2. Open vscode from another windows folder context menu immediately.

The first vscode popup a message Sync : Unable to read syncLocalSettings.json. Make sure its Valid JSON., and show those message in developer tool:

[Extension Host] SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Commons.<anonymous> (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\out\src\commons.js:223:44)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\out\src\commons.js:4:58)

Sync : Unable to read syncLocalSettings.json. Make sure its Valid JSON.

The second vscode show those message in developer tool:

Lock is not acquired/owned by you: Error: Lock is not acquired/owned by you
    at canonicalPath (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:254:43)
    at Object.realpath (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\lib\syncFs.js:17:9)
    at canonicalPath (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:21:16)
    at unlock (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:245:5)
    at Function.unlockSync (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\node_modules\proper-lockfile\index.js:302:5)
    at Commons.<anonymous> (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\out\src\commons.js:69:26)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\skyof\.vscode\extensions\Shan.code-settings-sync-2.8.2\out\src\commons.js:4:58)
e.onUnexpectedError @ /C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/electron-browser/workbench.main.js:29

This is not one hundred percent happen.

Is possible the vscode 2 writing syncLocalSettings.json and vscode 1 reading it ?

This pr had not fixed the lock problem. (⊙﹏⊙)

Seem like the second vscode instance will unlock sync.lock and break all sync mechanism at activate(context: vscode.ExtensionContext) line 29.

Thanks for the PR, i will accept it, also will reproduce the error and get back to you in few days.

Oh, this issus is occur when I set the option: "sync.autoUpload": true

It is quite annoying to constantly have the web browser open just because it can't sync. Is there anyway to disable that so it stops doing it?

I commonly work with more than one window of Code and understand that will prevent the sync from working properly.

@Cologler i have released your PR in the 2.8.3 version.
Seems like its fixed as i was not able to product using these steps : https://github.com/shanalikhan/code-settings-sync/issues/363#issuecomment-316020364

@wsmelton update and let me know. Or kindly write the steps in detail so i can reproduce at my end.

@shanalikhan This is a temporary solution and it cannot fix other cross process issues.

Yes i know, i need to have steps to reproduce at my end in order to fix it.

I'm closing this issue as there are no concrete steps to reproduce also since last year. Extension code is refactored and improved.
Feel free to create a new issue with the detailed steps if there is any in the current version.

Btw this is still happening with version 3.2.8. I'll investigate later

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jdshkolnik picture jdshkolnik  ·  3Comments

larrym picture larrym  ·  4Comments

mklement0 picture mklement0  ·  5Comments

fdncred picture fdncred  ·  3Comments

darkvertex picture darkvertex  ·  4Comments