Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/adjust signal handling #265

Merged
merged 2 commits into from
Apr 21, 2020
Merged

fix/adjust signal handling #265

merged 2 commits into from
Apr 21, 2020

Conversation

benlorenz
Copy link
Member

@benlorenz benlorenz commented Apr 21, 2020

This contains:

  • dont capture sigint from polymake (as it completely blocks it for julia)
  • use different signal for initalization of polymake Main.pm (otherwise julia terminates instantly on ctrl+c)
  • warn on ctrl+c during polymake computation

Fixes #233

Further ideas:

  • Maybe we could add a similar warning for polymake_call_function.
  • We should get julia to not interrupt polymake but that doesn't seem feasible at the moment.

Currently behaves like this, including the segfault during exit (when Ctrl+C was used to abort polymake at some point):

julia> using Polymake
polymake version 4.0
Copyright (c) 1997-2020
Ewgenij Gawrilow, Michael Joswig, and the polymake team
Technische Universität Berlin, Germany
https://polymake.org

This is free software licensed under GPL; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


julia> s = polytope.rand_sphere(15, 1000);

julia> s.VERTICES
^C┌ Warning: Interrupting polymake is not safe.
│ You are entering the dark forest of memory corruption in the valley segfaults, bring your 🏹, ⚔︎ and 🛡︎.
│ Please restart your julia session if you encounter any weird stuff.
└ @ Polymake ~/software/polymake/julia/Polymake-glibcxx.jl/src/perlobj.jl:45
ERROR: InterruptException:
Stacktrace:
 [1] internal_give(::Polymake.BigObjectAllocated, ::String) at /home/lorenz/.julia/packages/CxxWrap/LfTHV/src/CxxWrap.jl:597
 [2] give(::Polymake.BigObjectAllocated, ::String) at /home/lorenz/software/polymake/julia/Polymake-glibcxx.jl/src/perlobj.jl:41
 [3] getproperty(::Polymake.BigObjectAllocated, ::Symbol) at /home/lorenz/software/polymake/julia/Polymake-glibcxx.jl/src/perlobj.jl:58

julia> exit()

signal (11): Segmentation fault
in expression starting at REPL[5]:0
Segmentation fault

dont capture sigint from polymake (as it completely blocks it for julia)
use different signal for initalization of polymake Main.pm (otherwise julia terminates instantly on ctrl+c)
warn on ctrl+c during polymake computation

fixes #233
@benlorenz benlorenz requested a review from kalmarek April 21, 2020 20:11
kalmarek
kalmarek previously approved these changes Apr 21, 2020
Copy link
Contributor

@kalmarek kalmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ❤️ 🏹 ⚔️ and 🛡️ :)

src/perlobj.jl Outdated Show resolved Hide resolved
@benlorenz
Copy link
Member Author

Unfortunately my terminal (urxvt) doesn't show them, I guess it is time to switch now.
Needed to fix a typo, can you approve once more please.

@kalmarek
Copy link
Contributor

isn't this more a problem of the font?

maybe this suits your needs? https://github.com/Swordfish90/cool-retro-term :D

@benlorenz benlorenz merged commit c5d2299 into master Apr 21, 2020
@benlorenz benlorenz deleted the signals branch April 24, 2020 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

signal handler
2 participants