Mobs trapped in Minecarts are able to leave them when you exit and re-enter the game, this causes extreme annoyance or overengineering of breeding machines and some kinds of farms.
Developers showed interest in fixing this issue in the past.
Linked issues
Comments 4
Then, MC-814 should be re-opened as it´s not working.
Duplicate of [MC-814]