MeikelLP / quantum-core-x

Metin2 open source server implementation
https://meikellp.github.io/quantum-core-x/
Mozilla Public License 2.0
35 stars 9 forks source link

bug: item swap #180

Open Jafah opened 1 week ago

Jafah commented 1 week ago

What happened?

Swapping an item with another one, by i.e. right clicking armor in your inventory, both items dissappear and the connection is non-responsive

How to reproduce?

right click an item i.e. a weapon when another weapon is equipped

Stacktrace

No response

OS Platform

Windows

Additional Information and Notes

No response

Jafah commented 5 days ago

Game connection crashes at ItemRepository.cs at line 73 when the swap is called await _cacheManager.Set(key, item); The previous write to the database, line 70, goes through and it is persistent between restarting after a crash So the problem is likely in / with Redis and or caching.

uutkukorkmaz commented 5 days ago

I'll take a look for the Redis part. But my strongest guess is server-client packet order for equip-unequip actions

Jafah commented 5 days ago

The packet handeling was my first guess, but it ended on line 73 and i have almost no experience with memory so i thought its probably wrong. But it still needed a restart of the server to be able to rejoin the game since it stated that the user was already connected, so server-sided it may have stopped registering new packets because of a faulty predecessor.

uutkukorkmaz commented 5 days ago

You don't need to restart the server after getting the "you already logged in" message; just try logging in again, and it will succeed. That's another bug related to the unexpected drop of connection. I haven't had a chance to take a deep look yet, but packet order is still my strongest candidate for this issue's root cause.

I also discovered a significant number of bugs with item and inventory management. I’ll open respective issues for those as soon as possible.