# portmaster causes hanging process



## da1 (Apr 13, 2011)

Hi guys,

System:
amd64 8.2 release.

I was in the process of upgrading ALL ports (http://forums.freebsd.org/showthread.php?t=23159) when, for the 3rd or 4th time, portmaster hanged, slowing down my box really bad.
What happens is that portmaster is running, and then, it stops doing anything (usually after finishing to install a package (no particular package) the longest, I waited 30 min) in which time, the system is really slow at response time. I checked the CPU plus the disks usage and both were at a all time low. A new ssh connexion takes ~1 min or more when normally it doesn't take more than 2 seconds. "CTRL+C" does not cancel the portmaster process, even if the software itselfs displays "build terminated" message (it acknowledges the ctrl+c cmd). At this point, I just "kill -9" the portmaster process and the ssh connexion (this is after waiting a long time). Then, "reboot" does nothing (I mean ... NOTHING!!!). The only way around is to do "shutdown (-r) now" which works, to some extent.

It works to the point that I get (on the local screen) "some processes would not die: ps axl advised" and hangs there . Each time, I have to call the on-site support guy to hard reset the box.


Going slightly mad here ...


PS: Didn't try "CTRL+T", didn't come to mind at that point, but I will try it next time.


----------



## phoenix (Apr 13, 2011)

If you CTRL+T (or `$ kill -INFO`) the portmaster process, you'll see what it's doing.  I'm guessing it's either registering the installation of the package (filling in the /var/db/pkg/<portname>/+* files), or it's updating the dependency information in all the other /var/db/pkg/<portname>/+REQUIRED_BY files.  And/or it's creating a backup package of the port (if you have *-b* and similar options on the commandline or in /usr/local/etc/portmaster.rc.

All of the above processes are extremely I/O intensive, so it may cause the box to slowdown, if you try to do anything requiring I/O (like reading the passwd file during an SSH login, or bringing up a shell, etc).  This is why I always run portmaster (and portupgrade, and regular port installs, and pkg_add, etc) like so, when I'm doing other things on the box at the same time:
`# /usr/bin/nice -n 10 sudo portmaster yadda yadda yadda`

If you really want to see what it's doing, then edit /usr/local/sbin/portmaster and change the shebang line to *#!/bin/sh -x*.

Using sysutils/tmux will also show you the currently running command in the status bar, so you can see as it flips between portmaster, sha256, bsdtar, pkg_info, pkg_add, find, bzip2, make, cc, etc, etc, etc.


----------



## jb_fvwm2 (Apr 14, 2011)

Some ports useup memory heavily despite manual builds or portmaster.  For instance, if a program uses wxgtk-something, I'd be wary of loading lots of tabs in a browser while it compiles.  For this reason, I advocate only upgrading a few ports at a time, for easier recovery, continuation, etc 
	
	



```
portmaster -d -B -P /var/db/pkg/port- /var/db/pkg/port- && yell
```
 or one could even install ttyload to watch CPU usage if a speaker is not connected/working to the motherboard. UPGRADING evolved from only a few thousand ports in the ports tree, caution is advised if one has more than a few hundred ports installed;  my opinion anyway.


----------



## da1 (Apr 14, 2011)

@jb_fvwm2: I was manually building the "celt" port yesterday around 7pm and today (8am) after killing all portmaster processes and also the ssh session that started it, the box is still slow (I'm guessing I have a hang process somewhere, which I can;t track down).


----------



## jb_fvwm2 (Apr 15, 2011)

```
top && pstree | less
```
 to investigate further?


----------



## da1 (Apr 15, 2011)

Nothing out of the ordinary ....


----------

