vsespb has asked for the wisdom of the Perl Monks concerning the following question:
Recently I found that if I run:
on modern linux box, whole system locks - keyboard, mouse does not work.perl -e 'sub x { x() }; x()'
I asked several people to reproduce the problem. Also tested on virtual machine.
So, Ubuntu 12.04 - not affected at all. Can terminate script by Ctrl-C.
Ubuntu 16.04 - locks up. Only chance to quit is to power off the machine (or wait till it fills all memory; or maybe REISUB - didn't try this ). I reported this a bug to Ubuntu team. They confirmed that 16.04 indeed locks up.
Debian (7 or 8, dont remember) is less responsive than Ubuntu 12.04, but still can quit.
One person told that Fedora (I suspect modern) locks up too.
MacOSX not affected.
Ubuntu team qualified this bug report as perl problem (well, that does not necessary means that it will be considered as valid bug), I was going to object, but interesting thing, indeed, not every programming language can cause such trouble. I tried Ruby an C, they use C-stack thus simply run out of stack very fast and nothing bad happens.
Question: do you have any thoughts why modern OSes are not friendly to persons running buggy perl code (perhaps it's a developer, who debugs the code)? Maybe perl uses some memory allocation which is not "compatible" with modern kernels? Maybe linux kernel changed some defaults, related to process priorities? How linux can be tuned to avoid this (tried nice and ionice - does not help)?
Solution to install SIG WARN and terminate on "Deep recursion" is understood.
|
---|