microsoft / vscode

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

Can't launch vscode, run "code --verbose" and it said "URI malformed" #77936

Closed VitalyAnkh closed 5 years ago

VitalyAnkh commented 5 years ago

Steps to Reproduce:

  1. Launch vscode
  2. Crash. It says:
    code --verbose
    [18312:0725/231613.049843:ERROR:sandbox_linux.cc(379)] InitializeSandbox() called with multiple threads in process gpu-process.
    [main 2019-07-25T15:16:13.082Z] Starting VS Code
    [main 2019-07-25T15:16:13.083Z] from: /opt/visual-studio-code/resources/app
    [main 2019-07-25T15:16:13.084Z] args: { _: [],
    diff: false,
    add: false,
    goto: false,
    'new-window': false,
    'reuse-window': false,
    wait: false,
    version: false,
    help: false,
    'list-extensions': false,
    'show-versions': false,
    verbose: true,
    status: false,
    'prof-startup': false,
    'disable-extensions': false,
    'disable-gpu': false,
    logExtensionHostCommunication: false,
    'skip-getting-started': false,
    'skip-release-notes': false,
    'sticky-quickopen': false,
    'disable-restore-windows': false,
    'disable-telemetry': false,
    'disable-updates': false,
    'disable-crash-reporter': false,
    'skip-add-to-recently-opened': false,
    'unity-launch': false,
    'open-url': false,
    nolazy: false,
    issue: false,
    'file-write': false,
    'file-chmod': false,
    'driver-verbose': false,
    force: false,
    'prof-code-loading': false }
    [main 2019-07-25T15:16:13.094Z] Resolving machine identifier...
    [main 2019-07-25T15:16:13.095Z] Resolved machine identifier: 2cc24026634d230854ac506d7f0cb0c1c0de079da0340c74333dafd7143e1b30
    [main 2019-07-25T15:16:13.186Z] update#setState idle
    [main 2019-07-25T15:16:13.188Z] [storage state.vscdb] open(/home/vitalyr/.config/Code/User/globalStorage/state.vscdb, retryOnBusy: true)
    [main 2019-07-25T15:16:13.189Z] lifecycle (main): phase changed (value: 2)
    [main 2019-07-25T15:16:13.190Z] windowsManager#open
    [main 2019-07-25T15:16:13.345Z] telemetry/optInStatus { optIn: true }
    [main 2019-07-25T15:16:13.345Z] telemetry/machineIdFallback { usingFallbackGuid: false }
    [main 2019-07-25T15:16:13.346Z] URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at Function.parse (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:110:321)
    at Object.t.restoreRecentlyOpened (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:225:857)
    at e.getRecentlyOpenedFromStorage (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:384:457)
    at e.addEntriesFromStorage (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:384:101)
    at e.addRecentlyOpened (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:382:115)
    at t.open (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:446:714)
    at t.openFirstWindow (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:488:659)
    at a.invokeFunction.t (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:483:367)
    at l.invokeFunction (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:227:522)
    at t.<anonymous> (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:483:344)
    at Generator.next (<anonymous>)
    at o (/opt/visual-studio-code/resources/app/out/vs/code/electron-main/main.js:13:454)
    [main 2019-07-25T15:16:13.346Z] Lifecycle#kill()
    [main 2019-07-25T15:16:13.354Z] Lifecycle#window.on('closed') - window ID 1
    [main 2019-07-25T15:16:13.354Z] Lifecycle#onWillShutdown.fire()
    [main 2019-07-25T15:16:13.357Z] [storage state.vscdb] close()

Launch with code --disable-extensions to check: The same result as above. Does this issue occur when all extensions are disabled?: Yes

jrieken commented 5 years ago

All the uri carnage has been reverted, not sure what's in the store here but the restore logic shouldn't be so fragile. Assigning @aeschli who I believe already pushed a fix for this

aeschli commented 5 years ago

Yes there are now try/catches at the places where we restore. @VitalyAnkh Can you send us your ~/.config/Code/storage.json so we see the path that caused this?

To get going again, you have to delete this file and start VSCode again.

VitalyAnkh commented 5 years ago

The content of ~/.config/Code/storage.json is:

