Start two mysql sessions. Type those commands one at a time into each session in parallel.
S1: select max(id)+1 from table; <- assign to i1
S2: select max(id)+1 from table; <- assign to i2
S1: Insert into table (id, txt) values (i1,'info');
S2: Insert into table (id, txt) values (i2,'moreinfo');
You should now get an error on a duplicate key on the second query.
this is a race condition. It's a pain in the ass to troubleshoot, only shows up just often enough to screw things up for a second then disappears for another month or two.
and they become more common as load increases. I.e. they're harder to find in testing, and impossible to find if you don't test with parallel threads.