tmplt / bookwyrm

ncurses utility for downloading publicly available ebooks, plugin support
MIT License
32 stars 5 forks source link

uncaught std::runtime_error some times when exiting tui #35

Closed tmplt closed 6 years ago

tmplt commented 6 years ago

Sometimes when terminating, an std::runtime_error is thrown from the a Python thread. This is because of commit ac409a99313fd27ace37db51a10525d9724ce191 where the threads are all detached - instead of having to wait on them.

Pybind11's Gitter chat confirmed that this is a known problem with multithreading.

I'll see if I can find a way to catch this exception.

tmplt commented 6 years ago

Trying to catch the exception where it is thrown leads instead to another backtrace, this one all in library code. I'll see if I can re-create this and submit an issue to pybind11.

For now, this isn't a big problem, but we don't want uncatched exceptions in release code.

tmplt commented 6 years ago

The easiest way to debug this is probably to write a dead simple cli and remove code piece-wise until either the offending code is found or the bug is fixed.

tmplt commented 6 years ago

The issue has been localized to a dummy frontend. Next up is investigating how much we can strip before the error disappears — and if it persists, submit an issue upstream.

tmplt commented 6 years ago

The unit-test does not crash on my NixOS system.

tmplt commented 6 years ago

The unit-test does not crash on another Arch Linux system.

tmplt commented 6 years ago

Mayhap interesting observation: this issue can be reproduced on the offending system if bookwyrm is compiled in a pure Nix environment, event though ldd src/bookwyrm only yield libraries from the Nix store.

This issue must be tested on more systems before I'm comfortable with closing this.

tmplt commented 6 years ago

This issue is now reproducable on my NixOS system by just quitting the TUI while items are being added. Can some times be reproduced via

$ src/bookwyrm -t 'some title' <<< q

àla #50.

tmplt commented 6 years ago

An issue has been created upstream at https://github.com/pybind/pybind11/issues/1358.