Another response, clarifying the issue. I was incorrect about the mail-list 
archive: it's on zsh-workers, not -users:
http://www.zsh.org/mla/workers/2007/msg00200.html

> Works as I'd expect from your man page quote here:
> 
> $ time zsh -c 'ulimit -t 0; while :; do :; done'
> zsh: cpu limit exceeded  zsh -c 'ulimit -t 0; while :; do :; done'
> zsh -c 'ulimit -t 0; while :; do :; done'  0.72s user 0.28s system 95% cpu 
> 1.050 total
> $ time bash -c 'ulimit -t 0; while :; do :; done'
> zsh: killed     bash -c 'ulimit -t 0; while :; do :; done'
> bash -c 'ulimit -t 0; while :; do :; done'  1.00s user 0.00s system 95% cpu 
> 1.047 total
> $ uname -a
> Linux sc.homeunix.net 2.6.21-rc4 #1 PREEMPT Sun Mar 25 15:39:31 BST 2007 i686 
> GNU/Linux
> ~$ uname -rs
> Linux 2.6.21-rc4

Yes, I get those same results. However, in an interactive shell:

% ulimit -t 0
% ( ulimit -t; while :; do :; done )
0
<< watch the CPU time used climb in top >>
^C
%
...
% ulimit -Ht 0
% ( ulimit -t; while :; do :; done )
0
zsh: killed     (; ulimit -t; while :; do; :; done; )
%

My first thought was: is zsh blocking SIGXCPU in some circumstances? But
killing the process with kill -XCPU worked fine.

It therefore appears  that while the man page is correct for hard limits,
soft limits of 0 are still treated as unlimited.

** Summary changed:

- setrlimit can unlimit CPU by setting to 0 seconds
+ setrlimit can unlimit CPU by setting to 0 seconds (soft limits only)

** Also affects: Debian
   Importance: Undecided
       Status: Unconfirmed

-- 
setrlimit can unlimit CPU by setting to 0 seconds (soft limits only)
https://bugs.launchpad.net/bugs/107209
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to