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

Perma-hang/crash on M1 MBP with universal build #130222

Closed
digitarald opened this issue Aug 6, 2021 · 11 comments
Closed

Perma-hang/crash on M1 MBP with universal build #130222

digitarald opened this issue Aug 6, 2021 · 11 comments
Assignees
Labels
candidate Issue identified as probable candidate for fixing in the next release confirmed Issue has been confirmed by VS Code Team member freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders verified Verification succeeded

Comments

@digitarald
Copy link
Contributor

digitarald commented Aug 6, 2021

  • VS Code Version: 1.60.0-insider
  • OS Version: macOS 11.2.2 (Build 20D80)

Steps to Reproduce:

  1. Installed fresh VS Code on a M1 MBP and launched it
  2. Interface loads up to Getting Started but without the SVGs on the right visible
  3. … while the macOS beachball shows with a choppy animation
  4. VS Code perma-hangs and needs to be killed.

Maybe related #129076

cc @sbatten who asked me to test after getting reports.

@digitarald digitarald added the freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues label Aug 6, 2021
@kieferrm
Copy link
Member

kieferrm commented Aug 6, 2021

No issues for me on macOS 11.5.1 (20G80). Neither with the universal nor the AMD build. Works find with my existing user data dir and extensions dir or with brand new one.

@xiJulian
Copy link

xiJulian commented Aug 6, 2021

I'm having the same issue after updating to the latest insider build

@deepak1556
Copy link
Collaborator

Based on the spindump you are hitting the same issue as #127421

Can you check if launching with a fresh --user-data-dir helps, basically we want to reduce the sqlite initialization phase to see if its the same issue

@digitarald
Copy link
Contributor Author

@deepak1556 the reported crash was on a laptop that had never had VS Code installed. I am trying to launch from the .app folder now somehow, as I could not launch VS Code to install the shell command.

@deepak1556
Copy link
Collaborator

Thanks for checking, even if it was #127421 the last change would only affect a reload scenario and not a startup, so this issue is definitely a different one.

From the spindump, in the heaviest stack the main process is stuck responding to an ipc message event https://github.com/electron/electron/blob/main/docs/api/web-contents.md#event-ipc-message

