The -maxconnections=N command line argument is meant to limit the total number of connections to N. It reserves 8 (or less, if N<8) slots for outgoing connections, and is meant to allow N-8 incoming connections. But the calculation is slightly wrong, and the existing outgoing connections are counted twice.
This fixes it.