My friendly mobs are disappearing, what can cause this?

Recently I build a kind of a zoo in my single player MineCraft world. My goal was to display most (if not all) mobs in the game. Each mob is named using a name tag to prevent despawning and each mob is placed in their own cage (a well lit, 5x5x5 blocks room). After I filled the first few cages with friendly mobs and came back (relogged) some of the cages were empty. Specifically my cow, sheep and pig were missing. Having still plenty of name tags, I rounded up a new cow, sheep and pig, named them and put them in their cage. Some while later (a couple of days, so I logged on again) my cow cage was empty yet again.
I am very sure I've named the mobs that disappeared correctly (I don't know if you even can do it other then correctly). The cages have plenty of room and are well lit and since I've not found the missing mobs roaming around, I highly doubt they have escaped. Since hostile mobs don't attack friendly mobs, I also rule that out as a cause.
Does anyone have an idea on why these mobs disappear? And, if you do, how I can prevent it or fix it?
Note: The world was created in 1.7.1 and is now running in 1.8.10.
Best Answer
I had this almost exact same problem in my 1.13.2 world, and what worked for me was giving them all different name tags. I don't know why but when I named one sheep "Sheep1" and another "Sheep2" they didn't despawn. I don't know if this will help you as I am in a different version, but if worst comes to worst you can attach them to a fence using a lead. That also fixed my problem.
Pictures about "My friendly mobs are disappearing, what can cause this?"



Why do my mobs keep disappearing?
In most cases, a mob will despawn immediately if there are no players within a distance of 128 blocks. If it's not within 32 blocks of a player for more than 30 seconds, there's a 1\u2044800 chance each game tick it will despawn (2.47% chance per second).Why are my Minecraft mobs disappearing?
Edit by SuperGeniusZeb: When playing on multiplayer, entities can despawn when you travel to the Nether and back to the Overworld. Keep in mind that naturally-spawned monsters and animals that have never been interacted with are SUPPOSED to despawn.Can friendly mobs Despawn?
Luckily, passive mobs like cows, pigs, chickens, etc. will not despawn while a player is logged into a server. This goes for passive nether mobs as well like striders. However, passive mobs could possibly end up disappearing if a player logs out and comes back later.Do friendly mobs Despawn in Minecraft?
Passive mobs will never despawn (except chickens originally spawned as chicken jockeys, which will follow zombie despawning rules)Red Hot Chili Peppers - Aeroplane [Official Music Video]
More answers regarding my friendly mobs are disappearing, what can cause this?
Answer 2
Monsters (not holding items or wearing armor) and squid (but not animals), including hostile wolves as of 1.1, can cease to exist, or "despawn", under certain conditions:
A mob that has had no player within 32 blocks of it for more than 30 seconds has a 1 in 800 chance of despawning on each game tick (1/20th of a second). Therefore, the half-life of monsters not within 32 blocks of a player is 27.73 seconds (after the initial 30 seconds have elapsed).
A mob will immediately despawn if there is no player within 128 blocks of it. Note that this is a Euclidean sphere, not a cylinder from map top to bottom and not a taxicab sphere (which is more like an octahedron). Example: A mob at 0/y/0 will remain at least 30 seconds (as above) if the player moves to 65/y/65 (real distance 91.9), but despawns immediately if the player moves to 91/y/91 (real distance 128.7).
All hostile mobs (including those that are holding items) in a world will despawn if the difficulty is set to peaceful, regardless as to where the player is positioned in the world.
In multiplayer, despawning does not occur while there are no players in the game.
A monster which has been named with a name tag will despawn if players log out more than 100 blocks from them. However, one created from a renamed spawn egg will despawn as normal.
If a monster is holding any items or wearing any armor that was given by a player or picked up from the ground, it will not despawn.
So, I recommend Spawning your mobs in with command blocks, and giving them Items (the items will not be visible.)
Answer 3
Ok. this maybe isn't the best method to stop this happening, but usually mobs despawn when the chunk is unloaded. I thought this stopped if the mob was named, but this is worth a try. Place a hopper down. Place another hopper facing the first one, then destroy the first hopper. Then place the hopper back, facing the other one like this:
Then, place an item in one of them and it will loop around them both, This should keep the chunk loaded even offline as far as I am aware. Like I say it might not work but it is worth a try.
Answer 4
I found that in order to stop mobs from disappearing, (pigs, cow, sheep, chickens, etc) you have to attach them to a leash, then attach the leash to a fence pole. No problems so far.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Rachel Claire, Zen Chung, Zen Chung, William Fortunato