# Building glib 2.26.1 gives a kernel forkbomb



## OH (Nov 22, 2010)

Building glib 2.26.1 I get the following:

```
Making all in tests
gmake[4]: Map '/usr/ports/devel/glib20/work/glib-2.26.1/glib/tests' wordt binnengegaan
/bin/sh /usr/ports/devel/glib20/work/gnome-libtool  --tag=CC   --mode=link gcc45  -O2
-pipe -fno-strict-aliasing -Wall  -L/usr/local/lib -lintl -o protocol protocol.o
../../glib/libglib-2.0.la  
/bin/sh /usr/ports/devel/glib20/work/gnome-libtool  --tag=CC   --mode=link gcc45  -O2
-pipe -fno-strict-aliasing -Wall  -L/usr/local/lib -lintl -o rand rand.o 
../../glib/libglib-2.0.la  -lm 
/libexec/ld-elf.so.1: /libexec/ld-elf.so.1: Cannot open "/lib/libedit.so.7"Cannot open "/lib/libc.so.7"

/libexec/ld-elf.so.1: Cannot open "/lib/libutil.so.8"
.//printf: cannot create /dev/null: Too many open files in system
/libexec/ld-elf.so.1: Cannot open "/lib/libedit.so.7"
.//printf: Pipe call failed: Bad file descriptor
.//printf: Pipe call failed: Bad file descriptor
.//printf: cannot create /dev/null: Too many open files in system

GLib-ERROR **: failed to create pipes to fork test program: Too many open files in system
aborting...
.//printf: Pipe call failed: Bad file descriptor
.//printf: Pipe call failed: Bad file descriptor
.//printf: Pipe call failed: Bad file descriptor

GLib-ERROR **: failed to create pipes to fork test program: Too many open files in system
aborting...
/libexec/ld-elf.so.1: Cannot open "/lib/libc.so.7"
cd: can't cd to /snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/snprintf
/printf
Abort trap (core dumped)
/libexec/ld-elf.so.1: /libexec/ld-elf.so.1: Cannot open "/lib/libedit.so.7"Cannot open "/lib/libc.so.7"
```

And so on. Ctrl-C usually stops it, although one time I had to reboot the computer to stop it forking.

Trying the build on the console I get some extra warnings:

```
Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max sysctl
maxproc limit exceeded by uid 0, please see tuning(7) and login.conf(5)
```

See this screen shot for more context.

ps shows a lot of these:

```
/usr/bin/sed s%/[^/]*$%%
```
and these (about 4 or 5 times as many)

```
/bin/sh .//printf %\\n .//printf
```

My /etc/make.conf was empty until I tried with GCC45, which did not fix the problem. Of course I also tried doubling the mentioned sysctl's and openfiles too, as expected though, this had no result either.

Any idea to what's going on?


----------



## SirDice (Nov 23, 2010)

Fix the error, not the effect of it:

```
/libexec/ld-elf.so.1: /libexec/ld-elf.so.1: Cannot open "/lib/libedit.so.7"Cannot open "/lib/libc.so.7"
```


----------



## OH (Nov 24, 2010)

SirDice said:
			
		

> Fix the error, not the effect of it:
> 
> ```
> /libexec/ld-elf.so.1: /libexec/ld-elf.so.1: Cannot open "/lib/libedit.so.7"Cannot open "/lib/libc.so.7"
> ```



Actually that is an effect, reaching the limits of my machine it won't let me open any more files.

Thanks to an equal environment (which by the way is 8.1-RELEASE-P1 amd64, apologies for not mentioning it before) in a virtualbox I have found the problem. The cause turns out to be running the build with a bash shell. Simply executing

```
/bin/csh
```

ahead of the build solved the issue!


----------



## SirDice (Nov 24, 2010)

Just an FYI, don't change root's shell. Leave the default. If you don't you will run into trouble as soon as you upgrade to the next major version of FreeBSD.


----------



## OH (Nov 24, 2010)

I know I shouldn't (the virtual environment used the standard, that's how I tracked it down) but this is the first time in many years that it actually causes a problem.


----------

