LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 688 - bugpoint should fork processes with sane limits
Summary: bugpoint should fork processes with sane limits
Status: RESOLVED FIXED
Alias: None
Product: tools
Classification: Unclassified
Component: bugpoint (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: Anton Korobeynikov
URL:
Keywords: new-feature
Depends on:
Blocks:
 
Reported: 2006-01-11 23:44 PST by Duraid Madina
Modified: 2007-09-26 01:35 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duraid Madina 2006-01-11 23:44:05 PST
When bugpoint runs something (gcc, or a probably-broken bit of code), it should
have some limits on disk and memory usage set, to add a bit of determinism and
be more polite. I just went through a bugpoint run where the code in question
was failing by exhausting swap - worked fine, just took 20x longer than it
should have.

This issue will probably become more serious if and when bugpoint gets
multithreaded.
Comment 1 Reid Spencer 2006-01-12 00:38:30 PST
I would argue that such things are outside the scope of LLVM. If you want to
limit bugpoint's cpu/memory/disk, you should be able to do that prior to
invoking bugpoint from the environment of the operating system. I don't think we
should implement this unless there is a strong counter-argument.
Comment 2 Chris Lattner 2006-01-12 00:43:01 PST
I don't really agree.  Bugpoint can run for a long time and potentially consume a lot of time and memory.  
The executed programs, however, should have well known time/space requirements that we want to 
contain should they spin out of control.

-Chris
Comment 3 Reid Spencer 2006-01-12 01:28:27 PST
okay, care to define those limits? isn't the limit somewhat dependent on the input?

and, what about gccld, llvm-ld, or other programs which might execute for a whlie?

if we have to support this feature, then we have to do it on all platforms .. is
it worth the effort?
Comment 4 Chris Lattner 2006-01-12 01:32:39 PST
I think that having bugpoint default to large but reasonable limits (e.g. 100M of memory and 1 minute of 
run time), but allowing command line options to change the default is best.

Hosts that don't support the "setlimit" family of functions can just ignore the request.

-Chris 
Comment 5 Anton Korobeynikov 2007-02-16 02:06:55 PST
Seems to be easy to add. Are there "setrlimit" call on Darwin?
Comment 6 Chris Lattner 2007-02-16 11:32:11 PST
Yep, darwin has setrlimit,

-Chris
Comment 7 Chris Lattner 2007-02-16 11:33:39 PST
One thing that I recently noticed is that the --timeout=N value only applies to the program when it is 
being run.  It does not apply to tool executions like llc or bugpoint when it forks itself to run 
optimizations.

-Chris
Comment 9 Chris Lattner 2007-02-16 13:23:12 PST
Very nice!

Can you also investigate making sub-invocations of llc respect -timeout? If llc goes into an infinite loop, 
bugpoint can't help.  An easy way to test this is to add "while (1);" to llc's main, then do bugpoint-llc on 
something.  bugpoint should reduce it down to a single empty function.

-Chris
Comment 10 Chris Lattner 2007-09-26 01:35:32 PDT
anton implemented this.