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

Segmentation fault on color picker close #13596

Closed
mjswensen opened this Issue Jul 9, 2018 · 15 comments

Comments

Projects
None yet
10 participants
@mjswensen
Copy link

mjswensen commented Jul 9, 2018

  • Electron Version: 1.8.7
  • Operating System (Platform and Version): macOS High Sierra (10.13.5)
  • Last known working Electron version: Unsure

Expected Behavior

Electron application should not crash when a user closes the color picker in macOS.

Actual behavior

Occasionally (not every time) when the end user closes a native color picker (from <input type="color" />), the browser process crashes.

Sometimes the termination signal is a Bus error: 10:

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x00007fff8b4060f0
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Bus error: 10
Termination Reason:    Namespace SIGNAL, Code 0xa
Terminating Process:   exc handler [0]

VM Regions Near 0x7fff8b4060f0:
    unused shlib __DATA    00007fff8b3d4000-00007fff8b404000 [  192K] rw-/rwx SM=COW  system shared lib __DATA not used by this process
--> __DATA                 00007fff8b404000-00007fff8b591000 [ 1588K] rw-/rwx SM=COW  /usr/lib/libobjc.A.dylib
    unused shlib __DATA    00007fff8b591000-00007fff8b59a000 [   36K] rw-/rwx SM=COW  system shared lib __DATA not used by this process

Application Specific Information:
Performing @selector(didChooseColor:) from sender NSColorPanel 0x7f90a462a5d0

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   ???                           	0x00007fff8b4060f0 OBJC_METACLASS_$_NSObject + 0
1   com.github.electron.framework 	0x0000000106c029f4 0x106ab3000 + 1374708
2   com.apple.AppKit              	0x00007fff28ab1a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
3   com.apple.AppKit              	0x00007fff287defab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
4   com.apple.AppKit              	0x00007fff287dee15 -[NSColorPanel _withColorSettingDisabled:] + 37
5   com.apple.AppKit              	0x00007fff287def41 -[NSColorPanel _forceSendAction:notification:firstResponder:] + 88
6   com.apple.AppKit              	0x00007fff287df136 -[NSColorPanel setColor:] + 182
...

Other times it's a Segmentation fault: 11:

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

Application Specific Information:
Performing @selector(didChooseColor:) from sender NSColorPanel 0x7fd8d6f2ce60

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.github.electron.framework 	0x000000010d9cd760 ColorChooserMac::DidChooseColorInColorPanel(unsigned int) + 16
1   com.github.electron.framework 	0x000000010d9cd9f4 0x10d87e000 + 1374708
2   com.apple.AppKit              	0x00007fff28ab1a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
3   com.apple.AppKit              	0x00007fff287defab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
4   com.apple.AppKit              	0x00007fff287dee15 -[NSColorPanel _withColorSettingDisabled:] + 37
5   com.apple.AppKit              	0x00007fff287def41 -[NSColorPanel _forceSendAction:notification:firstResponder:] + 88
6   com.apple.AppKit              	0x00007fff287df136 -[NSColorPanel setColor:] + 182
...

To Reproduce

The easiest way to reproduce is with the packaged application, which can be downloaded from the GitHub releases page.

I have not been able to reproduce the problem in development mode, but here is the information if it's helpful:

$ git clone git@github.com:mjswensen/themer-gui.git
$ npm install
$ npm start
  1. Hover over a label to reveal the droplet icon.
  • screen shot 2018-07-09 at 4 42 29 pm
  1. Click the droplet icon to open the color picker.
  2. Use the eyedropper tool to select a color from elsewhere on the screen.
  • image
  1. Click the red dot to close the color picker.
  • image

