Hi Andreas,

I finally managed to create a simple jupyter notebook that reliably crashes the kernel on my mac. It creates NannyEvents in a thread that get collected by the garbage collector. 
Strangely, when transforming it into a python script, it does not crash anymore.

https://gist.github.com/geggo/d9b4016ff5b77dab262be7b30a98d862

best
Gregor



Am 03.10.2018 um 02:07 schrieb Andreas Kloeckner <lists@informa.tiker.net>:

Gregor Thalhammer <gregor.thalhammer@gmail.com> writes:
The error message reported in the headline stems from clear-instance https://github.com/pybind/pybind11/blob/177713fa4ea49c5594b5568279757f22354fa000/include/pybind11/detail/class.h#L324
As I understood there an unhandled exception is raised that leads to a program exit. On my Mac the crash is actually reported in the main thread, on windows in the same Thread that calls clear_instance, some levels further down. Could give more details on this tomorrow.

I'm still a little lost here. If you could create a minimal example
(involving threads) that shows the crash, I think that would drastically
increase our odds of figuring out what's going on here.
Thanks for your help, I am lost too, have little experience in
debugging compiled code. But I will try to create a simpler
example. My first attempts already failed to create NannyEvents that
are collected by the garbage collector. Any advice on how to
accomplish this step?

NannyEvents hold a reference to the buffer, so if the buffer is
something that in turn references the event, you should have a cycle.

Andreas