Too many connections — part I will explain. On myisam you can't do it as you described. Active block selects the entire table and the inserts are waiting for the lock. So, if your select stopped for a second, then your data in the queue has already gotten 1000 inserts. Here you have too many connections.
Switch to InnoDB, it is slow, but there is blocking at the row level and failure, she recovered well.
Better to make one extended insert 1000 rows than 1000 inserts one row. Think about it.