microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.05k stars 28.8k forks source link

[Settings Sync] Cannot resolve merge conflicts #104626

Closed yzhang-gh closed 3 years ago

yzhang-gh commented 4 years ago

Issue Type: Bug


GIF

sync


Steps

I'm using the stable build so this was my first attempt on the Settings Sync feature.

  1. I turned on Settings Sync on my desktop PC.
  2. I opened my laptop and turned on Settings Sync, and then selected "Manually merge" then I got 5 merge conflicts to resolve.
  3. When I opened the third file markdown.json for the first time, I saw it was empty in the left tab (i.e. Remote tab) and there was one snippet in the right tab.
  4. So I clicked "Merge" button and deleted the snippet in the right tab.
  5. Then I clicked "Accept Merge" and saw an error similar to that in above GIF.
  6. I could not proceed but only cancelled Settings Sync. Now as a result, if I try to turn on Settings Sync, both sides of markdown.json are empty and there is no way to resolve the conflict(?).

(Now both sides of python.json are also empty. I didn't touch it on my first attempt. But they shouldn't be empty to my memory, no matter "Local" or "Remote".)

Looks to be similar to #104622, although here it is about snippets (not keybinding) and my snippet files are not empty.


VS Code version: Code 1.48.0 (db40434f562994116e5b21c24015a2e40b2504e6, 2020-08-13T07:50:42.600Z) OS version: Windows_NT x64 10.0.18363

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz (4 x 2400)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|7.90GB (4.06GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (21) Extension|Author (truncated)|Version ---|---|--- spellright|ban|3.0.52 log-wrapper-for-vscode|chr|1.0.2 vsc-material-theme-icons|equ|1.2.0 prettier-vscode|esb|5.1.3 vscode-highlight|fab|1.4.1 vscode-open-in-application|fab|1.0.5 latex-workshop|Jam|8.11.1 regexp-preview|Lou|0.1.5 git-graph|mhu|1.25.0 python|ms-|2020.8.101144 vscode-pylance|ms-|2020.8.1 remote-ssh|ms-|0.51.0 remote-ssh-edit|ms-|0.51.0 vscode-sort-json|ric|1.18.0 LiveServer|rit|5.6.1 code-settings-sync|Sha|3.4.3 numbermonger|sof|0.5.0 gitmoji-vscode|Vtr|0.2.1 dictionary-completion|yzh|0.9.2 find-word-at-cursor|yzh|0.1.1 markdown-all-in-one|yzh|3.2.0 (1 theme extensions excluded)
yzhang-gh commented 4 years ago

Tried on a different PC.

There is no conflict on markdown.json (not listed in the conflicts). But python.json is still blocking the Sync. It shows nothing on both sides (Remote and Local) while apparently at least the local file is not empty.

sandy081 commented 4 years ago

@yzhang-gh May I know if you are able to reproduce it? If so can you please let me know if the corresponding snippet exists in the disk and let me know its path?

yzhang-gh commented 4 years ago

Thanks.

I just managed to resolve this issue (although have seen some strange things). Here is some information.

Except for those confusing blank tabs, the sync seems to be working now.

Hope it helps.

sandy081 commented 4 years ago
yzhang-gh commented 4 years ago
  • I do not think Settings Sync feature has created snippetsBackup folder. Did you use different settings sync extension before?

I have used Settings Sync by Shan Khan before but haven't performed a sync for a long time (auto sync was disabled).

  • Are ({latex,markdown,python}.json) empty (no contents) on your PC?
  • What happened when you used Accept Local action?

Well, I cannot remember all the details. But with the latest version of VSCode, I no longer have this issue and have 3 devices successfully synced now. Probably we can just close this if there is no one else still having this issue.

sandy081 commented 4 years ago

Ok, thanks for the info.

Will close this for now as you are not seeing this issue anymore. Please reopen it with requested info if you see it again.

fireattack commented 4 years ago

I encountered this issue today.

My "machine A" is GitHub codespace which have sync enabled when I created it, I guess (I never use it much). My "machine B" is my local computer that I'm trying to enable sync.

When go through "Merge manually",

  1. It shows both python.json as empty despite the fact my local one isn't:

image

image

  1. I can't "Accept Local" (click no response).

I didn't do any workaround as mentioned in https://github.com/microsoft/vscode/issues/104626#issuecomment-686580165 because I want to preserve this status to help debug further (users shouldn't need to manually fix things anyway). I just cancelled the sync for now.

Please reopen this issue, and let me know what you need from me.

sandy081 commented 4 years ago

