Collapse of nonaxisymmetric cavities