Pressing 'e' in eeschema causes crash frequently [OSX-specific]

Bug #1837225 reported by ocb-hd-ccb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Committed
High
Jeff Young

Bug Description

I though this was originally related to https://bugs.launchpad.net/kicad/+bug/1836673 but since learning how to check the crash logs it appears to be different.

I am pressing 'e' over field references in eeschema and sometimes it works and sometimes it crashes. But, once it crashes it crashes for a while. I have to do an unknown procedure to get it to work again.

#Kicad Info
```
Application: KiCad
Version: (5.1.0-1318-gb5cc49614), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
```

#Crash Report
```
Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [16850]

Application Specific Information:
Crashing on exception: -[NSAlert runModal] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.AppKit 0x00007fff47071a67 -[NSApplication _crashOnException:] + 109
1 com.apple.AppKit 0x00007fff46d6ec84 __65+[CATransaction(NSCATransaction) NS_setFlushesWithDisplayRefresh]_block_invoke + 841
2 com.apple.CoreFoundation 0x00007fff49645928 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
3 com.apple.CoreFoundation 0x00007fff4964585d __CFRunLoopDoObservers + 451
4 com.apple.CoreFoundation 0x00007fff495e7f80 __CFRunLoopRun + 1136
5 com.apple.CoreFoundation 0x00007fff495e78be CFRunLoopRunSpecific + 455
6 com.apple.HIToolbox 0x00007fff488d396b RunCurrentEventLoopInMode + 292
7 com.apple.HIToolbox 0x00007fff488d35ad ReceiveNextEventCommon + 355
8 com.apple.HIToolbox 0x00007fff488d3436 _BlockUntilNextEventMatchingListInModeWithFilter + 64
9 com.apple.AppKit 0x00007fff46c6d987 _DPSNextEvent + 965
10 com.apple.AppKit 0x00007fff46c6c71f -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1361
11 libwx_osx_cocoau-3.0.0.4.0.dylib 0x000000010ac5167c wxGUIEventLoop::OSXDoRun() + 220
12 libwx_osx_cocoau-3.0.0.4.0.dylib 0x000000010ab4c0e1 wxCFEventLoop::DoRun() + 49
13 libwx_osx_cocoau-3.0.0.4.0.dylib 0x000000010aa99b42 wxEventLoopBase::Run() + 162
14 _eeschema.kiface 0x000000011432ce11 DIALOG_SHIM::ShowQuasiModal() + 673
15 _eeschema.kiface 0x00000001141467b4 SCH_EDIT_TOOL::editComponentFieldText(SCH_FIELD*) + 420
16 _eeschema.kiface 0x000000011414772f SCH_EDIT_TOOL::Properties(TOOL_EVENT const&) + 1263
17 _eeschema.kiface 0x0000000114156cd5 int std::__1::__invoke_void_return_wrapper<int>::__call<std::__1::__bind<int (SCH_EDIT_TOOL::*&)(TOOL_EVENT const&), SCH_EDIT_TOOL*, std::__1::placeholders::__ph<1> const&>&, TOOL_EVENT const&>(std::__1::__bind<int (SCH_EDIT_TOOL::*&)(TOOL_EVENT const&), SCH_EDIT_TOOL*, std::__1::placeholders::__ph<1> const&>&&&, TOOL_EVENT const&&&) + 645
18 _eeschema.kiface 0x0000000114156999 std::__1::__function::__func<std::__1::__bind<int (SCH_EDIT_TOOL::*&)(TOOL_EVENT const&), SCH_EDIT_TOOL*, std::__1::placeholders::__ph<1> const&>, std::__1::allocator<std::__1::__bind<int (SCH_EDIT_TOOL::*&)(TOOL_EVENT const&), SCH_EDIT_TOOL*, std::__1::placeholders::__ph<1> const&> >, int (TOOL_EVENT const&)>::operator()(TOOL_EVENT const&) + 57
19 _eeschema.kiface 0x00000001144c803e std::__1::function<int (TOOL_EVENT const&)>::operator()(TOOL_EVENT const&) const + 142
20 _eeschema.kiface 0x00000001144c7f8d COROUTINE<int, TOOL_EVENT const&>::callerStub(long) + 109
21 _eeschema.kiface 0x000000011440cd2a make_fcontext + 42
22 ??? 0x00007ffee56bdd90 0 + 140732747472272

Thread 1:
0 libsystem_pthread.dylib 0x00007fff757093f0 start_wqthread + 0

Thread 2:
0 libsystem_pthread.dylib 0x00007fff757093f0 start_wqthread + 0

Thread 3:
0 libsystem_pthread.dylib 0x00007fff757093f0 start_wqthread + 0

Thread 4:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x00007fff7565261a __select + 10
1 com.apple.CoreFoundation 0x00007fff49616572 __CFSocketManager + 635
2 libsystem_pthread.dylib 0x00007fff7570a2eb _pthread_body + 126
3 libsystem_pthread.dylib 0x00007fff7570d249 _pthread_start + 66
4 libsystem_pthread.dylib 0x00007fff7570940d thread_start + 13

Thread 5:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x00007fff7564b22a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff7564b76c mach_msg + 60
2 com.apple.CoreFoundation 0x00007fff495e8bee __CFRunLoopServiceMachPort + 328
3 com.apple.CoreFoundation 0x00007fff495e815c __CFRunLoopRun + 1612
4 com.apple.CoreFoundation 0x00007fff495e78be CFRunLoopRunSpecific + 455
5 com.apple.AppKit 0x00007fff46c756a6 _NSEventThread + 175
6 libsystem_pthread.dylib 0x00007fff7570a2eb _pthread_body + 126
7 libsystem_pthread.dylib 0x00007fff7570d249 _pthread_start + 66
8 libsystem_pthread.dylib 0x00007fff7570940d thread_start + 13

Thread 6:
0 libsystem_pthread.dylib 0x00007fff757093f0 start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00006000028bc230 rbx: 0x000060000329a220 rcx: 0x00007fa6edc471f0 rdx: 0x00007fff73d5ef18
  rdi: 0x00007fa6edc47000 rsi: 0x00007fff477f0bed rbp: 0x0000000111a607b0 rsp: 0x0000000111a607a0
   r8: 0x0000000111a60340 r9: 0x0000000000000000 r10: 0x00007fffa4980390 r11: 0x00007fa6defb7190
  r12: 0x0000600000cfd860 r13: 0x00007fa6ed7612c0 r14: 0x00007fff73d3a680 r15: 0x00007fff49652f83
  rip: 0x00007fff47071a67 rfl: 0x0000000000010206 cr2: 0x000000010b31b3cc

Logical CPU: 3
Error Code: 0x00000000
Trap Number: 6
```