I am not able to reproduce it. I can see the local python file content. Are there any errors in the shared process console (Use command Toggle Shared Process or settings sync log in output view?

fireattack commented 4 years ago

There are.

Shared process console:

DevTools failed to load SourceMap: Could not load content for file:///C:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/Context.js.map: 
DevTools failed to load SourceMap: Could not load content for file:///C:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/Channel.js.map: 
DevTools failed to load SourceMap: Could not load content for file:///C:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/SamplingTelemetryProcessor.js.map: 
DevTools failed to load SourceMap: Could not load content for file:///C:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/Sender.js.map: 
DevTools failed to load SourceMap: Could not load content for file:///C:/Program%20Files/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/sharedProcess/EnvelopeFactory.js.map: 
bootstrap-window.js:216 [uncaught exception]: Error: ENOENT: no such file or directory, scandir 'C:\Users\Administrator\AppData\Roaming\Code\clp\6c3ed5e6192fbbfa4e14c5b119c0f3c1.zh-cn'

Error: ENOENT: no such file or directory, scandir 'C:\Users\Administrator\AppData\Roaming\Code\clp\6c3ed5e6192fbbfa4e14c5b119c0f3c1.zh-cn'
r @ bootstrap-window.js:9
(anonymous) @ bootstrap-window.js:9
emit @ events.js:223
window.onerror @ electron/js2c/renderer_init.js:138
bootstrap-window.js:219 Error: ENOENT: no such file or directory, scandir 'C:\Users\Administrator\AppData\Roaming\Code\clp\6c3ed5e6192fbbfa4e14c5b119c0f3c1.zh-cn'

Error: ENOENT: no such file or directory, scandir 'C:\Users\Administrator\AppData\Roaming\Code\clp\6c3ed5e6192fbbfa4e14c5b119c0f3c1.zh-cn'
    at errors.ts:26
r @ bootstrap-window.js:9
(anonymous) @ bootstrap-window.js:9
emit @ events.js:223
window.onerror @ electron/js2c/renderer_init.js:138

Log (Shared):

[2020-09-29 20:15:03.236] [sharedprocess] [info] main {"machineId":"a7e9cdba9a341e33d1fd18f2b85285e770a4275dee341105ee3bcf74223988c3","windowId":2}
[2020-09-29 20:15:05.952] [sharedprocess] [info] Installing extension: ms-python.python
[2020-09-29 20:15:09.443] [sharedprocess] [info] Downloaded extension: ms-python.python c:\Users\Administrator\AppData\Roaming\Code\CachedExtensionVSIXs\ms-python.python-2020.9.112786
[2020-09-29 20:15:12.854] [sharedprocess] [info] Extracted extension to c:\Users\Administrator\.vscode\extensions\.ms-python.python-2020.9.112786: ms-python.python
[2020-09-29 20:15:12.859] [sharedprocess] [info] Renamed to c:\Users\Administrator\.vscode\extensions\ms-python.python-2020.9.112786
[2020-09-29 20:15:12.864] [sharedprocess] [info] Installation completed. ms-python.python
[2020-09-29 20:15:12.895] [sharedprocess] [info] Extensions installed successfully: ms-python.python
[2020-09-29 20:15:43.530] [sharedprocess] [info] Starting to clean up unused language packs.
[2020-09-29 20:16:48.886] [sharedprocess] [error] Error: Invalid Resource: vscode-userdata-sync://local/c%3A/Users/Administrator/AppData/Roaming/Code/User/sync/snippets/preview/python.json
    at p.getAcceptResult (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:496:300)
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:440:690
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:441:597
    at Object.a [as createCancelablePromise] (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:51:611)
    at p.updateSyncResourcePreview (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:441:513)
    at async p.accept (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:440:622)
    at async _.performAction (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:547:804)
    at async s.call (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:513:536)
[2020-09-29 20:16:49.995] [sharedprocess] [error] Error: Invalid Resource: vscode-userdata-sync://local/c%3A/Users/Administrator/AppData/Roaming/Code/User/sync/snippets/preview/python.json
    at p.getAcceptResult (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:496:300)
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:440:690
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:441:597
    at Object.a [as createCancelablePromise] (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:51:611)
    at p.updateSyncResourcePreview (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:441:513)
    at async p.accept (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:440:622)
    at async _.performAction (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:547:804)
    at async s.call (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/code/electron-browser/sharedProcess/sharedProcessMain.js:513:536)

Log (Setting Sync) has nothing strange.

[2020-09-29 20:15:03.617] [userDataSync] [info] Using settings sync service https://vscode-sync.trafficmanager.net/
[2020-09-29 20:15:03.617] [userDataSync] [info] Auto Sync is disabled.
[2020-09-29 20:16:04.125] [userDataSync] [info] Did reset the local sync state.
sandy081 commented 4 years ago

I suspect this issue is because of path case sensitivity. I do not know how to reproduce it but if you can help me providing some info it would be great.

fireattack commented 4 years ago

Sure, let me know what you need.

By the way, the [sharedprocess] [error] Error: Invalid Resource error happens when I click the "accept X" button. So the issue that it doesn't be able to load my local python snippet into preview happened before this (the preview file was created at "this path in error message, but empty. My original file is at C:\Users\Administrator\AppData\Roaming\Code\User\snippets\python.json.)

fireattack commented 4 years ago

As for the error in console (this indeed happens when I click "merge manually", so likely the root cause), I don't have C:\Users\Administrator\AppData\Roaming\Code\clp\6c3ed5e6192fbbfa4e14c5b119c0f3c1.zh-cn file. actually, I don't have any files in \clp\ at all. Not sure why it tried to read it there.

From the name, I assume it's for language pack. But I have uninstalled zh-cn language pack months ago (and currently have none, just use default English). This may be related: https://github.com/microsoft/vscode/issues/50763#issuecomment-393473577 - the only thing I found when search for issues related to /clp/ in shared process.

sandy081 commented 4 years ago

I would come up with a fix and share the build that has the fix. Let me know if you can help us in validating it?

fireattack commented 4 years ago

Yeah I can

sandy081 commented 4 years ago

Can you please try with latest insiders and let me know if you still see the issue?

tolgabalci commented 4 years ago

I don't have a way of reproducing this under the insiders edition, but I had the same exact issue when performing a manual merge. However when I did a "Merge" to begin and it failed to merge due to conflicts the table of files that showed up when I continued with Manual merge already had a check box next to all the empty files, so all I had to do was fix the two files I had merge conflicts in (simple, I just took local) and it allowed me to continue with the Settings Sync.

fireattack commented 3 years ago

Can you please try with latest insiders and let me know if you still see the issue?

image

Seems to be working in Insiders.

Version: 1.51.0-insider Commit: f5d3ba4d61146b78f0c75c82f3f85232d3409bc1 Date: 2020-10-09T05:34:54.647Z Electron: 9.2.1 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 6.1.7601

sandy081 commented 3 years ago

Thanks for confirming.