This is the point the application crashes. (Try a few times if it doesn't happen the first time.)

Screenshots

crash report

Additional Information

The issue appears to only manifest when the eyedropper is used, specifically when selecting colors from a different application. (I haven't seen a crash when the color picker sliders are used to select a color, for example.)

@welcome

This comment has been minimized.

Copy link

welcome bot commented Jul 9, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@groundwater

This comment has been minimized.

Copy link
Member

groundwater commented Aug 13, 2018

Hey @mjswensen. I worked on this issue with @caramelmagic, and we were unable to reproduce it, but we were using MacOS 10.13.6. Perhaps there was a fix in MacOS?

I'm going to close this, but if you're able to reproduce in the latest MacOS let's re-open and go from there.

@mjswensen

This comment has been minimized.

Copy link
Author

mjswensen commented Aug 14, 2018

@groundwater , thank you so much for your time in looking at this issue!

I think you may be right as I too am unable to reproduce after upgrading to 10.13.6. 🎉 If it crops up again I will report back. Thank you again.

@mjswensen

This comment has been minimized.

Copy link
Author

mjswensen commented Sep 9, 2018

@groundwater, I hate to be the bearer of bad news but I just repro'ed the issue again, this time on electron@2.0.8 (still macOS 10.13.6), which I released as part of themer-gui v0.18.2.

Here is a snippet of the stack from the crash report window. Happy to send along more if it's helpful.

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   ???                           	0x0000000200000003 0 + 8589934595
1   com.github.electron.framework 	0x0000000103344096 ColorChooserMac::DidChooseColorInColorPanel(unsigned int) + 22
2   com.github.electron.framework 	0x0000000103344324 0x1031cf000 + 1528612
3   com.apple.AppKit              	0x00007fff48ab5a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
4   com.apple.AppKit              	0x00007fff487e2fab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
5   com.apple.AppKit              	0x00007fff487e2e15 -[NSColorPanel _withColorSettingDisabled:] + 37
@jpweeks

This comment has been minimized.

Copy link

jpweeks commented Sep 18, 2018

I have had this same issue with Electron 1.7.5 and continuing now through 2.0.8.
Following are my current steps to consistently reproduce the crash:

  1. Open color picker from <input>
  2. RGB Sliders mode must be active by default, if it is not:
    2a. Select RGB Sliders mode.
    2b. Close color picker.
    2c. Close and re-launch app.
    2d. Open color picker from <input>, RGB Sliders mode should be active.
  3. Adjust all 3 sliders.
  4. Close color picker.
  5. Re-open color picker.
  6. Adjust all 3 sliders.
  7. Close color picker, this will crash the app.

Note that this crash can be reproduced using any of the Slider modes.
Another observation: if I ever select a color with the color wheel while using the app, I cannot get this crash to occur with any number of iterations of opening, adjusting, closing the color picker.

Following is a stack trace running on macOS 10.13.6:

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

Application Specific Information:
Performing @selector(didChooseColor:) from sender NSColorPanel 0x7fadc8cbdfc0

Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   com.github.electron.framework 	0x000000010431d08d ColorChooserMac::DidChooseColorInColorPanel(unsigned int) + 13
1   com.github.electron.framework 	0x000000010431d324 0x1041a8000 + 1528612
2   com.apple.AppKit              	0x00007fff50305a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
3   com.apple.AppKit              	0x00007fff50032fab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
4   com.apple.AppKit              	0x00007fff50032e15 -[NSColorPanel _withColorSettingDisabled:] + 37
...
@jpweeks

This comment has been minimized.

Copy link

jpweeks commented Sep 27, 2018

@groundwater Can we reopen this issue? It's still a persistent bug.

@groundwater groundwater reopened this Oct 8, 2018

@KeziahMoselle

This comment has been minimized.

Copy link

KeziahMoselle commented Nov 2, 2018

Experimenting the same issue using Electron 2.0.9
preview.gif

Process:               gelbooru-client [1030]
Path:                  /Users/USER/Documents/*/gelbooru-client.app/Contents/MacOS/gelbooru-client
Identifier:            com.gelbooru-client.app
Version:               0.11.0 (0.11.0)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           gelbooru-client [1030]
User ID:               501

Date/Time:             2018-11-02 23:26:50.056 +0100
OS Version:            Mac OS X 10.13.6 (17G65)
Report Version:        12
Anonymous UUID:        C16428D0-AC93-6152-6DFE-4F85FC4CDC71

Sleep/Wake UUID:       CB892D6E-BFFD-450F-8970-34CF1FF037BA

Time Awake Since Boot: 940 seconds
Time Since Wake:       400 seconds

System Integrity Protection: enabled

Crashed Thread:        0  CrBrowserMain  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00007119c168bec0
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0x7119c168bec0:
    Stack                  00007000142f4000-0000700014af6000 [ 8200K] rw-/rwx SM=COW  thread 36
--> 
    MALLOC_TINY            00007fdb74c00000-00007fdb75000000 [ 4096K] rw-/rwx SM=PRV  

Application Specific Information:
objc_msgSend() selector name: performSelector:withObject:
Performing @selector(didChooseColor:) from sender NSColorPanel 0x7fdb74e17250
Thread 0 Crashed:: CrBrowserMain  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	0x00007fff6f474e9d objc_msgSend + 29
1   com.apple.AppKit              	0x00007fff45ee4a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
2   com.apple.AppKit              	0x00007fff45c11fab __61-[NSColorPanel _forceSendAction:notification:firstResponder:]_block_invoke + 100
3   com.apple.AppKit              	0x00007fff45c11e15 -[NSColorPanel _withColorSettingDisabled:] + 37
4   com.apple.AppKit              	0x00007fff45c11f41 -[NSColorPanel _forceSendAction:notification:firstResponder:] + 88
5   com.apple.AppKit              	0x00007fff45c12136 -[NSColorPanel setColor:] + 182
6   com.apple.AppKit              	0x00007fff45c309c6 -[NSColorPickerWheel setColor:] + 302
7   com.apple.AppKit              	0x00007fff45c322ca -[NSColorPickerWheelView mouseDown:] + 209
8   com.apple.AppKit              	0x00007fff46083d6d -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 5891
9   com.apple.AppKit              	0x00007fff460809c4 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2359
10  com.apple.AppKit              	0x00007fff4607fc70 -[NSWindow(NSEventRouting) sendEvent:] + 497
11  com.apple.AppKit              	0x00007fff45ee1236 -[NSApplication(NSEvent) sendEvent:] + 2462
12  com.github.electron.framework 	0x000000010b34e9ab 0x10b298000 + 747947
13  com.apple.AppKit              	0x00007fff457418b5 -[NSApplication run] + 812
14  com.github.electron.framework 	0x000000010b52adbe 0x10b298000 + 2698686
15  com.github.electron.framework 	0x000000010b5297bc 0x10b298000 + 2693052
16  com.github.electron.framework 	0x000000010b53fb73 0x10b298000 + 2784115
17  com.github.electron.framework 	0x000000010b7abddf 0x10b298000 + 5324255
18  com.github.electron.framework 	0x000000010b7abc00 0x10b298000 + 5323776
19  com.github.electron.framework 	0x000000010b7ae272 0x10b298000 + 5333618
20  com.github.electron.framework 	0x000000010b7a7c5c 0x10b298000 + 5307484
21  com.github.electron.framework 	0x000000010b6f1050 0x10b298000 + 4558928
22  com.github.electron.framework 	0x000000010d302104 0x10b298000 + 33988868
23  com.github.electron.framework 	0x000000010b6efe64 0x10b298000 + 4554340
24  com.github.electron.framework 	0x000000010b299d44 AtomMain + 68
25  com.gelbooru-client.app       	0x000000010b293f26 main + 38
26  libdyld.dylib                 	0x00007fff70099015 start + 1

@sofianguy sofianguy added the 2-0-x label Jan 7, 2019

@swampthang

This comment has been minimized.

Copy link

swampthang commented Jan 8, 2019

Would be nice if there were a way to catch this error and prevent crashing no matter what version. Just knowing what to listen for would be helpful. My experience:

  • Initiate the native Mac color picker by user clicking an input field of type color
  • Close the app - the color picker stays open but the field that initiated the picker is no longer there of course.
  • Reopen the app and try to use the picker.

At that point the app crashes. If there were a way to force the picker to close when the app closes it would be easy but there's no way to do that. Is there a way to catch the error in the main process maybe?

@Mubramaj

This comment has been minimized.

Copy link

Mubramaj commented Feb 5, 2019

I am still experiencing this segmentation fault on Mojave version 10.14.2 using electron v4.0.2. Did anyone find a workaround ?

@MarshallOfSound

This comment has been minimized.

Copy link
Member

MarshallOfSound commented Feb 5, 2019

My understanding of this issue is that it is fixed my this CR --> https://chromium-review.googlesource.com/c/chromium/src/+/685394/

Which means that Electron 3+ (3, 4, 5, etc.) should work fine. Can @mjswensen @KeziahMoselle confirm if those newer versions of Electron fix this

@ericmandel

This comment has been minimized.

Copy link

ericmandel commented Feb 6, 2019

I can verify that Electron v4.0.2 still SEGVs when opening/closing the colorpicker repeatedly:

/Users/eric/bin/js9: line 245:  2239 Segmentation fault: 11  /Users/eric/Applications/Electron.app/Contents/MacOS/Electron ./js9Electron.js -a --webpage /Users/eric/js9/debug2.html

OSX 10.13.6

@brenca brenca self-assigned this Feb 7, 2019

@brenca

This comment has been minimized.

Copy link
Member

brenca commented Feb 7, 2019

I investigated this today, and it looks like this is an upstream issue. I can crash electron and chrome with the following:

  • Open color chooser dialog
  • Adjust one of the RGB sliders to change the color
  • Close the dialog, then open it again
  • Adjust the color again
  • Close the dialog

At this point the app should crash. I managed to cook up a fix for this, going to post a PR with a patch and a PR to chromium to fix this tomorrow.

@brenca

This comment has been minimized.

Copy link
Member

brenca commented Feb 7, 2019

@MarshallOfSound That crash was very similar (I think the root cause might be the same even), but this is a separate bug it looks like.

@KeziahMoselle

This comment has been minimized.

Copy link

KeziahMoselle commented Feb 7, 2019

I upgraded Electron to 4.0.4 and it's still crashing just by clicking on the color picker

@brenca

This comment has been minimized.

Copy link
Member

brenca commented Mar 5, 2019

Sorry for the delay, it took a long time to figure out the upstream fixes needed - and to get them merged. A PR is up now to address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.