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

The main process freezes after enable main process anr #830

Closed
3 tasks done
PayneFuRC opened this issue Feb 20, 2024 · 4 comments · Fixed by #858
Closed
3 tasks done

The main process freezes after enable main process anr #830

PayneFuRC opened this issue Feb 20, 2024 · 4 comments · Fixed by #858

Comments

@PayneFuRC
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Electron SDK Version

4.17.0

Electron Version

27.2.0

What platform are you using?

MacOS

Link to Sentry event

No response

Steps to Reproduce

  1. enable main process anr in sentry
  2. computer sleep
  3. wake up after about 10 minutes
  4. main process freezes and is not responded.
image (3)

It doesn't happen every time, but it occurs more frequently under low battery conditions.

The hangs stack is in v8:debugger and inspector.

Date/Time:        2024-02-19 22:30:45.010 +0800
End time:         2024-02-19 22:32:58.972 +0800
OS Version:       macOS 14.1.2 (Build 23B92)
Architecture:     x86_64h
Report Version:   44
Incident Identifier: FBB0FDDE-2A1F-4FD1-B6D6-F42A60BBEE57

Data Source:      Stackshots
Shared Cache:     C4E0C302-D68B-3B56-9F5A-6C3FBE5367CB slid base address 0x7ff81112b000, slide 0x1112b000 (System Primary)
Shared Cache:     6AAC45E6-EC03-3AD0-AC14-0EF2CF511C5B slid base address 0x7ff82888e000, slide 0x2888e000 (DriverKit)

Command:          RingCentral
Path:             /Applications/RingCentral.app/Contents/MacOS/RingCentral
Identifier:       com.ringcentral.glip
Version:          24.1.21.undefined (24.1.21.undefined)
Team ID:          M932RC5J66
Is First Party:   No
Architecture:     x86_64
Parent:           launchd [1]
PID:              55302
Time Since Fork:  12550s

Event:            hang
Duration:         133.96s
Duration Sampled: 4.30s (process was unresponsive for 130 seconds before sampling)
Steps:            43 (100ms sampling interval)

Hardware model:   MacBookPro16,1
Active cpus:      16
HW page size:     4096
VM page size:     4096

Time Since Boot:  29675s
Time Awake Since Boot: 10947s
Time Since Wake:  2s

Fan speed:        1856 rpm
Total CPU Time:   7.965s (20.6G cycles, 18.1G instructions, 1.14c/i)
Advisory levels:  Battery -> 2, User -> 2, ThermalPressure -> 1, Combined -> 2
Free disk space:  355.17 GB/931.55 GB, low space threshold 3072 MB
Low Power Mode:   Enabled
Vnodes Available: 79.36% (208839/263168)

Launchd throttled processes:
  gui/501/com.paloaltonetworks.gp.pangps throttled after exit(): throttled samples 1-43
  system/com.paloaltonetworks.gp.pangpsd throttled after exit(): throttled samples 1-43

Preferred User Language: en-CN, zh-Hans-CN
Country Code:     CN
Keyboards:        ABC
OS Cryptex File Extents: 6

--------------------------------------------------
Timeline format: stacks are sorted chronologically
Use -i and -heavy to re-report with count sorting
--------------------------------------------------