Heaviest stack for the main thread of the target process:
  48  start + 4 (libdyld.dylib + 94004) [0x18393df34]
  48  main (in Electron) (electron_main.cc:290) [0x10049952c]
  48  ElectronMain (in Electron Framework) (electron_library_main.mm:0) [0x1008f90b4]
  48  content::ContentMain(content::ContentMainParams const&) (in Electron Framework) (content_main.cc:398) [0x100f6c93c]
  48  content::RunContentProcess(content::ContentMainParams const&, content::ContentMainRunner*) (in Electron Framework) (content_main.cc:372) [0x100f6c4c0]
  48  content::ContentMainRunnerImpl::Run(bool) (in Electron Framework) (content_main_runner_impl.cc:0) [0x100f6d68c]
  48  content::ContentMainRunnerImpl::RunBrowser(content::MainFunctionParams&, bool) (in Electron Framework) (content_main_runner_impl.cc:1081) [0x100f6db44]
  48  content::BrowserMain(content::MainFunctionParams const&) (in Electron Framework) (browser_main.cc:47) [0x10100a778]
  48  content::BrowserMainRunnerImpl::Run() (in Electron Framework) (browser_main_runner_impl.cc:153) [0x10100e1c8]
  48  content::BrowserMainLoop::RunMainMessageLoop() (in Electron Framework) (browser_main_loop.cc:994) [0x10100ccc8]
  48  base::RunLoop::Run(base::Location const&) (in Electron Framework) (run_loop.cc:135) [0x101f5242c]
  48  base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) (in Electron Framework) (thread_controller_with_message_pump_impl.cc:463) [0x101f79de0]
  48  base::MessagePumpCFRunLoopBase::Run(base::MessagePump::Delegate*) (in Electron Framework) (message_pump_mac.mm:160) [0x101fab5ec]
  48  base::MessagePumpNSApplication::DoRun(base::MessagePump::Delegate*) (in Electron Framework) (message_pump_mac.mm:733) [0x101fac9f0]
  48  -[NSApplication run] + 600 (AppKit + 204896) [0x1861e5060]
  48  -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1312 (AppKit + 262572) [0x1861f31ac]
  48  _DPSNextEvent + 868 (AppKit + 268332) [0x1861f482c]
  48  _BlockUntilNextEventMatchingListInModeWithFilter + 76 (HIToolbox + 200996) [0x18b53f124]
  48  ReceiveNextEventCommon + 688 (HIToolbox + 201716) [0x18b53f3f4]
  48  RunCurrentEventLoopInMode + 292 (HIToolbox + 202180) [0x18b53f5c4]
  48  CFRunLoopRunSpecific + 600 (CoreFoundation + 530240) [0x183a1a740]
  48  __CFRunLoopRun + 824 (CoreFoundation + 532964) [0x183a1b1e4]
  48  __CFRunLoopDoSources0 + 268 (CoreFoundation + 538700) [0x183a1c84c]
  48  __CFRunLoopDoSource0 + 208 (CoreFoundation + 539488) [0x183a1cb60]
  48  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CoreFoundation + 539668) [0x183a1cc14]
  48  base::MessagePumpCFRunLoopBase::RunWorkSource(void*) (in Electron Framework) (message_pump_mac.mm:363) [0x101fabafc]
  48  base::mac::CallWithEHFrame(void () block_pointer) (in Electron Framework) + 16 [0x101fa8c70]
  48  ___ZN4base24MessagePumpCFRunLoopBase13RunWorkSourceEPv_block_invoke (in Electron Framework) (message_pump_mac.mm:361) [0x101fac260]
  48  non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() (in Electron Framework) (thread_controller_with_message_pump_impl.cc:0) [0x101f78ca8]
  48  base::TaskAnnotator::RunTask(char const*, base::PendingTask*) (in Electron Framework) (task_annotator.cc:173) [0x101f63efc]
  48  mojo::SimpleWatcher::OnHandleReady(int, unsigned int, mojo::HandleSignalsState const&) (in Electron Framework) (simple_watcher.cc:279) [0x10211ab58]
  48  mojo::Connector::OnWatcherHandleReady(unsigned int) (in Electron Framework) (connector.cc:376) [0x1020fec98]
  48  mojo::MessageDispatcher::Accept(mojo::Message*) (in Electron Framework) (message_dispatcher.cc:43) [0x102104188]
  48  mojo::internal::MultiplexRouter::Accept(mojo::Message*) (in Electron Framework) (multiplex_router.cc:626) [0x10210aa90]
  48  mojo::internal::MultiplexRouter::ProcessIncomingMessage(mojo::internal::MultiplexRouter::MessageWrapper*, mojo::internal::MultiplexRouter::ClientCallBehavior, base::SequencedTaskRunner*) (in Electron Framework) (multiplex_router.cc:0) [0x10210b044]
  48  mojo::MessageDispatcher::Accept(mojo::Message*) (in Electron Framework) (message_dispatcher.cc:43) [0x102104188]
  48  mojo::InterfaceEndpointClient::HandleIncomingMessageThunk::Accept(mojo::Message*) (in Electron Framework) (interface_endpoint_client.cc:140) [0x102101dbc]
  48  electron::mojom::ElectronBrowserStubDispatch::Accept(electron::mojom::ElectronBrowser*, mojo::Message*) (in Electron Framework) (api.mojom.cc:2165) [0x101e238c0]
  48  electron::ElectronBrowserHandlerImpl::Message(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, blink::CloneableMessage) (in Electron Framework) (electron_browser_handler_impl.cc:46) [0x1009af9dc]
  48  electron::api::WebContents::Message(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, blink::CloneableMessage, content::RenderFrameHost*) (in Electron Framework) (electron_api_web_contents.cc:1562) [0x100976b4c]
  48  bool electron::api::WebContents::EmitWithSender<bool&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, blink::CloneableMessage>(base::BasicStringPiece<char>, content::RenderFrameHost*, base::OnceCallback<void (blink::CloneableMessage)>, bool&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, blink::CloneableMessage&&) (in Electron Framework) (electron_api_web_contents.h:372) [0x100976db4]
  48  v8::Local<v8::Value> gin_helper::EmitEvent<base::BasicStringPiece<char>, v8::Local<v8::Object>&, bool&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, blink::CloneableMessage>(v8::Isolate*, v8::Local<v8::Object>, base::BasicStringPiece<char> const&, v8::Local<v8::Object>&, bool&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, blink::CloneableMessage&&) (in Electron Framework) (event_emitter_caller.h:51) [0x100985c00]
  48  gin_helper::internal::CallMethodWithArgs(v8::Isolate*, v8::Local<v8::Object>, char const*, std::__1::vector<v8::Local<v8::Value>, std::__1::allocator<v8::Local<v8::Value> > >*) (in Electron Framework) (event_emitter_caller.cc:30) [0x100a1dce0]
  48  node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*, node::async_context) (in Electron Framework) (callback.cc:0) [0x1038e27e8]
  48  node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) (in Electron Framework) (callback.cc:260) [0x1038e28d0]
  48  node::InternalMakeCallback(node::Environment*, v8::Local<v8::Object>, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) (in Electron Framework) (callback.cc:200) [0x1038e261c]
  48  node::InternalCallbackScope::Close() (in Electron Framework) (callback.cc:116) [0x1038e22d8]
  48  v8::internal::MicrotaskQueue::PerformCheckpoint(v8::Isolate*) (in Electron Framework) (microtask-queue.cc:117) [0x1014dbf28]
  48  v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*, v8::internal::MaybeHandle<v8::internal::Object>*) (in Electron Framework) (execution.cc:509) [0x1014c309c]
  48  v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) (in Electron Framework) (execution.cc:432) [0x1014c2fd4]
  48  v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) (in Electron Framework) (execution.cc:387) [0x1014c2834]
  48  ??? [0x78000482a4]
  48  ??? [0x780006b7e8]
  28  ??? [0x78000fdd98]
  11  ??? [0x78000fdd98]
  3   ??? [0x78001d6ae0]

