Skip to content

Pcbnew: segfault when it saves project file

Description

After working in Pcbnew for a few minutes it seems to save something in the background to the project file. While doing so the saving thread runs into a segfault. This seems to happen pretty consistently for me after 5-10 mins. Below is a backtrace of the offending thread from Apple's crash reporter. If desired I can probably run under lldb and see if I can get some more details.

Steps to reproduce

  1. Start Pcbnew without a board file in the project
  2. Agree when asked to create a new board file
  3. Import a netlist, start working
  4. After some amount of time the save happens and the process segfaults

KiCad Version

Application: KiCad

Version: (5.99.0-8084-g73c1410161), release build

Libraries:
	wxWidgets 3.0.4
	libcurl/7.64.1 SecureTransport (LibreSSL/2.8.3) zlib/1.2.11 nghttp2/1.39.2

Platform: macOS Catalina Version 10.15.7 (Build 19H114), 64 bit, Little endian, wxMac

Build Info:
	Date: Jan  2 2021 17:29:30
	wxWidgets: 3.0.4 (wchar_t,STL containers,compatible with 2.8)
	Boost: 1.75.0
	OCC: 7.5.0
	Curl: 7.54.0
	ngspice: 31
	Compiler: Clang 10.0.1 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
	KICAD_USE_OCC=ON
	KICAD_SPICE=ON
Process:               kicad [93959]
Path:                  /private/var/folders/*/kicad.app/Contents/MacOS/kicad
Identifier:            org.kicad-pcb.kicad
Version:               [5.99.0-8084-g73c1410161] ([5.99.0-8084-g73c1410161])
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           kicad [93959]
User ID:               501

Date/Time:             2021-01-03 22:18:59.803 -0800
OS Version:            Mac OS X 10.15.7 (19H114)
Report Version:        12
Bridge OS Version:     5.1 (18P3030)
Anonymous UUID:        1552B461-06A4-EE09-471D-CF7C01C898CC

Sleep/Wake UUID:       59F3048A-8101-4CD4-BD53-8EC91C69DCE1

Time Awake Since Boot: 380000 seconds
Time Since Wake:       2000 seconds

System Integrity Protection: enabled

Notes:                 Translocated Process

Crashed Thread:        0  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 [93959]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.kicad-pcb.kicad           	0x000000010566ba4d JSON_SETTINGS::SaveToFile(wxString const&, bool) + 557
1   org.kicad-pcb.kicad           	0x00000001056b0609 PROJECT_FILE::SaveToFile(wxString const&, bool) + 569
2   _pcbnew.kiface                	0x000000010d7f97f7 SETTINGS_MANAGER::SaveProject(wxString const&) + 327
3   _pcbnew.kiface                	0x000000010cfde33d PCB_EDIT_FRAME::SaveProjectSettings() + 1901
4   _pcbnew.kiface                	0x000000010cf74d76 PCB_EDIT_FRAME::SavePcbFile(wxString const&, bool, bool) + 2102
5   _pcbnew.kiface                	0x000000010cf796d8 PCB_EDIT_FRAME::doAutoSave() + 1768
6   _pcbnew.kiface                	0x000000010d6c4a32 EDA_BASE_FRAME::onAutoSaveTimer(wxTimerEvent&) + 18
7   libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105d1d4ee wxEvtHandler::SearchDynamicEventTable(wxEvent&) + 190
8   libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105d1d26b wxEvtHandler::ProcessEventLocally(wxEvent&) + 59
9   libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105d1d110 wxEvtHandler::ProcessEvent(wxEvent&) + 96
10  _pcbnew.kiface                	0x000000010d6c4fa5 EDA_BASE_FRAME::ProcessEvent(wxEvent&) + 85
11  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105d1d58c wxEvtHandler::SafelyProcessEvent(wxEvent&) + 12
12  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105cb0c9a wxTimerImpl::SendEvent() + 90
13  com.apple.CoreFoundation      	0x00007fff371897f9 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
14  com.apple.CoreFoundation      	0x00007fff3718935f __CFRunLoopDoTimer + 859
15  com.apple.CoreFoundation      	0x00007fff37188e47 __CFRunLoopDoTimers + 322
16  com.apple.CoreFoundation      	0x00007fff3716dbea __CFRunLoopRun + 1871
17  com.apple.CoreFoundation      	0x00007fff3716ce3e CFRunLoopRunSpecific + 462
18  com.apple.HIToolbox           	0x00007fff35d99abd RunCurrentEventLoopInMode + 292
19  com.apple.HIToolbox           	0x00007fff35d997d5 ReceiveNextEventCommon + 584
20  com.apple.HIToolbox           	0x00007fff35d99579 _BlockUntilNextEventMatchingListInModeWithFilter + 64
21  com.apple.AppKit              	0x00007fff343df039 _DPSNextEvent + 883
22  com.apple.AppKit              	0x00007fff343dd880 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
23  com.apple.AppKit              	0x00007fff343cf58e -[NSApplication run] + 658
24  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105df83ae wxGUIEventLoop::OSXDoRun() + 174
25  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105ced3ac wxCFEventLoop::DoRun() + 44
26  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105c35af2 wxEventLoopBase::Run() + 162
27  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105c02653 wxAppConsoleBase::MainLoop() + 99
28  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105d91bfa wxApp::OnRun() + 26
29  org.kicad-pcb.kicad           	0x00000001054eb169 APP_KICAD::OnRun() + 25
30  libwx_osx_cocoau-3.0.0.4.0.dylib	0x0000000105c7009a wxEntry(int&, wchar_t**) + 138
31  org.kicad-pcb.kicad           	0x00000001054ea320 main + 48
32  libdyld.dylib                 	0x00007fff711d7cc9 start + 1
Edited by Arjen Roodselaar