With poudriere and really large port builds (e.g. where a lot of ports need to be built at a given time), we’re getting build failures where the shell actually blows up, e.g.:
...
py-lxml devel/py-daemon sysutils/py-psutil sysutils/nut graphics/png graphics/graphite2 www/py-requests emulators/mtools dns/py-bonjour math/py-networkx www/py-ws4py textproc/py-libxml2 net/py-pysphere devel/py-rose devel/qt5-core graphics/php55-gd devel/py-mimeparse www/py-flask-bootstrap www/mod_mpm_itk security/sudo devel/py-jsonpointer security/py-openssl devel/py-simplejson net/smbldap-tools ftp/proftpd www/node net/ladvd devel/py-pyee benchmarks/iozone sysutils/tmux net/trafshow devel/py-ipaddr sysutils/hptcli net-mgmt/sipcalc graphics/cairo shells/mksh comms/lrzsz www/py-flup sysutils/screen freenas/freenas-10gui devel/git print/harfbuzz devel/goprintf: write error on stdout
With a little DTracing, we figured out that /bin/sh is using non-blocking I/O on stdout to work around some threading issues (apparently, FreeBSD’s pthread library, at some point, blocked background threads talking to stdout because of limitations in the implementation that may or may not even still exist) and because it’s non-blocking, write(2) can return EAGAIN in cases of temporary buffer overrun. The fix, as ugly as it looks, is to simply sleep for a bit and try again.