We noticed that sometimes if a player disconnects while on floor 0 of the ship and it warps, they are stranded on the old planet when they rejoin.
If it's a persistent planet, it's fine. But if it's not persistent, they will die and their stuff is all lost.
After having both messed around a little in game but also looked through the mod code I think I have found why.
When a player joins, you call send_player_to_ship if they aren't on a persistent surface. However, if the player had the map open while disconnecting they will still have the map open when rejoining and the player.surface will give you the surface the player is looking at not the player character itself.
You already work around this for connected players by calling exit_remote_view() when the ship warps, but you never do it for a rejoining player.
So I believe an easy fix is to call exit_remote_view() on a rejoining player too before trying to teleport them to the ship.