@deepak1556
Copy link
Collaborator

The last few frames are in the JS land, its hard to say which ipc channel caused the problem. Lets try a couple of things to narrow down the problem,

  1. Lets get the verbose log when the hang happens, launch with
/Applications/Visual\ Studio\ Code\ -\ Insiders.app/Contents/Resources/app/bin/code --verbose
  1. Try bypassing the welcome page, this will help exclude webview related ipc. Try starting the application like
open -a /Applications/Visual\ Studio\ Code\ -\ Insiders.app --args <some-absolute-path-to-a-file>

NB: we do have a --skip-welcome flag but it doesn't seem to work, so lets just resort to opening a file.

  1. Inspect ipc message via chrome trace, after the hang happens quit the application and attach the trace file from /tmp
open -a /Applications/Visual\ Studio\ Code\ -\ Insiders.app --args --enable-tracing="navigation,net,loading,ipc,mojom,disabled-by-default-mojom" --trace-startup-file="/tmp/chrometrace.log"
  1. Worst case scenario, can you confirm which insiders worked last ? We can bisect for any ipc related code changes.

@deepak1556 deepak1556 added the info-needed Issue requires more information from poster label Aug 6, 2021
@miguelsolorio
Copy link
Contributor

miguelsolorio commented Aug 6, 2021

I'm on macOS 11.4 (20F71) m1 and am encountering the same bug. Running with a clean/empty user data directory does not help.

  1. verbose-logs.txt

  2. this didn't make a difference

  3. couldn't locate the tmp files but have the mac crash reporter mac-crash-reporter.txt

  4. i believe I had the last 1.59 update before we released

FWIW, this is what it looks like before it starts crashing:

image

@miguelsolorio
Copy link
Contributor

Interestingly enough, I downloaded the x64 and arm64 (1.60) and those load totally fine for me (though they are a bit sluggish). But it's the universal version that crashes for me every time.

@deepak1556
Copy link
Collaborator

Thanks @misolori for the logs, the problem is made obvious. Native modules in the build are not universal, definitely broken by 934d280

@deepak1556 deepak1556 added confirmed Issue has been confirmed by VS Code Team member important Issue identified as high-priority and removed info-needed Issue requires more information from poster labels Aug 6, 2021
@deepak1556 deepak1556 changed the title Perma-hang/crash on M1 MBP Perma-hang/crash on M1 MBP with universal build Aug 6, 2021
@deepak1556
Copy link
Collaborator

New insiders with the fix has been released, users with broken installations please reinstall from https://code.visualstudio.com/insiders

@deepak1556 deepak1556 added the candidate Issue identified as probable candidate for fixing in the next release label Aug 16, 2021
@deepak1556 deepak1556 added this to the July 2021 Recovery milestone Aug 16, 2021
@miguelsolorio miguelsolorio added the verified Verification succeeded label Aug 16, 2021
@miguelsolorio
Copy link
Contributor

Verified that this no longer hangs on a M1 universal build:

Version: 1.59.1 (Universal)
Commit: ec226a7
Date: 2021-08-16T20:03:37.292Z
Electron: 13.1.7
Chrome: 91.0.4472.124
Node.js: 14.16.0
V8: 9.1.269.36-electron.0
OS: Darwin arm64 20.6.0

@github-actions github-actions bot locked and limited conversation to collaborators Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
candidate Issue identified as probable candidate for fixing in the next release confirmed Issue has been confirmed by VS Code Team member freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues important Issue identified as high-priority insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants
@digitarald @deepak1556 @kieferrm @xiJulian @miguelsolorio and others