Heaviest stack for the main thread of the target process:
  43  start + 1942 (dyld + 25510) [0x7ff8111db3a6]
  43  ElectronMain + 155 (Electron Framework + 4105179) [0x114c703db]
  43  v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) + 15719 (Electron Framework + 7680407) [0x114fd9197]
  43  v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) + 15452 (Electron Framework + 7680140) [0x114fd908c]
  43  v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) + 20813 (Electron Framework + 7685501) [0x114fda57d]
  43  v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) + 21319 (Electron Framework + 7686007) [0x114fda777]
  43  v8::internal::compiler::BasicBlock::set_loop_header(v8::internal::compiler::BasicBlock*) + 17266 (Electron Framework + 7681954) [0x114fd97a2]
  43  v8::internal::SetupIsolateDelegate::SetupBuiltins(v8::internal::Isolate*, bool) + 4242383 (Electron Framework + 46203295) [0x11749619f]
  43  v8::internal::SetupIsolateDelegate::SetupBuiltins(v8::internal::Isolate*, bool) + 4259474 (Electron Framework + 46220386) [0x11749a462]
  43  v8::internal::SetupIsolateDelegate::SetupBuiltins(v8::internal::Isolate*, bool) + 4252720 (Electron Framework + 46213632) [0x117498a00]
  43  node::AsyncResource::get_async_id() const + 9882143 (Electron Framework + 63505807) [0x11851658f]
  43  node::AsyncResource::get_async_id() const + 10133901 (Electron Framework + 63757565) [0x118553cfd]
  43  node::AsyncResource::get_async_id() const + 10417560 (Electron Framework + 64041224) [0x118599108]
  43  node::AsyncResource::get_async_id() const + 10426470 (Electron Framework + 64050134) [0x11859b3d6]
  43  -[NSApplication run] + 603 (AppKit + 196090) [0x7ff814c3edfa]
  43  -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1304 (AppKit + 9642824) [0x7ff815541348]
  43  _DPSNextEvent + 880 (AppKit + 256133) [0x7ff814c4d885]
  43  _BlockUntilNextEventMatchingListInModeWithFilter + 66 (HIToolbox + 197937) [0x7ff81bedf531]
  43  ReceiveNextEventCommon + 665 (HIToolbox + 198630) [0x7ff81bedf7e6]
  43  RunCurrentEventLoopInMode + 292 (HIToolbox + 199129) [0x7ff81bedf9d9]
  43  CFRunLoopRunSpecific + 557 (CoreFoundation + 500562) [0x7ff81163d352]
  43  __CFRunLoopRun + 919 (CoreFoundation + 502961) [0x7ff81163dcb1]
  43  __CFRunLoopDoSources0 + 215 (CoreFoundation + 507956) [0x7ff81163f034]
  43  __CFRunLoopDoSource0 + 157 (CoreFoundation + 508521) [0x7ff81163f269]
  43  __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 (CoreFoundation + 508615) [0x7ff81163f2c7]
  43  node::AsyncResource::get_async_id() const + 10419057 (Electron Framework + 64042721) [0x1185996e1]
  43  ??? (Electron Framework + 2002634) [0x114a6eeca]
  43  node::AsyncResource::get_async_id() const + 10423141 (Electron Framework + 64046805) [0x11859a6d5]
  43  node::AsyncResource::get_async_id() const + 10130659 (Electron Framework + 63754323) [0x118553053]
  43  node::AsyncResource::get_async_id() const + 10009145 (Electron Framework + 63632809) [0x1185355a9]
  43  v8_inspector::V8DebuggerId::V8DebuggerId(std::__Cr::pair<long long, long long>) + 22333 (Electron Framework + 5843021) [0x114e1884d]
  43  uv_run + 369 (Electron Framework + 4029393) [0x114c5dbd1]
  43  uv_timer_get_due_in + 141 (Electron Framework + 4014349) [0x114c5a10d]
  43  node::EmitAsyncDestroy(node::Environment*, node::async_context) + 356079 (Electron Framework + 126754255) [0x11c167dcf]
  43  v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) + 591 (Electron Framework + 25317791) [0x1160ab19f]
  43  v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*) + 506 (Electron Framework + 26500970) [0x1161cbf6a]
  43  ??? (Electron Framework + 202695) [0x1148b77c7]
  43  ??? (Electron Framework + 203420) [0x1148b7a9c]
  43  ??? [0x174a7863c]
  43  ??? [0x174a7aa7a]
  43  ??? (Electron Framework + 212708) [0x1148b9ee4]
  43  ??? [0x1748f63b5]
  43  ??? (Electron Framework + 200252) [0x1148b6e3c]
  43  ??? (Electron Framework + 1294538) [0x1149c20ca]
  43  ??? [0x1748f6137]
  43  ??? (Electron Framework + 479773) [0x1148fb21d]
  43  ??? (Electron Framework + 844278) [0x1149541f6]
  43  v8::internal::Runtime::GetInternalProperties(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>) + 21620 (Electron Framework + 32187892) [0x1167385f4]
  43  v8::internal::StackGuard::HandleInterrupts(v8::internal::StackGuard::InterruptLevel) + 1094 (Electron Framework + 26737766) [0x116205c66]
  43  v8::internal::Isolate::InvokeApiInterruptCallbacks() + 216 (Electron Framework + 26600040) [0x1161e4268]
  43  v8::debug::BreakRightNow(v8::Isolate*, v8::base::EnumSet<v8::debug::BreakReason, int>) + 43 (Electron Framework + 26250747) [0x11618edfb]
  43  v8::internal::Debug::HandleDebugBreak(v8::internal::IgnoreBreakMode, v8::base::EnumSet<v8::debug::BreakReason, int>) + 280 (Electron Framework + 26324616) [0x1161a0e88]
  43  v8::internal::Debug::OnDebugBreak(v8::internal::Handle<v8::internal::FixedArray>, v8::internal::StepAction, v8::base::EnumSet<v8::debug::BreakReason, int>) + 286 (Electron Framework + 26302846) [0x11619b97e]
  43  v8_inspector::V8DebuggerId::pair() const + 14063 (Electron Framework + 35967023) [0x116ad302f]
  43  v8_inspector::V8DebuggerId::pair() const + 13184 (Electron Framework + 35966144) [0x116ad2cc0]
  43  node::SetTracingController(v8::TracingController*) + 113890 (Electron Framework + 128454402) [0x11c306f02]
  43  node::AsyncResource::get_async_id() const + 3057539 (Electron Framework + 56681203) [0x117e942f3]
  43  uv_cond_wait + 9 (Electron Framework + 4080489) [0x114c6a369]
  43  <patched truncated backtrace>
  43  __psynch_cvwait + 10 (libsystem_kernel.dylib + 17934) [0x7ff81152760e]
 *43  psynch_cvcontinue + 0 (com.apple.kec.pthread + 20777) [0xffffff8003049129]

