microsoft / vscode

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

1.90 snap package crash on startup #212494

Closed muhammadismailkhan0009 closed 3 months ago

muhammadismailkhan0009 commented 4 months ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. launch the code-insiders from terminal with command code-insiders. it opens and then closes down.
  2. here is the crash report(file_attached): crash_report.txt

here is the snippet of crash logs that i feel is important:

[17512:0511/145729.715832:ERROR:angle_platform_impl.cc(44)] Display.cpp:1052 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
ERR: Display.cpp:1052 (initialize): ANGLE Display::initialize error 12289: Could not create a backing OpenGL context.
[17512:0511/145729.715854:ERROR:gl_display.cc(515)] EGL Driver message (Critical) eglInitialize: Could not create a backing OpenGL context.
[17512:0511/145729.715863:ERROR:gl_display.cc(786)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[17512:0511/145729.715874:ERROR:gl_display.cc(820)] Initialization of all EGL display types failed.
[17512:0511/145729.715883:ERROR:gl_ozone_egl.cc(26)] GLDisplayEGL::Initialize failed.
[17512:0511/145729.717123:ERROR:viz_main_impl.cc(196)] Exiting GPU process due to errors during initialization
MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load driver: iris
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
failed to load swrast driver
[17520:0511/145729.884318:WARNING:sandbox_linux.cc(418)] InitializeSandbox() called with multiple threads in process gpu-process.
[main 2024-05-11T09:57:29.908Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
[0511/145729.910779:ERROR:process_memory_range.cc(75)] read out of range

here "mypcname" is the placeholder for actual user login name.

tried but didn't work: reference issue

Workaround: running with --use-gl=angle --use-angle=swiftshader

Romstar commented 4 months ago

Having the same issue.

AndrewSpano commented 4 months ago

Having the same issue in Ubuntu 23.10

muhammadismailkhan0009 commented 4 months ago

@Romstar @AndrewSpano till they fix it, i'll recommend you use vs code release version. it is working.

ilya-lazarev commented 4 months ago

Same issue

Timbuktu1982 commented 4 months ago

same issue with 23.10

Timbuktu1982 commented 4 months ago

same issue with 23.10

I have installed the latest build from https://code.visualstudio.com/insiders/ and now code-insiders run without crashes...

muhammadismailkhan0009 commented 4 months ago

not resolved yet. tried again on latest ubuntu distro.

WhyDoWeLiveWithoutMeaning commented 4 months ago

I also have the same issue, For some reason it does open when I am connect to my laptop hub.

Timbuktu1982 commented 4 months ago

same issue with 23.10

I have installed the latest build from https://code.visualstudio.com/insiders/ and now code-insiders run without crashes...

Hi there, it should only be mentioned again as a temporary solution that you can install the deb package (as described above) in parallel to the snap package, which at least works for me. If I start the snap version, it still does not work after the last update....

schaumtier commented 4 months ago

same problem here, but as soon as i plug in an external monitor via HDMI, it works

schaumtier commented 4 months ago

... and with unplugin the external monitor, code-insiders crashs

Timbuktu1982 commented 4 months ago

not in my case

akshayvijayjain commented 4 months ago

this worked from https://code.visualstudio.com/docs/setup/linux the repository and key can also be installed manually with the following script:

sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" |sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null
rm -f packages.microsoft.gpg

Then update the package cache and install the package using:

sudo apt install apt-transport-https
sudo apt update
sudo apt install code # or code-insiders
Rexogamer commented 3 months ago

still occurring on the snap. please fix this - a crash loop on any other platform wouldn't be left unacknowledged for 11 days :frowning_face:

Timbuktu1982 commented 3 months ago

Hi there, what is the status of the matter? It's quite difficult to work sensibly at the moment. What is the reason for the fact that the error correction remains unanswered or continues for so long? If the bug is not fixed in the version of "code-insiders", it will surely be included in the next version of "code", right?

paulw2u commented 3 months ago

After reviewing some of the comments above I did some testing with revision 1644 of the snap.

  1. Using a laptop running Ubuntu 22.04 and an external monitor I found that I can only use Code-Insiders in 'Join Displays' mode. Any attempt to run Code-Insiders in a single display mode (using either the built-in or external monitor) results in two applications windows opening and immediately closing. The external monitor was connected via HDMI. Code is usable on this laptop.

  2. On another laptop running Kubuntu 24.04 Code-Insiders opened and closed immediately. It wasn't possible to connect an external monitor at the time. Code is usable on this laptop.

  3. On a desktop computer running Kubuntu 24.04 I have no problems running Code-Insiders and have done so reliably since I installed Kubuntu on it around a month ago.

jeropaul commented 3 months ago

I've just downgraded to 1.89.1, to deal with this issue. Very very annoying behaviour

deepak1556 commented 3 months ago

I tried to repro on Ubuntu 22.04 with both wayland and x11 sessions but unable to trigger the crash unless I force the native wayland backend in the application which is a known different issue (--ozone-platform=wayland). But based on the reports there are users on 22.04 who are also able to repro the issue and the crash dumps so far indicate a crash in the gpu process. So very likely a new gpu driver dependency that we are not shipping with the snap package.

Can users try the following steps and provide the outcome, it will help narrow down the issue.

Timbuktu1982 commented 3 months ago

Hi, yeah, i can start code-insiders 1.91.0 successful with "--disable-gpu" or with "--use-gl=swiftshader".

1.91.0-insider 7cd1f1ce4e8ba91863fc9840530073813a0fd4df x64

code_strace.zip

titi-lima commented 3 months ago
  • code --user-data-dir /tmp/code-1-90

Crashes under all exemples at 1.9.0.

Here's the output of snap run --strace="-o code_strace.log -DD -qq -e trace=file" code ~/example: code_strace.log

$ code -v
1.90.0

89de5a8d4d6205e5b11647eb6a74844ca23d2573
x64
bjmc commented 3 months ago

Does it crash when starting with code --disable-gpu

Yes, it crashes.

Does it crash when starting with code --use-gl=swiftshader

Yes, it crashes.

Can you start with snap run --strace="-o code_strace.log -DD -qq -e trace=file" code and attach the output to this issue

code_strace.log

Does the crash happen with code --user-data-dir /tmp/code-1-90

Yes, it crashes.

DanAlexson90 commented 3 months ago

Crashes under all examples at 1.9.0.

Same.

Also, I don't think merging the other issues into this one was appropriate. Didn't have this problem until the today update ( certainly not a month ago ).

jdehaan commented 3 months ago

Same issue with:

➜ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:    22.04
Codename:   jammy
➜ code --version
1.90.0
89de5a8d4d6205e5b11647eb6a74844ca23d2573
x64
➜ snap --version
snap    2.63
snapd   2.63
series  16
ubuntu  22.04
kernel  6.5.0-35-generic
aoh-mahesh commented 3 months ago

same issue

deepak1556 commented 3 months ago

The SIGTRAP in gpu process comes from requesting access to a resource file which is not available, particularly this check https://source.chromium.org/chromium/chromium/src/+/main:ui/base/resource/resource_bundle.cc;l=359;. The resource file initialization happens in https://github.com/electron/electron/blob/791907f0f3559ed5e6c829a0387b12c9437a3ba7/shell/app/electron_main_delegate.cc#L96-L100 but that has not changed for a long time so doesn't answer why it triggered with Electron 29 update, also deb package working fine is interesting for the same version.

Crash reason:  SIGTRAP
Crash address: 0x0
Process uptime: 0 seconds

Thread 24 (crashed)
 0  code!ui::ResourceBundle::GetSharedInstance() [immediate_crash.h : 176 + 0x1]
    rax = 0x0000000000000000   rdx = 0x0000000000000000
    rcx = 0x0000000000000000   rbx = 0x00007e1b19fba410
    rsi = 0x000000000000bf26   rdi = 0x00007e1b19fba410
    rbp = 0x00007e1b19fba240   rsp = 0x00007e1b19fba240
     r8 = 0x0000000000000000    r9 = 0x00002e7c0041b900
    r10 = 0x0000000000000000   r11 = 0x0000000000000246
    r12 = 0x0000000000000005   r13 = 0x0000000000000000
    r14 = 0x000000000000bf26   r15 = 0x0000000000000060
    rip = 0x0000618743a9b113
    Found by: given as instruction pointer in context
 1  code!l10n_util::GetStringUTF8(int) [l10n_util.cc : 809 + 0x5]
    rbx = 0x00007e1b19fba410   rbp = 0x00007e1b19fba280
    rsp = 0x00007e1b19fba250   r12 = 0x0000000000000005
    r13 = 0x0000000000000000   r14 = 0x000000000000bf26
    r15 = 0x0000000000000060   rip = 0x0000618743a95de6
    Found by: call frame info
 2  code!ui::BuildDisplaysFromXRandRInfo(ui::DisplayConfig const&, unsigned long*) [x11_display_util.cc : 448 + 0xd]
    rbx = 0x00007e1b19fba410   rbp = 0x00007e1b19fba850
    rsp = 0x00007e1b19fba290   r12 = 0x0000000000000005
    r13 = 0x0000000000000000   r14 = 0x00000000000001e3
    r15 = 0x0000000000000060   rip = 0x0000618743b3b1d9
    Found by: call frame info
 3  code!ui::GetPrimaryDisplayRefreshIntervalFromXrandr() [x11_display_util.cc : 517 + 0xb]
    rbx = 0x00007e1b19fba8a0   rbp = 0x00007e1b19fba8c0
    rsp = 0x00007e1b19fba860   r12 = 0x00007e1b19fba940
    r13 = 0x00002e7c0045c680   r14 = 0x00007e1b19fba880
    r15 = 0x00007e1b19fba8e0   rip = 0x0000618743b3ba03
    Found by: call frame info
 4  code!ui::(anonymous namespace)::XRandrHelper::GetInterval() [x11_xrandr_interval_only_vsync_provider.cc : 60 + 0x5]
    rbx = 0x00006187474cd258   rbp = 0x00007e1b19fba900
    rsp = 0x00007e1b19fba8d0   r12 = 0x00007e1b19fba940
    r13 = 0x00002e7c0045c680   r14 = 0x00002e7c0047cc00
    r15 = 0x00007e1b19fba8e0   rip = 0x0000618743b45035
    Found by: call frame info
 5  code!ui::XrandrIntervalOnlyVSyncProvider::GetVSyncParameters(base::OnceCallback<void (base::TimeTicks, base::TimeDelta)>) [x11_xrandr_interval_only_vsync_provider.cc : 77 + 0x5]
    rbx = 0x00007e1b19fba938   rbp = 0x00007e1b19fba970
    rsp = 0x00007e1b19fba910   r12 = 0x00007e1b19fba940
    r13 = 0x00002e7c0045c680   r14 = 0x00002e7c0053c540
    r15 = 0x00007e1b19fba918   rip = 0x0000618743b44f8e
    Found by: call frame info
 6  code!viz::SoftwareOutputSurface::SwapBuffers(viz::OutputSurfaceFrame) [software_output_surface.cc : 89 + 0xc]
    rbx = 0x00007e1b19fbaa40   rbp = 0x00007e1b19fbaab0
    rsp = 0x00007e1b19fba980   r12 = 0x00002e7c0105f070
    r13 = 0x00002e7c0045c680   r14 = 0x00002e7c00419c80
    r15 = 0x00002e7c01099780   rip = 0x000061874496c706
    Found by: call frame info
 7  code!viz::SoftwareRenderer::SwapBuffers(viz::DirectRenderer::SwapFrameData) [software_renderer.cc : 127 + 0xc]
    rbx = 0x00002e7c004bce00   rbp = 0x00007e1b19fbac00
    rsp = 0x00007e1b19fbaac0   r12 = 0x00007e1b19fbaac0
    r13 = 0xaaaaaaaaaaaaaaaa   r14 = 0x00007e1b19fbab40
    r15 = 0x00002e7c0045c680   rip = 0x00006187449cff84
    Found by: call frame info
 8  code!viz::Display::DrawAndSwap(viz::DrawAndSwapParams const&) [display.cc : 1049 + 0xc]
    rbx = 0x00002e7c004bce00   rbp = 0x00007e1b19fbb010
    rsp = 0x00007e1b19fbac10   r12 = 0x00002e7c0106ca01
    r13 = 0xaaaaaaaaaaaaaaaa   r14 = 0x00007e1b19fbac10
    r15 = 0x00002e7c0106ca00   rip = 0x000061874498b4e0
    Found by: call frame info
 9  code!viz::DisplayScheduler::DrawAndSwap() [display_scheduler.cc : 223 + 0x5]
    rbx = 0x0000000000000000   rbp = 0x00007e1b19fbb090
    rsp = 0x00007e1b19fbb020   r12 = 0xaaaaaaaaaaaaaaaa
    r13 = 0x0000000000000000   r14 = 0x00002e7c00478d00
    r15 = 0xaaaaaaaaaaaaaaaa   rip = 0x00006187449d5d60
    Found by: call frame info
10  code!viz::DisplayScheduler::OnBeginFrameDeadline() [display_scheduler.cc : 526 + 0x8]
    rbx = 0x00002e7c00478d00   rbp = 0x00007e1b19fbb0f0
    rsp = 0x00007e1b19fbb0a0   r12 = 0xaaaaaaaaaaaaaaaa
    r13 = 0x0000000000000000   r14 = 0x0000000000000000
    r15 = 0x00007e1b19fbb100   rip = 0x00006187449d4fb5
    Found by: call frame info
deepak1556 commented 3 months ago

Thanks for the strace log, I would like to confirm the gpu feature set as next step. Can users try the following and provide the output

deepak1556 commented 3 months ago

@Timbuktu1982 just to confirm, insiders snap based on 1.91.0 works fine with --disable-gpu or even without the flags ?

@DanAlexson90 the issue you are seeing in 1.90.0 was observed first in insiders, the root cause is from runtime update hence I have merged the issues to the first report that was made.

bjmc commented 3 months ago

Does it crash starting with code --disable-gpu-compositing --disable-gpu --use-gl=swiftshader

No! :slightly_smiling_face: It launches successfully and I see the release notes "May 2024 (version 1.90)"

code --enable-tracing="ozone" --trace-startup-file=/tmp/code-snap-trace.log --trace-startup-format=json

code-snap-trace.log

Edit: Disregard - I was launching the .deb version.

deepak1556 commented 3 months ago

@bjmc thats great to know, look like gpu compositor is the component triggering the crash.

As for the trace, seems like you had captured it from the deb package. Can you get the trace from the snap package. Thanks!

tishka-new commented 3 months ago

I have same issue today. Vscode crashes on startup. code --version 1.90.0 89de5a8d4d6205e5b11647eb6a74844ca23d2573 x64

The above options running with the GPU disabled didn't help either

vscode.txt

aoh-mahesh commented 3 months ago

Its working for me I tried command code --in-process-gpu .

tishka-new commented 3 months ago

code --in-process-gpu helps me too! Thanks

deepak1556 commented 3 months ago

@aoh-mahesh does it work when running with code --disable-gpu-compositing ?

TyrisDavidLopez commented 3 months ago

workaround, it works for me: code --in-process-gpu

aoh-mahesh commented 3 months ago

@aoh-mahesh does it work when running with code --disable-gpu-compositing ?

No

deepak1556 commented 3 months ago

Oh interesting, what about forcing the software renderer code --disable-gpu-compositing --disable-gpu --use-gl=swiftshader ?

Can you share the trace from code --enable-tracing="ozone" --trace-startup-file=/tmp/code-snap-trace.log --trace-startup-format=json

JoanFM commented 3 months ago

workaround, it works for me: code --in-process-gpu

This is working for me

ImadSaddik commented 3 months ago

Its working for me I tried command code --in-process-gpu .

Thank you so much, today I open my laptop, and I was chocked that code was crashing for the first time. This solution worked well for me.

bjmc commented 3 months ago

@bjmc thats great to know, look like gpu compositor is the component triggering the crash.

As for the trace, seems like you had captured it from the deb package. Can you get the trace from the snap package. Thanks!

Sorry, maybe this is a red herring for you because I did install the .deb. Let me switch back to the snap package and see if I can get you a trace.

sbe-arg commented 3 months ago

I'm using codium to survive. Not good to loose the main IDE

AndrewSpano commented 3 months ago

What worked for me was to remove it and then install it with apt (instead of snap)

devfaysal commented 3 months ago

Removing the snap build Installing the deb build from the site is working fine. https://code.visualstudio.com/

bjmc commented 3 months ago

@deepak1556 Apologies, I think I gave you bad info in my last comment. I've apt removed the .deb package and now it is crashing with code --disable-gpu-compositing --disable-gpu --use-gl=swiftshader (code --in-process-gpu does work)

When I run code --enable-tracing="ozone" --trace-startup-file=/tmp/code-snap-trace.log --trace-startup-format=json it crashes but no trace file is produced -- maybe it's crashing too soon before it even starts writing that file?

pschoffer commented 3 months ago

code --in-process-gpu worked for me too!

deepak1556 commented 3 months ago

Thanks for clarifying @bjmc, result now makes sense.

Given in-process-gpu works, which basically does gpu stuff in the main process which is not sandboxed, this hints to me like a sandbox issue. Can anyone try code --disable-gpu-sandbox and confirm if the crash persists. Thanks!

paulius-bulotas commented 3 months ago

code --in-process-gpu worked for me too!

Hi, using "code --in-process-gpu" also worked for me!

bjmc commented 3 months ago

@deepak1556 yes, the snap still crashes for me with code --disable-gpu-sandbox

deepak1556 commented 3 months ago

@bjmc can you share the logs from code --disable-chromium-sandbox --verbose and code --in-process-gpu --verbose

Timbuktu1982 commented 3 months ago

@Timbuktu1982 just to confirm, insiders snap based on 1.91.0 works fine with --disable-gpu or even without the flags ?

@DanAlexson90 the issue you are seeing in 1.90.0 was observed first in insiders, the root cause is from runtime update hence I have merged the issues to the first report that was made.

No, without flags it crashes...

bjmc commented 3 months ago

can you share the logs from code --disable-chromium-sandbox --verbose and code --in-process-gpu --verbose

@deepak1556 Sorry for the slow reply and thanks for your work debugging this. Here's the logs...

This one I closed deliberately: in-process-gpu.log

This one crashed: disable-chromium-sandbox.log