I usually join servers by double clicking not by pressing enter or pressing the button. I had this ANNOYING bug where I would be in a ghost mode. Sometimes I could fly and I could not chat or use commands. I also sometimes glitched through chunks. I found the reason of so. I'm joining the server twice in one second. I joined my server and I saw this in about 1 second:
Randomdud333 joined the game.
Randomdud333 left the game.
Randomdud333 joined the game.
All of those were in one second. sometimes you don't become "Ghosted" but when i did that I was ghosted. Simple relog sometimes fixes it.
Edit: I found out you join two servers at the exact same time.
So if you join Server A, and then quit and join Server B is a weird way, that I don't know how it works. You will be in both servers.
When your in both servers you receive chat from both, and the time of day (it switches from ServerA/ServerB time every few seconds)
Linked issues
Comments

MC-75183 sounds similar
@md_5 MC-75183 is a bit different. It doesn't crash the server, it joins the server twice, and technically joins two servers.
@sonic This is not a duplication. The ghosting does not spawn a player, it glitches you in game.