Sentry ANR is implemented using a debugger(https://github.com/getsentry/sentry-javascript/blob/develop/packages/node/src/integrations/anr/worker.ts), and it should match up with the above stack info. Disabling Sentry ANR prevents the issue from being reproduced.

Expected Result

main process should not freeze after wakeup

Actual Result

main process freezes after wakeup

@timfish
Copy link
Collaborator

timfish commented Feb 20, 2024

Thanks for the detailed report. I guess we might need to disable ANR between suspend and resume events from the powerMonitor module.

@PayneFuRC
Copy link
Author

PayneFuRC commented Feb 21, 2024

@timfish Do we have a disable ANR api or this API will be added in the future?

@timfish
Copy link
Collaborator

timfish commented Feb 21, 2024

I haven't seen this happen myself but I will be investigating it and spending time trying to fix it. if you're seeing hanging issues caused by this I would avoid using the ANR feature until this issue is marked as closed.

This kind of issue is particularly painful from my point of view because it sounds like it's not 100% reproducible so very tricky to add to our integration tests to ensure it doesn't occur or regress again later!

@PayneFuRC
Copy link
Author

Yes, it's not 100% reproducible. We currently haven't found a stable path to reproduce the issue. We have many colleagues testing together, so the probability of reproduction is somewhat higher.

AbhiPrasad pushed a commit to getsentry/sentry-javascript that referenced this issue Mar 21, 2024
With the Electron SDK, we have an issue
(getsentry/sentry-electron#830) where ANR
causes the app to freeze when the machine goes through a suspend/resume
cycle.

This PR exposes `stopWorker` and `startWorker` methods which can be used
in the downstream [ANR integration
wrapper](https://github.com/getsentry/sentry-electron/blob/master/src/main/integrations/anr.ts)
to stop the ANR feature before device suspend and start it again on
device resume.
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this issue Apr 19, 2024
…1214)

With the Electron SDK, we have an issue
(getsentry/sentry-electron#830) where ANR
causes the app to freeze when the machine goes through a suspend/resume
cycle.

This PR exposes `stopWorker` and `startWorker` methods which can be used
in the downstream [ANR integration
wrapper](https://github.com/getsentry/sentry-electron/blob/master/src/main/integrations/anr.ts)
to stop the ANR feature before device suspend and start it again on
device resume.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants