klayout
klayout copied to clipboard
matplotlib, Qt
Eight years ago, I was seeing if I could get matplotlib to work in KLayout. I tried today and it seems to work quite well on Mac OSX, and I was able to generate simple plots.
I was able to even install Flex Compute's Tidy3D simulator within the HW KLayout build and have the plots generate within KLayout.
My approach for installing packages is to do it within the KLayout IDE Python using the pip module:
import pip
pip.main(['install', 'matplotlib'])
pip.main(['install', 'tidy3d'])
Problems encountered:
- On Mac OSX, it causes a KLayout crash if I close the windows.
- On both Windows and Linux (Ubunto 22) KLayout froze (I waited for 30 minutes), so that didn't work.
I suspect the OSX version is using the MacOSX backend. Perhaps it would be better to use the Qt backend?
@thomaslima, perhaps you have already experience with this?
It would be nice to be able to create Qt dialogs in KLayout with plots.
For example, it could be used to help designers choose parameters from a PCell or display other technology information. And even display some simulation results.
@momchil-flex, @tomflexcompute, I would like to make it easy for students to use tidy3d in the edX Phot1x course. I'm curious what you think.
Thank you Lukas
Hi Lukas. I wish there was an easy solution to this. First, to debug this, I feel like we will need to have a minimum working example. I wonder if just installing matplotlib and running a simple plot will cause this behavior. Also, have you tried the LW release? That might work better.
I tried working on a deeper python integration a while ago (#660), but never finished it. The first challenge is coming up with a solution that is compatible not only with Macs but also Windows and Linux.
To solve this problem once and for all, I think the ultimate solution is to have klayout (GUI) communicate with a native python instance and exchange data as necessary. This would be an optional featured enabled by a setting in the GUI, where you would choose the desired python location, much like VSCode's can choose which python environment to use when running scripts. This is similar (in spirit) to Tait's https://github.com/atait/klayout-ipc project, where commands are communicated via a socket server and pya's QTcpServer. In this scenario, macros would be run by the chosen python executable, instead of Klayout's internal interpreter. Maybe we can borrow some code from the ipython/jupyter project which enable this functionality by using python kernels independent from the "code editor". @klayoutmatthias what do you think? This would require enabling a different process control pya.Application etc. Something like this project (https://github.com/tomerfiliba-org/rpyc)
Hi Lukas,
in gdsfactory we use the klayout python API to render plots and avoid using the python inside klayout to avoid these types of issues. This is similar to what Thomas proposes with using a native pyhton instance.
https://gdsfactory.github.io/gdsfactory/notebooks/00_geometry.html
We are also starting to use kweb where we can expose the klayout python API through a web interface
@proppy @thomasdorch @atait @flaport
This wouldn't work for Lukas because his use case is to launch third-party python modules from within klayout's macro environment. So a "reverse API". This sounds difficult to me at the moment -- like having klayout host a jupyter_client, with a remote python kernel, but with bidirectional communication because the scripts would need access to the host's GSI. Welcome thoughts on possible implementation.
Here's an idea. Rather than burdening klayout's maintainers, what if we enable the macro editor to use an optional external python binary to execute the macro? Something along these lines:
- We help the user by auto-finding available binaries in known places (conda, brew, pyenv etc) and creating a dropdown menu.
- We modify the macro execution so that if it uses an external binary/environment, klayout calls that binary as a subprocess (like in jupyter). We can implement it as a jupyter client and use the remote environment as a 'kernel'.
- We can remember which macro used which 'kernel'. Macros by default uses klayout's interpreter.
- Only macros running in klayout's interpreter can use pya objects directly.
Salt package developers and python developers can then be free to use whatever framework they choose for inter-process communication.
- @lukasc-ubc can ask students to install an anaconda environment and point klayout to that environment.
- Basic scripts can then take care of installing dependencies on that environment with
$REMOTEPYTHON -m pip install whatever
. - That python installation can be a different version entirely, disconnected from klayout's.
- pya is not going to be available. Developers need to create a salt package if they want to manipulate klayout's windows and layout views. They also need to figure out how to transfer database objects back and forth such as polygons or layouts. (Maybe in the future we can provide a reference implementation).
I think this will enhance UX significantly, much in the same way that jupyter/vscode's ability to select & remember python kernels improved my life a lot. I also think that this will simplify salt packages too by making it be simple scripts that connect to more featured python packages maintained externally by some anaconda environment or package manager.
I would love having access to an external python in KLayout!
For the record, there is also an effort to build the KLayout GUI for conda, such that it has access to all the packages installed in a conda environment. See here for example https://github.com/conda-forge/staged-recipes/pull/20396.
However, being able to access an external python might be a better, more flexible solution as long as it does not restrict which external python version can be used.
@flaport fyi, we do have a klayout package in conda-eda now https://anaconda.org/LiteX-Hub/klayout/files (that does include the GUI).
Coming back to the original question, I'll check why mathplotlib isn't working with KLayout. I think it has to do with the coexistence of Qt and another event loop. But if that was working once, it should be possible to revive that option.
Becoming more general, I think you overestimate KLayouts "workbench" abilities somewhat. After all, that is a simple single-threaded application with all the restrictions that come with it. I created Python support for simple automation tasks.
As a general solution I was actually thinking about turning KLayout into a remote-controlled engine (on a deeper level than rpyc) and running the IDE as a separate process. That avoids manifold problems connected with single-threaded applications. However this is not a small project, but it goes in the direction of having built-in RPC support with your own choice of client.
As of now I - because of the simplicity of that approach - I personally favor the "build from scratch" idea that is behind the LayoutView object of the PyPI klayout module: this eventually is the atomic form of the KLayout GUI and you should be able to integrate it into whatever application you're building - even if this application is a web server (see kweb). This gives you maximum freedom of integration, but of course you need to spend some effort building the application the way you need it.
I'm aware that this needs more activity. My personal focus right now is on PDK support which is a somewhat different topic.
Best regards,
Matthias
Coming back to the original question, I'll check why mathplotlib isn't working with KLayout. I think it has to do with the coexistence of Qt and another event loop. But if that was working once, it should be possible to revive that option.
I have since tested on my machine. No issues with plotting simple structures and closing windows. I suspect it has something to do with tidy3d or a particular installation.
Becoming more general, I think you overestimate KLayouts "workbench" abilities somewhat. After all, that is a simple single-threaded application with all the restrictions that come with it. I created Python support for simple automation tasks.
I see your point. But I think many people already use it as their workbench. There's lots of potential in the way you implemented python/ruby-based extensions to the GUI. Like you said (simple automation). This functionality would simply extend their automation capabilities. The only question is whether this would create more technical debt than it would remove. My money is that it would be a net positive for simplicity. My proposed change would launch a new thread to run the macro, communicating only via pre-defined socket-based I/O. I can explore this idea a bit more later.
As a general solution I was actually thinking about turning KLayout into a remote-controlled engine (on a deeper level than rpyc) and running the IDE as a separate process. That avoids manifold problems connected with single-threaded applications. However this is not a small project, but it goes in the direction of having built-in RPC support with your own choice of client.
That would be awesome. And I would still use klayout as a client. :)
As of now I - because of the simplicity of that approach - I personally favor the "build from scratch" idea that is behind the LayoutView object of the PyPI klayout module: this eventually is the atomic form of the KLayout GUI and you should be able to integrate it into whatever application you're building - even if this application is a web server (see kweb). This gives you maximum freedom of integration, but of course you need to spend some effort building the application the way you need it.
I always wanted to have an iPad app that would render layout files. :) Are you suggesting that folks willing to integrate klayout with other tools (like simulation tools) would need to code a new GUI? Or that the new klayout engine would need to be integrated into the other "workbench" software?
I'm aware that this needs more activity. My personal focus right now is on PDK support which is a somewhat different topic.
Thanks for considering my thoughts! I also like @flaport and @proppy's proposal of using anaconda for advanced python users.
I like the idea of linking a separate python to facilitate for Windows and MacOs users @Jan-David-Black
For example, we have klayout packages for GF180nm and Skywater130nm and they only work well on Linux because they depend on gdsfactory https://sami.klayout.org/
the conda build of klayout+GUI does not work on MacOs yet, @thomasdorch did the windows one and Floris made the linux one
https://github.com/efabless/globalfoundries-pdk-libs-gf180mcu_fd_pr/issues/28
@lukasc-ubc Coming back to the original question, I did some debugging.
matplotlib comes with a number of backends. In my case (Ubuntu without PyQt installated) the default was gtk. The gtk backend does not work inside KLayout because it ends in a deadlock (nested event loops I suppose).
After I installed PyQt, things worked nicely except in the macro IDE. When running macros from inside the IDE, the application crashed. The reason was that the IDE was not aware of the foreign Python events that PyQt generates out of the UI system. I can fix that problem.
So basically, with PyQt installed, matplotlib seems to be functional.
In generate, installing the PyQt should be easy with package management (conda, Linux, MacOS with homebrew or Anaconda). I'll check if I can include matplotlib and PyQt5 in the next Windows release (it's already heavy enough, so that should not be an issue).
Matthias
@klayoutmatthias
It would be great if you could add matplotlib as part of the Windows distribution.
I like the simplicity of installation instructions that only require KLayout (with salt packages), and not a separate Conda distribution. The latter leads to tons of debugging with each computer and each individual.
thank you
the conda build of klayout+GUI does not work on MacOs yet, @thomasdorch did the windows one and Floris made the linux one
@xobs recently did some work around this for conda-eda, see: https://github.com/hdl/conda-eda/pull/298
@lukasc-ubc Yes, I will try that for 0.28.6. If I am lucky, the MSYS system comes with the proper packages already. I hope there aren't too many integration issues.

The only funny bit is that klayout.app isn't installed into Applications, because I'm not sure if/how that's supposed to happen. But it can be natively launched, as pictured.
Mustafa and I succeeded in getting plotly to work perfectly in KLayout for OSX, Windows and Linux this week. SiEPIC-Tools now includes a Photonic integrated circuit simulator "OPICS" which is able to create simulation plots. Simulations are done by extracting a netlist from KLayout, and a compact model library is included in the Technology/PDK as a Si folder "CML". Works beautifully, and we are teaching tomorrow at the OFC conference, in short course SC432. Regards Lukas Ps. We faced many challenges with Windows, importing some Python packages that are required by tidy3d. Many give errors about eggs (not the kind that birds lay).
I will release 0.28.6 today and in the Windows installer I have included matplotlib and PyQt5. It is working with the examples I tried so far. Even PyQt5 works, although I doubt that it is very easy to integrate with the application.
Thank you @klayoutmatthias
Crash on closing matplotlib windows on M1:
In the Mac OSX version, I imported matplotlib, and after creating a window and closing it via the code below, KLayout crashes with the error reports below. I get a crash with both the version I compiled (LW), and the official version from KLayout.de, klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39. @thomaslima can you see if you can get it to crash as well?
import matplotlib.pyplot as plt
import numpy as n
wavelength = n.array([1, 2, 3, 4, 5])
power = wavelength**2
plt.figure()
print(wavelength*1e9)
print(power)
plt.plot(wavelength*1e9, power)
plt.xlim((1*10**9,7*10**9))
plt.xlabel('Wavelength (nm)')
plt.ylabel('Transmission (dB)')
print("TEST1")
plt.show(block=False)
print("TEST2")
for i in range(0,10):
print("This text should show with the plot up")
LW version crash report:
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: klayout [54072]
Path: /Users/USER/Documents/*/klayout.app/Contents/MacOS/klayout
Identifier: de.klayout
Version: 0.28.5 (0.28.5)
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2023-03-17 20:28:34.5479 -0700
OS Version: macOS 12.6.2 (21G320)
Report Version: 12
Anonymous UUID: FEFE5F3F-C520-F094-2850-1B4D9866DCE8
Sleep/Wake UUID: 840AD793-0037-460C-B212-A0E579E92CC4
Time Awake Since Boot: 940000 seconds
Time Since Wake: 1157 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001b07f8cdc
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process: exc handler [54072]
Application Specific Information:
Over-release of NSResponder or subclass.
Kernel Triage:
VM - Compressor failed a blocking pager_get
VM - Compressor failed a blocking pager_get
VM - Compressor failed a blocking pager_get
VM - Compressor failed a blocking pager_get
VM - Compressor failed a blocking pager_get
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 AppKit 0x1b07f8cdc -[NSResponder release] + 176
1 AppKit 0x1b07f8cdc -[NSResponder release] + 176
2 AppKit 0x1b0944114 -[NSTextView release] + 456
3 libsystem_blocks.dylib 0x1ad922a14 _Block_release + 192
4 libsystem_blocks.dylib 0x1ad922a14 _Block_release + 192
5 libsystem_blocks.dylib 0x1ad922a14 _Block_release + 192
6 CoreFoundation 0x1adcc8914 __CFRunLoopDoBlocks + 484
7 CoreFoundation 0x1adcc78dc __CFRunLoopRun + 1720
8 CoreFoundation 0x1adcc6a84 CFRunLoopRunSpecific + 600
9 HIToolbox 0x1b690a338 RunCurrentEventLoopInMode + 292
10 HIToolbox 0x1b690a0b4 ReceiveNextEventCommon + 564
11 HIToolbox 0x1b6909e68 _BlockUntilNextEventMatchingListInModeWithFilter + 72
12 AppKit 0x1b082e51c _DPSNextEvent + 860
13 AppKit 0x1b082ce14 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1328
14 AppKit 0x1b081efe0 -[NSApplication run] + 596
15 libqcocoa.dylib 0x1080e97a4 0x1080b4000 + 219044
16 QtCore 0x10acf3f74 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 520
17 QtCore 0x10acf85cc QCoreApplication::exec() + 132
18 libklayout_lay.0.dylib 0x102212048 lay::GuiApplication::exec() + 2228
19 libklayout_lay.0.dylib 0x1022106a8 lay::ApplicationBase::run() + 4012
20 klayout 0x1005e6ed4 0x1005d4000 + 77524
21 libklayout_rba.0.dylib 0x100bb7d54 0x100ba0000 + 97620
22 libruby.3.2.dylib 0x10172d080 vm_call_cfunc_with_frame + 228
23 libruby.3.2.dylib 0x10172ef3c vm_sendish + 1132
24 libruby.3.2.dylib 0x101716524 vm_exec_core + 6176
25 libruby.3.2.dylib 0x101725700 rb_vm_exec + 1980
26 libruby.3.2.dylib 0x1015cf718 rb_ec_exec_node + 292
27 libruby.3.2.dylib 0x1015cf58c ruby_run_node + 96
28 libklayout_rba.0.dylib 0x100bb7ce0 rba::RubyInterpreter::initialize(int&, char**, int (*)(int&, char**)) + 208
29 klayout 0x1005e68e4 0x1005d4000 + 76004
30 klayout 0x1005e6450 0x1005d4000 + 74832
31 dyld 0x1007fd08c start + 520
Thread 1:
0 libsystem_kernel.dylib 0x1adbc6eb0 poll + 8
1 libruby.3.2.dylib 0x1016f5ec8 timer_pthread_fn + 128
2 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
3 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 2:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x1adbc9598 __select + 8
1 CoreFoundation 0x1adcf3808 __CFSocketManager + 644
2 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
3 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 3:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x1adbbe8b0 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1adbbed20 mach_msg + 76
2 CoreFoundation 0x1adcc9210 __CFRunLoopServiceMachPort + 372
3 CoreFoundation 0x1adcc76c0 __CFRunLoopRun + 1180
4 CoreFoundation 0x1adcc6a84 CFRunLoopRunSpecific + 600
5 AppKit 0x1b099b100 _NSEventThread + 196
6 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
7 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 4:: QThread
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 QtCore 0x10ab3fbac 0x10ab14000 + 179116
3 QtCore 0x10ab3fb14 QWaitCondition::wait(QMutex*, QDeadlineTimer) + 104
4 libklayout_tl.0.dylib 0x100919cf4 tl::JobBase::get_task(int) + 404
5 libklayout_tl.0.dylib 0x100919eec tl::Worker::run() + 104
6 QtCore 0x10ab378a8 0x10ab14000 + 145576
7 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
8 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 5:: QThread
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 QtCore 0x10ab3fbac 0x10ab14000 + 179116
3 QtCore 0x10ab3fb14 QWaitCondition::wait(QMutex*, QDeadlineTimer) + 104
4 libklayout_tl.0.dylib 0x100919cf4 tl::JobBase::get_task(int) + 404
5 libklayout_tl.0.dylib 0x100919eec tl::Worker::run() + 104
6 QtCore 0x10ab378a8 0x10ab14000 + 145576
7 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
8 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 6:
0 libsystem_pthread.dylib 0x1adbf7078 start_wqthread + 0
Thread 7:
0 libsystem_pthread.dylib 0x1adbf7078 start_wqthread + 0
Thread 8:
0 libsystem_pthread.dylib 0x1adbf7078 start_wqthread + 0
Thread 9:
0 libsystem_pthread.dylib 0x1adbf7078 start_wqthread + 0
Thread 10:
0 libsystem_pthread.dylib 0x1adbf7078 start_wqthread + 0
Thread 11:
0 libsystem_pthread.dylib 0x1adbf7078 start_wqthread + 0
Thread 12:
0 libsystem_pthread.dylib 0x1adbf7078 start_wqthread + 0
Thread 13:
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 libopenblas64_.0.dylib 0x1349c8394 blas_thread_server + 360
3 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
4 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 14:
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 libopenblas64_.0.dylib 0x1349c8394 blas_thread_server + 360
3 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
4 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 15:
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 libopenblas64_.0.dylib 0x1349c8394 blas_thread_server + 360
3 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
4 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 16:
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 libopenblas64_.0.dylib 0x1349c8394 blas_thread_server + 360
3 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
4 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 17:
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 libopenblas64_.0.dylib 0x1349c8394 blas_thread_server + 360
3 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
4 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 18:
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 libopenblas64_.0.dylib 0x1349c8394 blas_thread_server + 360
3 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
4 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 19:
0 libsystem_kernel.dylib 0x1adbc2270 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1adbfc83c _pthread_cond_wait + 1236
2 libopenblas64_.0.dylib 0x1349c8394 blas_thread_server + 360
3 libsystem_pthread.dylib 0x1adbfc26c _pthread_start + 148
4 libsystem_pthread.dylib 0x1adbf708c thread_start + 8
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000
x4: 0x0000000000000000 x5: 0x0000000000000000 x6: 0x0000000000000000 x7: 0x0000000000000000
x8: 0x7f6a1a0642e1006f x9: 0x7f6a1a0642e1006f x10: 0x000000001e000000 x11: 0x0000000000000001
x12: 0x000000016f829122 x13: 0x0000000000000000 x14: 0x00000001005f0cff x15: 0x00000001b14bc965
x16: 0xfffffffffffffff4 x17: 0x0000000207d1fef8 x18: 0x0000000000000000 x19: 0x000000012659cb60
x20: 0x00000001f7f398d8 x21: 0x0000000207294b38 x22: 0x000000020665c000 x23: 0x0000000000000000
x24: 0x00000001f7f39000 x25: 0x0000000000000000 x26: 0x000000015680cac0 x27: 0x0000000000000000
x28: 0x0000600004c38a20 fp: 0x000000016f829330 lr: 0xd57e8001b07f8cdc
sp: 0x000000016f829320 pc: 0x00000001b07f8cdc cpsr: 0x60001000
far: 0x0000000111c28000 esr: 0xf2000001 (Breakpoint) brk 1
Binary Images:
0x1b07ed000 - 0x1b16a5fff com.apple.AppKit (6.9) <143e26e2-b101-34d6-8111-94ca9e06daef> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x1ad921000 - 0x1ad922fff libsystem_blocks.dylib (*) <96462bd5-6bb4-3b69-89c9-2c70fa8852e7> /usr/lib/system/libsystem_blocks.dylib
0x1adc44000 - 0x1ae18afff com.apple.CoreFoundation (6.9) <fc3c193d-0cdb-3569-9f0e-bd2507ca1dbb> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x1b68d8000 - 0x1b6c0bfff com.apple.HIToolbox (2.1.1) <aaf900bd-bfb6-3af0-a8d3-e24bbe1d57f5> /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
0x1080b4000 - 0x10815ffff libqcocoa.dylib (*) <78a68ac4-8027-3a59-b8d5-ad29cb581911> /opt/homebrew/*/libqcocoa.dylib
0x10ab14000 - 0x10afb7fff org.qt-project.QtCore (5.15) <b5363cc5-61ad-3a38-84d8-f0494ddc6845> /opt/homebrew/*/QtCore.framework/Versions/5/QtCore
0x102198000 - 0x102427fff libklayout_lay.0.dylib (*) <8aab6435-58b4-3e3d-9d9f-454a807c5bbd> /Users/USER/Documents/*/klayout.app/Contents/Frameworks/libklayout_lay.0.dylib
0x1005d4000 - 0x1005e7fff de.klayout (0.28.5) <6d1c3bd8-e797-360b-8435-955d7dd024f8> /Users/USER/Documents/*/klayout.app/Contents/MacOS/klayout
0x100ba0000 - 0x100bdffff libklayout_rba.0.dylib (*) <35dec02d-fc4f-3057-b7d2-7566d1460eec> /Users/USER/Documents/*/klayout.app/Contents/Frameworks/libklayout_rba.0.dylib
0x101560000 - 0x10197bfff libruby.3.2.dylib (*) <3947cc00-06bd-3daa-b266-3da5032e0172> /opt/homebrew/*/libruby.3.2.dylib
0x1007f8000 - 0x100857fff dyld (*) <f0564ec5-bf9c-3107-82b3-485f927b489f> /usr/lib/dyld
0x1adbbd000 - 0x1adbf4fff libsystem_kernel.dylib (*) <b71e7783-80bc-36bb-af5d-579344d68742> /usr/lib/system/libsystem_kernel.dylib
0x1adbf5000 - 0x1adc01fff libsystem_pthread.dylib (*) <63c4eef9-69a5-38b1-996e-8d31b66a051d> /usr/lib/system/libsystem_pthread.dylib
0x1008ac000 - 0x10093ffff libklayout_tl.0.dylib (*) <22bb16ec-429c-3ead-beb2-ed7d7ef19de9> /Users/USER/Documents/*/klayout.app/Contents/Frameworks/libklayout_tl.0.dylib
0x134860000 - 0x135c37fff libopenblas64_.0.dylib (*) <3dd132fc-be72-33cc-baf0-4c7df2669307> /opt/homebrew/*/libopenblas64_.0.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=1.1G resident=0K(0%) swapped_out_or_unallocated=1.1G(100%)
Writable regions: Total=2.4G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=2.4G(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Accelerate framework 2176K 17
Activity Tracing 256K 1
CG backing stores 2176K 4
CG image 3040K 27
ColorSync 624K 27
CoreAnimation 20.8M 22
CoreGraphics 32K 2
CoreUI image data 2704K 21
Foundation 48K 2
Kernel Alloc Once 32K 1
MALLOC 825.8M 118
MALLOC guard page 192K 11
MALLOC_MEDIUM (reserved) 816.0M 8 reserved VM address space (unallocated)
MALLOC_NANO (reserved) 128.0M 1 reserved VM address space (unallocated)
STACK GUARD 56.3M 20
Stack 18.1M 20
VM_ALLOCATE 251.4M 544
VM_ALLOCATE (reserved) 384.0M 3 reserved VM address space (unallocated)
__AUTH 1986K 199
__AUTH_CONST 11.9M 365
__CTF 756 1
__DATA 28.0M 672
__DATA_CONST 23.5M 654
__DATA_DIRTY 1008K 130
__FONT_DATA 4K 1
__LINKEDIT 612.0M 290
__OBJC_CONST 2085K 172
__OBJC_RO 83.0M 1
__OBJC_RW 3168K 1
__TEXT 520.6M 669
__UNICODE 592K 1
dyld private memory 1072K 3
mapped file 158.4M 34
shared memory 848K 15
=========== ======= =======
TOTAL 3.9G 4057
TOTAL, minus reserved VM space 2.6G 4057
-----------
Full Report
-----------
{"app_name":"klayout","timestamp":"2023-03-17 20:28:36.00 -0700","app_version":"0.28.5","slice_uuid":"6d1c3bd8-e797-360b-8435-955d7dd024f8","build_version":"0.28.5","platform":1,"bundleID":"de.klayout","share_with_app_devs":1,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.6.2 (21G320)","incident_id":"18B034AB-2010-45A7-B73D-76BB66279F25","name":"klayout"}
{
"uptime" : 940000,
"procLaunch" : "2023-03-15 13:36:37.2653 -0700",
"procRole" : "Foreground",
"version" : 2,
"userID" : 501,
"deployVersion" : 210,
"modelCode" : "MacBookAir10,1",
"procStartAbsTime" : 21162166895208,
"coalitionID" : 129349,
"osVersion" : {
"train" : "macOS 12.6.2",
"build" : "21G320",
"releaseType" : "User"
},
"captureTime" : "2023-03-17 20:28:34.5479 -0700",
"incident" : "18B034AB-2010-45A7-B73D-76BB66279F25",
"bug_type" : "309",
"pid" : 54072,
"procExitAbsTime" : 22652156032625,
"translated" : false,
"cpuType" : "ARM-64",
"procName" : "klayout",
"procPath" : "\/Users\/USER\/Documents\/*\/klayout.app\/Contents\/MacOS\/klayout",
"bundleInfo" : {"CFBundleShortVersionString":"0.28.5","CFBundleVersion":"0.28.5","CFBundleIdentifier":"de.klayout"},
"storeInfo" : {"deviceIdentifierForVendor":"BBDEC3D1-4B82-574C-8860-A789877573B3","thirdParty":true},
"parentProc" : "launchd",
"parentPid" : 1,
"coalitionName" : "de.klayout",
"crashReporterKey" : "FEFE5F3F-C520-F094-2850-1B4D9866DCE8",
"wakeTime" : 1157,
"sleepWakeUUID" : "840AD793-0037-460C-B212-A0E579E92CC4",
"sip" : "enabled",
"isCorpse" : 1,
"exception" : {"codes":"0x0000000000000001, 0x00000001b07f8cdc","rawCodes":[1,7256116444],"type":"EXC_BREAKPOINT","signal":"SIGTRAP"},
"termination" : {"flags":0,"code":5,"namespace":"SIGNAL","indicator":"Trace\/BPT trap: 5","byProc":"exc handler","byPid":54072},
"ktriageinfo" : "VM - Compressor failed a blocking pager_get\nVM - Compressor failed a blocking pager_get\nVM - Compressor failed a blocking pager_get\nVM - Compressor failed a blocking pager_get\nVM - Compressor failed a blocking pager_get\n",
"asi" : {"libsystem_c.dylib":["Over-release of NSResponder or subclass."]},
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"faultingThread" : 0,
"threads" : [{"triggered":true,"id":9436949,"threadState":{"x":[{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":0},{"value":9181179404542345327},{"value":9181179404542345327},{"value":503316480},{"value":1},{"value":6165795106},{"value":0},{"value":4301196543},{"value":7269501285,"symbolLocation":96794,"symbol":"__NSStyleNameIndexTable"},{"value":18446744073709551604},{"value":8721137400},{"value":0},{"value":4938386272},{"value":8454904024,"objc-selector":"release"},{"value":8710081336},{"value":8697266176,"symbolLocation":416,"symbol":"_CFXNotificationPost.samples"},{"value":0},{"value":8454901760,"objc-selector":"ableViewControllerDelegate"},{"value":0},{"value":5746248384},{"value":0},{"value":105553196190240}],"flavor":"ARM_THREAD_STATE64","lr":{"value":15383874121888664796},"cpsr":{"value":1610616832},"fp":{"value":6165795632},"sp":{"value":6165795616},"esr":{"value":4060086273,"description":"(Breakpoint) brk 1"},"pc":{"value":7256116444,"matchesCrashFrame":1},"far":{"value":4592926720}},"queue":"com.apple.main-thread","frames":[{"imageOffset":48348,"symbol":"-[NSResponder release]","symbolLocation":176,"imageIndex":0},{"imageOffset":48348,"symbol":"-[NSResponder release]","symbolLocation":176,"imageIndex":0},{"imageOffset":1405204,"symbol":"-[NSTextView release]","symbolLocation":456,"imageIndex":0},{"imageOffset":6676,"symbol":"_Block_release","symbolLocation":192,"imageIndex":1},{"imageOffset":6676,"symbol":"_Block_release","symbolLocation":192,"imageIndex":1},{"imageOffset":6676,"symbol":"_Block_release","symbolLocation":192,"imageIndex":1},{"imageOffset":542996,"symbol":"__CFRunLoopDoBlocks","symbolLocation":484,"imageIndex":2},{"imageOffset":538844,"symbol":"__CFRunLoopRun","symbolLocation":1720,"imageIndex":2},{"imageOffset":535172,"symbol":"CFRunLoopRunSpecific","symbolLocation":600,"imageIndex":2},{"imageOffset":205624,"symbol":"RunCurrentEventLoopInMode","symbolLocation":292,"imageIndex":3},{"imageOffset":204980,"symbol":"ReceiveNextEventCommon","symbolLocation":564,"imageIndex":3},{"imageOffset":204392,"symbol":"_BlockUntilNextEventMatchingListInModeWithFilter","symbolLocation":72,"imageIndex":3},{"imageOffset":267548,"symbol":"_DPSNextEvent","symbolLocation":860,"imageIndex":0},{"imageOffset":261652,"symbol":"-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]","symbolLocation":1328,"imageIndex":0},{"imageOffset":204768,"symbol":"-[NSApplication run]","symbolLocation":596,"imageIndex":0},{"imageOffset":219044,"imageIndex":4},{"imageOffset":1965940,"symbol":"QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)","symbolLocation":520,"imageIndex":5},{"imageOffset":1983948,"symbol":"QCoreApplication::exec()","symbolLocation":132,"imageIndex":5},{"imageOffset":499784,"symbol":"lay::GuiApplication::exec()","symbolLocation":2228,"imageIndex":6},{"imageOffset":493224,"symbol":"lay::ApplicationBase::run()","symbolLocation":4012,"imageIndex":6},{"imageOffset":77524,"imageIndex":7},{"imageOffset":97620,"imageIndex":8},{"imageOffset":1888384,"symbol":"vm_call_cfunc_with_frame","symbolLocation":228,"imageIndex":9},{"imageOffset":1896252,"symbol":"vm_sendish","symbolLocation":1132,"imageIndex":9},{"imageOffset":1795364,"symbol":"vm_exec_core","symbolLocation":6176,"imageIndex":9},{"imageOffset":1857280,"symbol":"rb_vm_exec","symbolLocation":1980,"imageIndex":9},{"imageOffset":456472,"symbol":"rb_ec_exec_node","symbolLocation":292,"imageIndex":9},{"imageOffset":456076,"symbol":"ruby_run_node","symbolLocation":96,"imageIndex":9},{"imageOffset":97504,"symbol":"rba::RubyInterpreter::initialize(int&, char**, int (*)(int&, char**))","symbolLocation":208,"imageIndex":8},{"imageOffset":76004,"imageIndex":7},{"imageOffset":74832,"imageIndex":7},{"imageOffset":20620,"symbol":"start","symbolLocation":520,"imageIndex":10}]},{"id":9436983,"frames":[{"imageOffset":40624,"symbol":"poll","symbolLocation":8,"imageIndex":11},{"imageOffset":1662664,"symbol":"timer_pthread_fn","symbolLocation":128,"imageIndex":9},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":9437076,"name":"com.apple.CFSocket.private","frames":[{"imageOffset":50584,"symbol":"__select","symbolLocation":8,"imageIndex":11},{"imageOffset":718856,"symbol":"__CFSocketManager","symbolLocation":644,"imageIndex":2},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":9437081,"name":"com.apple.NSEventThread","frames":[{"imageOffset":6320,"symbol":"mach_msg_trap","symbolLocation":8,"imageIndex":11},{"imageOffset":7456,"symbol":"mach_msg","symbolLocation":76,"imageIndex":11},{"imageOffset":545296,"symbol":"__CFRunLoopServiceMachPort","symbolLocation":372,"imageIndex":2},{"imageOffset":538304,"symbol":"__CFRunLoopRun","symbolLocation":1180,"imageIndex":2},{"imageOffset":535172,"symbol":"CFRunLoopRunSpecific","symbolLocation":600,"imageIndex":2},{"imageOffset":1761536,"symbol":"_NSEventThread","symbolLocation":196,"imageIndex":0},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":9875252,"name":"QThread","frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":179116,"imageIndex":5},{"imageOffset":178964,"symbol":"QWaitCondition::wait(QMutex*, QDeadlineTimer)","symbolLocation":104,"imageIndex":5},{"imageOffset":449780,"symbol":"tl::JobBase::get_task(int)","symbolLocation":404,"imageIndex":13},{"imageOffset":450284,"symbol":"tl::Worker::run()","symbolLocation":104,"imageIndex":13},{"imageOffset":145576,"imageIndex":5},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":9906349,"name":"QThread","frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":179116,"imageIndex":5},{"imageOffset":178964,"symbol":"QWaitCondition::wait(QMutex*, QDeadlineTimer)","symbolLocation":104,"imageIndex":5},{"imageOffset":449780,"symbol":"tl::JobBase::get_task(int)","symbolLocation":404,"imageIndex":13},{"imageOffset":450284,"symbol":"tl::Worker::run()","symbolLocation":104,"imageIndex":13},{"imageOffset":145576,"imageIndex":5},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":10041994,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":12}]},{"id":10041995,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":12}]},{"id":10042061,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":12}]},{"id":10042062,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":12}]},{"id":10042063,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":12}]},{"id":10042064,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":12}]},{"id":10042065,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":12}]},{"id":10042072,"frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":1475476,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":14},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":10042073,"frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":1475476,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":14},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":10042074,"frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":1475476,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":14},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":10042075,"frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":1475476,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":14},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":10042076,"frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":1475476,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":14},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":10042077,"frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":1475476,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":14},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]},{"id":10042078,"frames":[{"imageOffset":21104,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":11},{"imageOffset":30780,"symbol":"_pthread_cond_wait","symbolLocation":1236,"imageIndex":12},{"imageOffset":1475476,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":14},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":12},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":12}]}],
"usedImages" : [
{
"source" : "P",
"arch" : "arm64e",
"base" : 7256068096,
"CFBundleShortVersionString" : "6.9",
"CFBundleIdentifier" : "com.apple.AppKit",
"size" : 15437824,
"uuid" : "143e26e2-b101-34d6-8111-94ca9e06daef",
"path" : "\/System\/Library\/Frameworks\/AppKit.framework\/Versions\/C\/AppKit",
"name" : "AppKit",
"CFBundleVersion" : "2113.60.148"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7206998016,
"size" : 8192,
"uuid" : "96462bd5-6bb4-3b69-89c9-2c70fa8852e7",
"path" : "\/usr\/lib\/system\/libsystem_blocks.dylib",
"name" : "libsystem_blocks.dylib"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7210287104,
"CFBundleShortVersionString" : "6.9",
"CFBundleIdentifier" : "com.apple.CoreFoundation",
"size" : 5533696,
"uuid" : "fc3c193d-0cdb-3569-9f0e-bd2507ca1dbb",
"path" : "\/System\/Library\/Frameworks\/CoreFoundation.framework\/Versions\/A\/CoreFoundation",
"name" : "CoreFoundation",
"CFBundleVersion" : "1866"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7357693952,
"CFBundleShortVersionString" : "2.1.1",
"CFBundleIdentifier" : "com.apple.HIToolbox",
"size" : 3358720,
"uuid" : "aaf900bd-bfb6-3af0-a8d3-e24bbe1d57f5",
"path" : "\/System\/Library\/Frameworks\/Carbon.framework\/Versions\/A\/Frameworks\/HIToolbox.framework\/Versions\/A\/HIToolbox",
"name" : "HIToolbox"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4429922304,
"size" : 704512,
"uuid" : "78a68ac4-8027-3a59-b8d5-ad29cb581911",
"path" : "\/opt\/homebrew\/*\/libqcocoa.dylib",
"name" : "libqcocoa.dylib"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4474355712,
"CFBundleShortVersionString" : "5.15",
"CFBundleIdentifier" : "org.qt-project.QtCore",
"size" : 4866048,
"uuid" : "b5363cc5-61ad-3a38-84d8-f0494ddc6845",
"path" : "\/opt\/homebrew\/*\/QtCore.framework\/Versions\/5\/QtCore",
"name" : "QtCore",
"CFBundleVersion" : "5.15.8"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4330192896,
"size" : 2686976,
"uuid" : "8aab6435-58b4-3e3d-9d9f-454a807c5bbd",
"path" : "\/Users\/USER\/Documents\/*\/klayout.app\/Contents\/Frameworks\/libklayout_lay.0.dylib",
"name" : "libklayout_lay.0.dylib"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4301078528,
"CFBundleShortVersionString" : "0.28.5",
"CFBundleIdentifier" : "de.klayout",
"size" : 81920,
"uuid" : "6d1c3bd8-e797-360b-8435-955d7dd024f8",
"path" : "\/Users\/USER\/Documents\/*\/klayout.app\/Contents\/MacOS\/klayout",
"name" : "klayout",
"CFBundleVersion" : "0.28.5"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4307156992,
"size" : 262144,
"uuid" : "35dec02d-fc4f-3057-b7d2-7566d1460eec",
"path" : "\/Users\/USER\/Documents\/*\/klayout.app\/Contents\/Frameworks\/libklayout_rba.0.dylib",
"name" : "libklayout_rba.0.dylib"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4317380608,
"size" : 4308992,
"uuid" : "3947cc00-06bd-3daa-b266-3da5032e0172",
"path" : "\/opt\/homebrew\/*\/libruby.3.2.dylib",
"name" : "libruby.3.2.dylib"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 4303323136,
"size" : 393216,
"uuid" : "f0564ec5-bf9c-3107-82b3-485f927b489f",
"path" : "\/usr\/lib\/dyld",
"name" : "dyld"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7209734144,
"size" : 229376,
"uuid" : "b71e7783-80bc-36bb-af5d-579344d68742",
"path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
"name" : "libsystem_kernel.dylib"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7209963520,
"size" : 53248,
"uuid" : "63c4eef9-69a5-38b1-996e-8d31b66a051d",
"path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
"name" : "libsystem_pthread.dylib"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4304060416,
"size" : 606208,
"uuid" : "22bb16ec-429c-3ead-beb2-ed7d7ef19de9",
"path" : "\/Users\/USER\/Documents\/*\/klayout.app\/Contents\/Frameworks\/libklayout_tl.0.dylib",
"name" : "libklayout_tl.0.dylib"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 5176164352,
"size" : 20807680,
"uuid" : "3dd132fc-be72-33cc-baf0-4c7df2669307",
"path" : "\/opt\/homebrew\/*\/libopenblas64_.0.dylib",
"name" : "libopenblas64_.0.dylib"
}
],
"sharedCache" : {
"base" : 7206666240,
"size" : 3144761344,
"uuid" : "be7fe6ad-4560-3ae2-883e-432f78b45062"
},
"vmSummary" : "ReadOnly portion of Libraries: Total=1.1G resident=0K(0%) swapped_out_or_unallocated=1.1G(100%)\nWritable regions: Total=2.4G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=2.4G(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nAccelerate framework 2176K 17 \nActivity Tracing 256K 1 \nCG backing stores 2176K 4 \nCG image 3040K 27 \nColorSync 624K 27 \nCoreAnimation 20.8M 22 \nCoreGraphics 32K 2 \nCoreUI image data 2704K 21 \nFoundation 48K 2 \nKernel Alloc Once 32K 1 \nMALLOC 825.8M 118 \nMALLOC guard page 192K 11 \nMALLOC_MEDIUM (reserved) 816.0M 8 reserved VM address space (unallocated)\nMALLOC_NANO (reserved) 128.0M 1 reserved VM address space (unallocated)\nSTACK GUARD 56.3M 20 \nStack 18.1M 20 \nVM_ALLOCATE 251.4M 544 \nVM_ALLOCATE (reserved) 384.0M 3 reserved VM address space (unallocated)\n__AUTH 1986K 199 \n__AUTH_CONST 11.9M 365 \n__CTF 756 1 \n__DATA 28.0M 672 \n__DATA_CONST 23.5M 654 \n__DATA_DIRTY 1008K 130 \n__FONT_DATA 4K 1 \n__LINKEDIT 612.0M 290 \n__OBJC_CONST 2085K 172 \n__OBJC_RO 83.0M 1 \n__OBJC_RW 3168K 1 \n__TEXT 520.6M 669 \n__UNICODE 592K 1 \ndyld private memory 1072K 3 \nmapped file 158.4M 34 \nshared memory 848K 15 \n=========== ======= ======= \nTOTAL 3.9G 4057 \nTOTAL, minus reserved VM space 2.6G 4057 \n",
"legacyInfo" : {
"threadTriggered" : {
"queue" : "com.apple.main-thread"
}
},
"trialInfo" : {
"rollouts" : [
{
"rolloutId" : "5f72dc58705eff005a46b3a9",
"factorPackIds" : {
},
"deploymentId" : 240000015
},
{
"rolloutId" : "5fb4245a1bbfe8005e33a1e1",
"factorPackIds" : {
},
"deploymentId" : 240000021
}
],
"experiments" : [
]
}
}
Model: MacBookAir10,1, BootROM 8419.60.44, proc 8:4:4 processors, 16 GB, SMC
Graphics: Apple M1, Apple M1, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Memory Module: LPDDR4
AirPort: Wi-Fi, wl0: Mar 23 2022 19:57:59 version 18.60.27.0.7.8.129 FWID 01-570be953
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: USB31Bus
Thunderbolt Bus: MacBook Air, Apple Inc.
Thunderbolt Bus: MacBook Air, Apple Inc.
HW 0.28.5 vesion crash report:
Signal number: 4
Address: 0x7ff812e12c7c
Program Version: KLayout 0.28.5 (2023-02-07 r53682f077)
Backtrace:
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_lay.0.dylib +0x20e0ab _ZN3lay25enable_signal_handler_guiEb
/usr/lib/system/libsystem_platform.dylib +0x3dfd _sigtramp
/usr/lib/system/libsystem_platform.dylib +0xffff8007efbdd000 _sigtramp
/usr/lib/system/libsystem_c.dylib +0x808be _os_crash
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0xbc7c -[NSResponder release]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x154ec7 -[NSTextView release]
/usr/lib/system/libsystem_blocks.dylib +0x1654 _Block_release
/usr/lib/system/libsystem_blocks.dylib +0x1654 _Block_release
/usr/lib/system/libsystem_blocks.dylib +0x1654 _Block_release
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x7ede9 __CFRunLoopDoBlocks
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x7e109 __CFRunLoopRun
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x7d014 CFRunLoopRunSpecific
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x2e5e6 RunCurrentEventLoopInMode
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x2e34a ReceiveNextEventCommon
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x2e0e5 _BlockUntilNextEventMatchingListInModeWithFilter
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x3efad _DPSNextEvent
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x3d66a -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x2fd19 -[NSApplication run]
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/PlugIns/platforms/libqcocoa.dylib +0x3ab3a qt_plugin_instance
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore +0x1e3857 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore +0x1e7802 _ZN16QCoreApplication4execEv
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_lay.0.dylib +0x84ae2 _ZN3lay14GuiApplication4execEv
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_lay.0.dylib +0x830ff _ZN3lay15ApplicationBase3runEv
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/MacOS/klayout +0x1318e
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_rba.0.dylib +0x1b77f _ZN3rba15RubyInterpreter10initializeERiPPcPFiS1_S3_E
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x171aa4 rb_vm_fstring_table
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x16093f rb_vm_get_insns_address_table
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x16e453 rb_vm_exec
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x5d8c9 ruby_exec_node
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x5d7cc ruby_run_node
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_rba.0.dylib +0x1b71a _ZN3rba15RubyInterpreter10initializeERiPPcPFiS1_S3_E
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/MacOS/klayout +0x12c54
/Applications/klayout-0.28.5-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/MacOS/klayout +0x127b4
/usr/lib/dyld +0x552e start
/usr/lib/dyld +0x0 start
Hi Lukas,
sorry for the late reply.
I could see that crash on 0.28.5. But with 0.28.6 I cannot reproduce it any longer on Windows and Ubuntu. So I have hope it's gone on MacOS too.
Good news #2: on Windows, matplotlib and PyQt5 (for the matplotlib backend) is included in the standard installer, so this sample runs out of the box without further packages and without crash :)
P.S. if you run it from the debugger, the first package import takes a long time (some minutes) if the debugger is turned on. That are the trace callbacks that KLayout installs in order to catch breakpoints. You can turn off debugging (at least the first time you run the script) to mitigate this. Outside of the IDE execution is fast.
Matthias
On the Mac OSX, klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39, I ran the matplotlib example, and closed the window, and it crashed:
Signal number: 4
Address: 0x7fff22e0f5a9
Program Version: KLayout 0.28.6 (2023-03-20 rd38899bf1)
Backtrace:
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_lay.0.dylib +0x20e05b _ZN3lay25enable_signal_handler_guiEb
/usr/lib/system/libsystem_platform.dylib +0x3d7d _sigtramp
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x368e0 -[CFPrefsSearchListSource alreadylocked_generationCountFromListOfSources:count:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x164018 -[NSTextView release]
/usr/lib/system/libsystem_blocks.dylib +0x1605 _Block_release
/usr/lib/system/libsystem_blocks.dylib +0x1605 _Block_release
/usr/lib/system/libsystem_blocks.dylib +0x1605 _Block_release
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x8076d __CFRunLoopDoBlocks
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x7fa9c __CFRunLoopRun
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation +0x7e9bc CFRunLoopRunSpecific
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x30a83 RunCurrentEventLoopInMode
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x307e5 ReceiveNextEventCommon
/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox +0x30583 _BlockUntilNextEventMatchingListInModeWithFilter
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x3eb12 _DPSNextEvent
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x3d2e5 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x25e0dc -[NSWindow(NSEventRouting) trackEventsMatchingMask:timeout:mode:handler:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x25d4b5 -[NSDragEventTracker trackEvent:usingHandler:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x25c7ab NSControlTrackMouse
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x25c1d3 -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x25c09a -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x25b3c2 -[NSControl mouseDown:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x2597ae -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x1c8fc8 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x1c8386 -[NSWindow(NSEventRouting) sendEvent:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x1c6794 -[NSApplication(NSEvent) sendEvent:]
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/PlugIns/platforms/libqcocoa.dylib +0x3e2da qt_plugin_instance
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x49f531 -[NSApplication _handleEvent:]
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit +0x2f62e -[NSApplication run]
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/PlugIns/platforms/libqcocoa.dylib +0x3ab3a qt_plugin_instance
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore +0x1e3857 _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore +0x1e7802 _ZN16QCoreApplication4execEv
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_lay.0.dylib +0x84b22 _ZN3lay14GuiApplication4execEv
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_lay.0.dylib +0x8313f _ZN3lay15ApplicationBase3runEv
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/MacOS/klayout +0x1318e
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_rba.0.dylib +0x1b77f _ZN3rba15RubyInterpreter10initializeERiPPcPFiS1_S3_E
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x174df3 rb_vm_fstring_table
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x16397c rb_vm_get_insns_address_table
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x171757 rb_vm_exec
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x603b0 ruby_exec_node
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.2.6.dylib +0x602b3 ruby_run_node
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/Frameworks/libklayout_rba.0.dylib +0x1b71a _ZN3rba15RubyInterpreter10initializeERiPPcPFiS1_S3_E
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/MacOS/klayout +0x12c54
/Applications/klayout-0.28.6-macOS-BigSur-1-qt5Brew-RsysPhb39.app/Contents/MacOS/klayout +0x127b4
/usr/lib/system/libdyld.dylib +0x15f3d start
That's bad ... the stack trace does not indicate anything specific.
Maybe it's worth trying other combinations. The PyQt5 integration that is needed by matplotlib complicates matters. It is very important that this module is built against the same Qt5 than KLayout is - if not, these kind of crashes are likely. In the Windows case I am using Python, PyQt5, matplotlib and Qt5 from the MSYS2 package manager. Same for Linux where everything comes from the Ubuntu repo in my case. That might explain why I do not see issues there.
Matthias
I tried KLayout 0.28.6 (source code release-build) on Linux Mint 20.3 with another combination. Valgrind output is attached (I hope it's useful). valgrind-klayout-0.28.6-linux.zip
Kazzz-S
CAEDS04{sekigawa}(1)$ uname -a
Linux CAEDS04 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
CAEDS04{sekigawa}(2)$ g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CAEDS04{sekigawa}(3)$ pip3 list | grep matplotlib
matplotlib 3.6.3 (installed by pip3)
CAEDS04{sekigawa}(4)$ python3
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
CAEDS04{sekigawa}(5)$ ./klayout -v
KLayout 0.28.6
================================================================================================================
CAEDS04{sekigawa}(6)$ valgrind --log-file=$HOME/temp/valgrind-klayout-0.28.6-linux.log \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
./klayout
Debug: using qt5ct plugin
Debug: D-Bus global menu: no
ERROR: ../../../src/lay/lay/layTechnologyController.cc,99,dispatcher == mp_dispatcher
terminate called after throwing an instance of 'tl::InternalException'
addr2line: DWARF error: section .debug_info is larger than its filesize! (0x93ef57 vs 0x530ea0)
================================================================================================================
<<< KLayout GUI Application >>>
(1) Start KLayout
(2) Run the above Python script in the IDE
(3) Save the plot ===> "Figure_1.png"
(4) Close matplotlib's plot window
(5) Close the IDE
(6) Close KLayout's main window
Then, crash
================================================================================================================
Signal number: 6
Address: 0x3e80002f823
Program Version: KLayout 0.28.6 (2023-03-21 r20c4e9c9c)
Backtrace:
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x2e9427 lay::enable_signal_handler_gui(bool) [??:?]
/lib/x86_64-linux-gnu/libc.so.6 +0x43090
/lib/x86_64-linux-gnu/libc.so.6 +0x4300b gsignal
/lib/x86_64-linux-gnu/libc.so.6 +0x22859 abort
/lib/x86_64-linux-gnu/libstdc++.so.6 +0x9e911
/lib/x86_64-linux-gnu/libstdc++.so.6 +0xaa38c
/lib/x86_64-linux-gnu/libstdc++.so.6 +0xa9369
/lib/x86_64-linux-gnu/libstdc++.so.6 +0xa9d21 __gxx_personality_v0
/lib/x86_64-linux-gnu/libgcc_s.so.1 +0x10bef
/lib/x86_64-linux-gnu/libgcc_s.so.1 +0x11281 _Unwind_RaiseException
/lib/x86_64-linux-gnu/libstdc++.so.6 +0xaa69c __cxa_throw
/home/sekigawa/GitWork/klayout/bin/libklayout_tl.so.0 +0x4b11a
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x296f3b
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x156cfc _ZN3lay14GuiApplicationD1Ev
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x156d7d _ZN3lay14GuiApplicationD0Ev
/usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-38-x86_64-linux-gnu.so +0x2110c1
/lib/x86_64-linux-gnu/libpython3.8.so.1.0 +0x25f34a
/lib/x86_64-linux-gnu/libpython3.8.so.1.0 +0x2a8840 PyVectorcall_Call
/lib/x86_64-linux-gnu/libpython3.8.so.1.0 +0x10d2e7
/lib/x86_64-linux-gnu/libpython3.8.so.1.0 +0x1935dd Py_FinalizeEx
/home/sekigawa/GitWork/klayout/bin/libklayout_pya.so.0 +0x44ac5 _ZN3pya17PythonInterpreterD1Ev
/home/sekigawa/GitWork/klayout/bin/libklayout_pya.so.0 +0x44afd _ZN3pya17PythonInterpreterD0Ev
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x14fb47 _ZN3lay15ApplicationBase8shutdownEv
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x156b90 _ZN3lay14GuiApplication8shutdownEv
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x156d0d _ZN3lay14GuiApplicationD1Ev
/home/sekigawa/GitWork/klayout/bin/libklayout_lay.so.0 +0x156d7d _ZN3lay14GuiApplicationD0Ev
./klayout +0x4ca2
/home/sekigawa/GitWork/klayout/bin/libklayout_rba.so.0 +0x23fc4
/usr/local/lib/libruby.so.3.1 +0x2b4e88
/usr/local/lib/libruby.so.3.1 +0x2c9f39
/usr/local/lib/libruby.so.3.1 +0x2ca804
/usr/local/lib/libruby.so.3.1 +0x2c3132
/usr/local/lib/libruby.so.3.1 +0x2c8d13 rb_vm_exec
/usr/local/lib/libruby.so.3.1 +0xdc5db
/usr/local/lib/libruby.so.3.1 +0xe298a ruby_run_node
/home/sekigawa/GitWork/klayout/bin/libklayout_rba.so.0 +0x24424 _ZN3rba15RubyInterpreter10initializeERiPPcPFiS1_S3_E
./klayout +0x487b
./klayout +0x3f9d
/lib/x86_64-linux-gnu/libc.so.6 +0x24083 __libc_start_main
./klayout +0x405e
================================================================================================================
Here are some more tests results.
Kazzz-S
[1] Using the distributed packages
CAEDS04{sekigawa}(1)$ python3
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'3.1.2'
>>> numpy.__version__
'1.17.4'
[1-A] plt.show(block=False)
- The plot did not show up.
- Outputs were printed immediately.
- No crash occurred when closing the KLayout's main window.
import matplotlib.pyplot as plt
import numpy as n
wavelength = n.array([1, 2, 3, 4, 5])
power = wavelength**2
plt.figure()
print(wavelength*1e9)
print(power)
plt.plot(wavelength*1e9, power)
plt.xlim((1*10**9,7*10**9))
plt.xlabel('Wavelength (nm)')
plt.ylabel('Transmission (dB)')
print("TEST1")
plt.show(block=False)
#plt.show(block=True) # <=== default
print("TEST2")
for i in range(0,10):
print("This text should show with the plot up")
[1.e+09 2.e+09 3.e+09 4.e+09 5.e+09]
[ 1 4 9 16 25]
TEST1
TEST2
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
[1-B] plt.show(block=True)
- The plot showed up.
- Outputs were printed immediately after closing the plot.
- No crash occurred when closing the KLayout's main window.
import matplotlib.pyplot as plt
import numpy as n
wavelength = n.array([1, 2, 3, 4, 5])
power = wavelength**2
plt.figure()
print(wavelength*1e9)
print(power)
plt.plot(wavelength*1e9, power)
plt.xlim((1*10**9,7*10**9))
plt.xlabel('Wavelength (nm)')
plt.ylabel('Transmission (dB)')
print("TEST1")
#plt.show(block=False)
plt.show(block=True) # <=== default
print("TEST2")
for i in range(0,10):
print("This text should show with the plot up")
[1.e+09 2.e+09 3.e+09 4.e+09 5.e+09]
[ 1 4 9 16 25]
TEST1
TEST2
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
[2] Using the packages installed by pip3 (the same as above)
CAEDS04{sekigawa}(1)$ python3
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> matplotlib.__version__
'3.6.3'
>>> import numpy
>>> numpy.__version__
'1.24.2'
>>>
[2-A] plt.show(block=False)
- The plot showed up.
- Outputs were printed immediately.
- Crash occurred when closing the KLayout's main window.
import matplotlib.pyplot as plt
import numpy as n
wavelength = n.array([1, 2, 3, 4, 5])
power = wavelength**2
plt.figure()
print(wavelength*1e9)
print(power)
plt.plot(wavelength*1e9, power)
plt.xlim((1*10**9,7*10**9))
plt.xlabel('Wavelength (nm)')
plt.ylabel('Transmission (dB)')
print("TEST1")
plt.show(block=False)
#plt.show(block=True) # <=== default
print("TEST2")
for i in range(0,10):
print("This text should show with the plot up")
[1.e+09 2.e+09 3.e+09 4.e+09 5.e+09]
[ 1 4 9 16 25]
TEST1
TEST2
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
[2-B] plt.show(block=True)
- The plot showed up.
- Outputs were printed immediately. That is,
blocking
was not effective. - Crash occurred when closing the KLayout's main window.
import matplotlib.pyplot as plt
import numpy as n
wavelength = n.array([1, 2, 3, 4, 5])
power = wavelength**2
plt.figure()
print(wavelength*1e9)
print(power)
plt.plot(wavelength*1e9, power)
plt.xlim((1*10**9,7*10**9))
plt.xlabel('Wavelength (nm)')
plt.ylabel('Transmission (dB)')
print("TEST1")
#plt.show(block=False)
plt.show(block=True) # <=== default
print("TEST2")
for i in range(0,10):
print("This text should show with the plot up")
[1.e+09 2.e+09 3.e+09 4.e+09 5.e+09]
[ 1 4 9 16 25]
TEST1
TEST2
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
This text should show with the plot up
@kazzz Thanks for the notes about behavior on Mint.
I could reproduce the problem, but only after fixing the backend to Qt5Agg:
# at the beginning of the script
import matplotlib
matplotlib.use('Qt5Agg')
without this, "TkAgg" is selected. In that case, no crash happens, but also no plot shows.
I debugged the problem and it is due to an unfriendly behavior of the PyQt5 version on Mint which takes ownership of the QApplication object and destroys it during the Python interpreter finalization. I do not see this behavior on the PyQt5 which comes with Ubuntu 22 in my case. That is why it does not crash.
Ubuntu 22 is using matplotlib 3.5.1 while Mint 20.3 is using 3.1.2.
I suspect the problem is due to this code in https://github.com/matplotlib/matplotlib/blob/v3.1.x/lib/matplotlib/backends/backend_qt5.py, line 94++:
# make place holder
qApp = None
def _create_qApp():
"""
Only one qApp can exist at a time, so check before creating one.
"""
global qApp # <-- on shutdown, this instance gets deleted probably
They changed this specific code somewhat in other versions, still the effect remains. If I use matplotlib from pip3 which is 3.7.1 still I see the crash on Mint while I don't see it on Ubuntu.
I also don't see the same effect on the MacOS stack traces, but I cannot really read them. Maybe it's the same thing or not.
Bottom line is that PyQt5 + matplotlib in KLayout isn't a stable combination apparently. It is very sensitive to details and after all, PyQt5 isn't made for embedding.
I tried "WebAgg" as an alternative backend, but the tornado server also needs to embed itself into the event loop of the application - which apparently it doesn't, so the application is dead.
SVG export comes to mind - instead of showing the plot interactively, one could display the SVG.
Another, more elaborate solution is to supply a custom backend that integrates with KLayout's Qt binding, hence operates in the framework of the application natively. The latter is pretty similar to PyQt5, so I think it should be possible to adapt the Qt5Agg backend with a few changes. There is a template for backend development available with a description how to use it: https://matplotlib.org/stable/api/backend_template_api.html. The core Qt backend code is here: https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/backends/backend_qt.py (it's imported via backend_qt5.py and backend_qt5agg.py). So basically that should be a feasible way to solve the problem once and for all. It's some effort though.
Best regards,
Matthias
I was able to do a quick port of the matplotlib backend to KLayout/Qt, but not without some modifications required in KLayout (bringing it closer to PyQt). The code is here: https://github.com/klayoutmatthias/mpl_klayoutqt
The changes are substantial (e.g. taking KLayout's Qt binding from Qt 5.5 to Qt 5.12). But I'll consider releasing it within the 0.28 branch. That will eventually allow the matplotlib backend to run natively inside KLayout and without PyQt and the potential side effects.