Opened 12 years ago

Closed 12 years ago

#35612 closed defect (fixed)

proctools: bsdmake: setrlimit: Invalid argument

Reported by: chuckmcknight@… Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc: akitada@…
Port: bsdmake proctools

Description

Was able to build manually by running the bsdmake at the command line and doing the build and install separately. The port command fails (see log below):

Attachments (3)

main.log (4.2 KB) - added by chuckmcknight@… 12 years ago.
main.2.log (15.0 KB) - added by chuckmcknight@… 12 years ago.
patch-main.c.diff (439 bytes) - added by ajdudman 12 years ago.
setrlimt patch

Download all attachments as: .zip

Change History (13)

Changed 12 years ago by chuckmcknight@…

Attachment: main.log added

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to akitada@…
Summary: Can't build proctors on Lion 10.7.4 / Xcode 4.4.1 (4F1003)proctools: bsdmake: setrlimit: Invalid argument

The log says:

bsdmake: setrlimit: Invalid argument

Since this was not a clean attempt, please "sudo port clean proctools", then try again, then attach the new main.log. It builds fine for me on Mountain Lion.

Changed 12 years ago by chuckmcknight@…

Attachment: main.2.log added

comment:2 Changed 12 years ago by chuckmcknight@…

Ran sudo port clean proctools, the sudo port install proctors (see attached log main.2.log)

comment:3 Changed 12 years ago by chuckmcknight@…

I hate auto-correct...

Should say:

Ran sudo port clean proctools, then ran sudo port install proctools (see attached log main.2.log).

comment:4 Changed 12 years ago by jmroot (Joshua Root)

Cc: akitada@… added
Owner: changed from akitada@… to raimue@…
Port: bsdmake added

I can't reproduce this on my 10.7 system, but it looks like the problem is actually in bsdmake.

comment:5 Changed 12 years ago by raimue (Rainer Müller)

There is only one call to setrlimit in bsdmake, which is at the beginning of main (line 751). According to the man page for setrlimit(2), valid values for the rlim_cur should be in the range from 0 to rlim_max. I could only think of a problem here if the second branch in the Apple related branch is taken which sets rlim_cur = OPEN_MAX. With a configuration such that OPEN_MAX > rlim_max this would be an invalid value.

Do you have any special configuration for the maximum number of open files on your system?

Last edited 12 years ago by raimue (Rainer Müller) (previous) (diff)

comment:6 Changed 12 years ago by chuckmcknight@…

No special configs that I'm aware of. "ulimit -a" gives:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 8192
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

comment:7 Changed 12 years ago by raimue (Rainer Müller)

On my Mac OS X 10.8.2 build 12C54, ulimit -a returns the following list:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

So given that my system returns 256 and your system has 8192, there seems to be a different configuration. I will try to reproduce the issue and hopefully manage to patch bsdmake for this.

Changed 12 years ago by ajdudman

Attachment: patch-main.c.diff added

setrlimt patch

comment:8 Changed 12 years ago by ajdudman

I also get a setrlimit: Invalid argument execution error. My hard and soft open files limits are 10240 and 12288, because my /etc/launchd.conf setting "limit maxfiles 10240 12288". I find setting rlim_max = rlim_cur = OPEN_MAX works.

comment:9 Changed 12 years ago by ajdudman

The idea for the fix came from the discussion at http://old.tbamud.com/forum/thread/873.

comment:10 Changed 12 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: newclosed

Thank you very much for providing the patch! I never came around to do it myself.

Committed in r105220.

Note: See TracTickets for help on using tickets.