[launchd-dev] resource limits

Dave Zarzycki zarzycki at apple.com
Wed Jul 18 07:00:05 PDT 2007


Not all limits are enforced on Mac OS X at the moment…


On Jul 17, 2007, at 3:23 PM, Greg Dingle wrote:

> Hi Davez,
>
> I got around to trying ulimit just now and I got it to work with the  
> max filesize but not any of the memory options, which is what I  
> really need. I tried all of:
>
> ulimit -m 1000
> ulimit -l 1000
> ulimit -v 1000
>
> ...then started programs that use more than 1 meg of memory with no  
> effect. I expected to get an error message or some evidence in top.  
> Is there something that I should know about ulimit on Mac OS? I  
> searched google with no success.
>
> Greg
>
> On 9-Jul-07, at 1:43 PM, Dave Zarzycki wrote:
>
>> Syntactically, what you added to your property list is correct. The  
>> bug in launchd (fixed in Leopard) is difficult to explain. I think  
>> the most pragmatic thing to do on a Tiger based system is to do is  
>> wrap the daemon in a quick shell script and have it adjust the  
>> resource limit you want. For example:
>>
>> #!/bin/sh
>>
>> ulimit -c 0
>>
>> exec /usr/sbin/serverd
>>
>>
>>
>>
>> davez
>>
>>
>>
>> On Jul 9, 2007, at 1:38 PM, Greg Dingle wrote:
>>
>>> No, sorry, can't wait until Leopard. I want to use the resource  
>>> limits for a program currently running on a production server.
>>>
>>> What is thing that is easily confused? I have tried both soft/hard  
>>> limits -- that is not what you mean, is it? Is the implementation  
>>> actually broken? I thought somebody here could just clarify the  
>>> form for setting the limits.
>>>
>>> Greg
>>>
>>> On 9-Jul-07, at 1:28 PM, Dave Zarzycki wrote:
>>>
>>>> Sadly, in retrospect, it looks like the soft/hard limit code in  
>>>> Tiger (not Leopard) contains an easily confusable implementation.  
>>>> Can you wait until Leopard?
>>>>
>>>> davez
>>>>
>>>>
>>>> On Jul 9, 2007, at 11:00 AM, Greg Dingle wrote:
>>>>
>>>>> The build is 10.4.10.
>>>>>
>>>>> On 9-Jul-07, at 9:20 AM, Dave Zarzycki wrote:
>>>>>
>>>>>> Which build of the OS?
>>>>>>
>>>>>>
>>>>>> On Jul 7, 2007, at 4:16 PM, Greg Dingle wrote:
>>>>>>
>>>>>>> Hi, I'm just trying to get the resource limits working with  
>>>>>>> launchd and a plist. Whatever I try I get a segmentation fault.
>>>>>>>
>>>>>>> I've tried with an empty dict:
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd 
>>>>>>> ">
>>>>>>> <plist version="1.0">
>>>>>>> <dict>
>>>>>>> 	<key>Label</key>
>>>>>>> 	<string>TEST</string>
>>>>>>> 	<key>OnDemand</key>
>>>>>>> 	<false/>
>>>>>>> 	<key>ProgramArguments</key>
>>>>>>> 	<array>
>>>>>>> 		<string>/bin/ls</string>
>>>>>>> 	</array>
>>>>>>> 	
>>>>>>> <key>SoftResourceLimits</key>
>>>>>>> <dict>
>>>>>>> </dict>
>>>>>>> 	
>>>>>>> </dict>
>>>>>>> </plist>
>>>>>>>
>>>>>>> And also with some dummy values:
>>>>>>>
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd 
>>>>>>> ">
>>>>>>> <plist version="1.0">
>>>>>>> <dict>
>>>>>>> 	<key>Label</key>
>>>>>>> 	<string>TEST</string>
>>>>>>> 	<key>OnDemand</key>
>>>>>>> 	<false/>
>>>>>>> 	<key>ProgramArguments</key>
>>>>>>> 	<array>
>>>>>>> 		<string>/bin/ls</string>
>>>>>>> 	</array>
>>>>>>> 	
>>>>>>> <key>SoftResourceLimits</key>
>>>>>>> <dict>
>>>>>>>         <key>Core</key>
>>>>>>>         <integer>10000000000</integer>
>>>>>>>
>>>>>>>         <key>CPU</key>
>>>>>>>         <integer>10000000000</integer>
>>>>>>>
>>>>>>>         <key>Data</key>
>>>>>>>         <integer>10000000000</integer>
>>>>>>>
>>>>>>>         <key>FileSize</key>
>>>>>>>         <integer>10000000000</integer>
>>>>>>>
>>>>>>>         <key>MemoryLock</key>
>>>>>>>         <integer>10000000000</integer>
>>>>>>>
>>>>>>>         <key>NumberOfFiles</key>
>>>>>>>         <integer>8192</integer>
>>>>>>>
>>>>>>>         <key>NumberofProcesses</key>
>>>>>>>         <integer>150</integer>
>>>>>>>
>>>>>>>         <key>ResidentSetSize</key>
>>>>>>>         <integer>100000000</integer>
>>>>>>>
>>>>>>>         <key>Stack</key>
>>>>>>>         <integer>10000</integer>
>>>>>>> </dict>
>>>>>>> 	
>>>>>>> </dict>
>>>>>>> </plist>
>>>>>>>
>>>>>>> Do I at least have the format correct? I couldn't find any  
>>>>>>> examples with google to work from.
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Greeg
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> launchd-dev mailing list
>>>>>>> launchd-dev at lists.macosforge.org
>>>>>>> http://lists.macosforge.org/mailman/listinfo/launchd-dev
>>>>>>
>>>>>
>>>>
>>>
>>
>



More information about the launchd-dev mailing list