Tags: eeschema macos
Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

I don't actually think this will be helpful but here is what happens. I had the MCU selected, I deselected it and hit 'e' between the 'field ref' and 'field val' and I picked 'field ref' then crash...

https://imgur.com/a/zF4wehd

tags: added: macos
Revision history for this message
Jeff Young (jeyjey) wrote :

I've made this happen a couple of times, but now can't make it happen again.

@Seth, the "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)" rings a bell. Didn't we have another one of those? Any memory of what it turned out to be?

Changed in kicad:
status: New → Confirmed
importance: Undecided → High
milestone: none → 6.0.0-rc1
Revision history for this message
Jeff Young (jeyjey) wrote :

I just got it to happen with only the Kicad Manager and Eeschema running (so it doesn't appear to be related to cross-probing), and without any Clarify Selection menus having appeared (so it doesn't appear to be related to them either).

Some comments online suggest that this is Apple's bug (possibly High Sierra-specific), but we'll still need to figure out a way to work around it.

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

I guess it could be High Sierra and beyond but I am running Mojave...

Revision history for this message
Jeff Young (jeyjey) wrote :

I've put a hack in which *might* work around this. I say "might" because this bug seems to go in and out of reproducibility, so the fact that I can't make it happen with this hack doesn't actually mean it's fixed.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 4d4adf07538f87536cf3196cd65b859efc05b079
https://git.launchpad.net/kicad/patch/?id=4d4adf07538f87536cf3196cd65b859efc05b079

Changed in kicad:
status: Confirmed → Fix Committed
assignee: nobody → Jeff Young (jeyjey)
Revision history for this message
Jeff Young (jeyjey) wrote :

@ocb-hd-ccb, can you try this out when you get a chance and see if it helps any?

Revision history for this message
Jeff Young (jeyjey) wrote :

(After the next nightly is built, that is....)

Changed in kicad:
status: Fix Committed → In Progress
Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

@Jeff

Yea! I will give it a whirl on Monday. Hopefully the nightly is updated by then.

👍

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

Issue still happens on 20190721 ... Don't know if this version would have had the fix or not...

```
Application: KiCad
Version: (5.1.0-1341-g0d8ab12ad), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
```

