New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #35612 (closed defect: fixed)

Opened 9 months ago

Last modified 5 weeks ago

proctools: bsdmake: setrlimit: Invalid argument

Reported by: chuckmcknight@… Owned by: raimue@…
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

main.log (4.2 KB) - added by chuckmcknight@… 9 months ago.
main.2.log (15.0 KB) - added by chuckmcknight@… 9 months ago.
patch-main.c.diff (439 bytes) - added by ajdudman@… 5 weeks ago.
setrlimt patch

Change History

Changed 9 months ago by chuckmcknight@…

comment:1 Changed 9 months ago by ryandesign@…

  • Owner changed from macports-tickets@… to akitada@…
  • Summary changed from Can't build proctors on Lion 10.7.4 / Xcode 4.4.1 (4F1003) to 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 9 months ago by chuckmcknight@…

comment:2 Changed 9 months ago by chuckmcknight@…

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

comment:3 Changed 9 months 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 8 months ago by jmr@…

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

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

comment:5 Changed 8 months ago by raimue@…

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 8 months ago by raimue@… (previous) (diff)

comment:6 Changed 8 months 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 8 months ago by raimue@…

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 5 weeks ago by ajdudman@…

setrlimt patch

comment:8 Changed 5 weeks 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 5 weeks ago by ajdudman@…

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

comment:10 Changed 5 weeks ago by raimue@…

  • Status changed from new to closed
  • Resolution set to fixed

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.