I made a post regarding this but it seemed to not gain traction due to it being messy. ill remake it here, basically there is a chance for the server to crash or just freezes indefinitely when a player does a command, like /tpa or /rtp usually resulting in this error message
[10:40:00] [Server thread/ERROR]: java.lang.OutOfMemoryError: Metaspace
One time it even happened when a player joined the server. Upon re-starting after the crash the data is abit messed up it even caused item duplications
Server Software: PaperMC
Version: 1.17.1
This small problem has slowly became a bigger problem over the days