Revision history for this message
Jeff Young (jeyjey) wrote :

@Adam, can you tell me whether or not the above build has 4d4adf07538f87536cf3196cd65b859efc05b079 in it or not? Thanks!

Revision history for this message
Jeff Young (jeyjey) wrote :

Other evidence suggests (https://bugs.launchpad.net/kicad/+bug/1836267) the builds are not up-to-date so I'm going to go ahead and mark this fixed for now.

Changed in kicad:
status: In Progress → Fix Committed
Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

The 'e' issue is still present in todays nightly 20190722

```
Application: KiCad
Version: (5.1.0-1347-ga18fcdd6f), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.6.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
```

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

@Jeff

Bug is still in 20190725 10-14 nightly

```
Application: KiCad
Version: (5.1.0-1361-g807bd7889), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.7.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
```

Changed in kicad:
status: Fix Committed → In Progress
Jeff Young (jeyjey)
summary: - Pressing 'e' in eeschema causes crash frequently
+ Pressing 'e' in eeschema causes crash frequently [OSX-specific]
Revision history for this message
Jeff Young (jeyjey) wrote :

@Seth, any ideas on comment #2?

Revision history for this message
Seth Hillbrand (sethh) wrote :

@Jeff- That was the footprint wizard activation issue.

f214cfae12ea6745c92e647f572a43e89be92405 in the v5 branch.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 21b90de829df1d205a760102746991bb227aac59
https://git.launchpad.net/kicad/patch/?id=21b90de829df1d205a760102746991bb227aac59

Changed in kicad:
status: In Progress → Fix Committed
Revision history for this message
Jeff Young (jeyjey) wrote :

@ocb-hd-ccb, I've merged another attempt to fix it. Let me know how you get on with it.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Seth, thanks. I've tried something similar only waiting for Idle events to be seen before continuing. But this one seems a little more resilient to fixes. (Perhaps we're breeding resistant strains of bugs....)

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

@Jeff cool. I will let you know.

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

@Jeff still an issue in 20190727

```
Application: KiCad
Version: (5.1.0-1376-geaeb96ea5), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Platform: Mac OS X (Darwin 18.7.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
    Boost: 1.69.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

Build settings:
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_PYTHON3=OFF
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON
```

Revision history for this message
Jeff Young (jeyjey) wrote :

I also tried moving editComponentFieldText() back to SCH_EDIT_FRAME (in case it was something about the coroutine stuff that was triggering it). That didn't work either.

And I tried firing a second ACTION from the first so that we go back around the event loop. Again, no joy.

At this point I'm out of ideas.

Changed in kicad:
assignee: Jeff Young (jeyjey) → nobody
status: Fix Committed → Triaged
Revision history for this message
Jeff Young (jeyjey) wrote :

@Seth, if you want to give this a crack that would be great.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Oh boy. :) Well, at least it's not a Windows bug.

@ocb-hd-ccb: Could you attach a few more of your crash logs? I'd like to verify we're always seeing the same behavior.

Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
status: Triaged → In Progress
Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

@Seth I have been checking the crash logs each time and the reason I haven’t posted them was because it was always the NSAlert -drawRect thing. Same as the first log I posted.

When I get back to the office Monday night/ Tuesday I can upload another.

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

I don't know how much of the crash log you need but it appears to all be the same

This is from the last crash
```
Application Specific Information:
Crashing on exception: -[NSAlert runModal] may not be invoked inside of transaction begin/commit pair, or inside of transaction commit (usually this means it was invoked inside of a view's -drawRect: method.)
```

Revision history for this message
Jeff Young (jeyjey) wrote :

Ditto for me. When I /can/ reproduce it, it's always the same crash.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Seth, this was really bothering me so I took another look from the perspective of "what's different about this dialog"?

Anyway, I think I've fixed it.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision c03535343c67c17ddf0ac18621743d9cf762eb05
https://git.launchpad.net/kicad/patch/?id=c03535343c67c17ddf0ac18621743d9cf762eb05

Changed in kicad:
status: In Progress → Fix Committed
assignee: Seth Hillbrand (sethh) → Jeff Young (jeyjey)
Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

Yippee! I will pull and test the next nightly I see.

Revision history for this message
ocb-hd-ccb (ocb-hd-ccb) wrote :

It did not crash!

Thanks!

I need to find better screen recording software that shows what keys are being hit as well as records system sounds. There is some slightly odd behavior but I cannot easily describe it. When I find a better than macOS default screen recording I will open a new issue.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Nicely done Jeff!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.