{
    "telemetry.machineId": "2cc24026634d230854ac506d7f0cb0c1c0de079da0340c74333dafd7143e1b30",
    "openedPathsList": {
        "workspaces3": [
            "file:///home/vitalyr/projects/learn/Python/mysite",
            "file:///home/vitalyr/projects/learn/Java/Play",
            "file:///home/vitalyr/projects/config",
            "file:///home/vitalyr/projects/shell",
            "file:///home/vitalyr/.cache/yay/baidunetdisk",
            "file:///home/vitalyr/projects/learn/Assembly",
            "file:///home/vitalyr/projects/rust/redox",
            "file:///home/vitalyr/projects/learn/C",
            "file:///home/vitalyr/projects/learn/C/TYOS",
            "file:///home/vitalyr/projects/learn/Shell/aur"
        ],
        "files2": [
            "file:///home/vitalyr/projects/java/catalina/RUNNING.txt",
            "file:///home/vitalyr/projects/java/catalina/conf/Catalina/localhost/test_tomcat.xml",
            "file:///home/vitalyr/.profile",
            "file:///home/vitalyr/.zshrc",
            "file:///home/vitalyr/%E4%B8%8B%E8%BD%BD/DBManager.java",
            "file:///home/vitalyr/%E4%B8%8B%E8%BD%BD/%B1%CA%BC%C72---JDBC%B3%CC%D0%F2%B5%C4%BF%AA%B7%A2%B2%BD%D6%E8_%CA%B9%D3%C3Statement%BD%D3%BF%DA%CD%EA%B3%C9%BB%F9%B1%BECRUD%B2%D9%D7%F7.txt",
            "file:///home/vitalyr/%E4%B8%8B%E8%BD%BD/%B1%CA%BC%C71---JDBC%B5%C4%BB%F9%B1%BE%B8%C5%C4%EE_%B3%A3%D3%C3%BD%D3%BF%DA.txt",
            "file:///home/vitalyr/.IntelliJIdea2019.1/config/jdbc-drivers/PostgreSQL/42.2.5/postgresql-driver-license.txt",
            "file:///var/lib/postgres/data/pg_hba.conf",
            "file:///var/lib/postgres/data/pg_hba.confg",
            "file:///home/vitalyr/projects/learn/SQL/DDL.sql",
            "file:///home/vitalyr/projects/learn/SQL/smallRelationsInsertFile.sql",
            "file:///home/vitalyr/%E6%96%87%E6%A1%A3/Books/CS/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/Code/%E4%B8%80%E4%B8%AA64%E4%BD%8D%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9A%84%E8%AE%BE%E8%AE%A1%E4%B8%8E%E5%AE%9E%E7%8E%B0/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86%20%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%9B%B8%E5%85%B3%E7%9F%A5%E8%AF%86%E4%BB%8B%E7%BB%8D%E5%8F%8A%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/%E7%AC%AC2%E7%AB%A0/bochs%E7%9B%B8%E5%85%B3%E4%BF%A1%E6%81%AF/bochsrc",
            "file:///home/vitalyr/%E6%96%87%E6%A1%A3/Researchs/%E6%95%B0%E8%AE%BA/2018-10-18%20%E5%88%B0%202018-10-25%20%E8%BF%9B%E5%B1%95.txt"
        ]
    },
    "theme": "vs-dark",
    "themeBackground": "#002b36",
    "pickerWorkingDir": "/home/vitalyr/projects",
    "windowsState": {
        "lastActiveWindow": {
            "folder": "file:///home/vitalyr/projects/learn/Python/mysite",
            "backupPath": "/home/vitalyr/.config/Code/Backups/4bff6fd2b2a6e47b1a5ba1e5c4c92c80",
            "uiState": {
                "mode": 0,
                "x": 0,
                "y": 27,
                "width": 1920,
                "height": 1053
            }
        },
        "openedWindows": []
    }
}

After deleting this file, I could launch vscode, thank you! But I'm a little curious about what caused this problem?

aeschli commented 5 years ago

The malformed URI is file:///home/vitalyr/%E4%B8%8B%E8%BD%BD/%B1%CA%BC%C72---JDBC%B3%CC%D0%F2%B5%C4%BF%AA%B7%A2%B2%BD%D6%E8_%CA%B9%D3%C3Statement%BD%D3%BF%DA%CD%EA%B3%C9%BB%F9%B1%BECRUD%B2%D9%D7%F7.txt

aeschli commented 5 years ago

@VitalyAnkh We had a bug in our URI library with URI.toString. It was in 1.36 but got reverted in 1.36.1. The invalid URI were written in 1.36, and now 1.36.1 fails.

aeschli commented 5 years ago

1.37 now has code to gracefully handle URIs in storage.json that are malfomormed. Sorry for the trouble.

VitalyAnkh commented 5 years ago

@aeschli Great work, thank you!