Check for ENOSPC conditions at startup

Cherry-pick to 1.7.

Closes #394