-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Going 'sleep' MAY crash server #4752
Comments
It will probably reproduce when deleting the bed while someone is having the modal open too. |
I've tested it on clean TFS 1.4. I cannot remove Line 23 in 7573e41
Also transform to other To reproduce that crash on TFS 1.4 I had to first change bedItem:transform(1998)
bedItem:moveTo(Position(132, 476, 7)) IDK how Wrap works on new TFS, but if it's possible to Wrap beds, then it must somehow bypass |
the problem for movable beds is that the stored memory address is no longer valid for the player that tries to sleep in the situation when the house owner wraps the bed and logs out this is why beds are not possible to remove in older game versions the solution I used was to store bed itemId and position when the dialog is invoked. Once the player confirms his choice, my server fetch item id from position and checks player distance to the bed. If either check fails, a return is hit. @gesior you may reproduce this in old tfs by always returning true in canRemove() and doing /r on the bed when player2 has the modal dialog open |
I don't want to crash server. I want to make server crash free.
It may be better solution than mine. Mine works for sure in 'normal scenario' (use item on screen of player), but it wastes some CPU for each item move (for each item move on player screen). Yours executes only, when player uses BedItem for offline training, so it does not affect normal item movement. It may save some 0.01% CPU on popular server. |
By submitting this bug issue, you agree to the following.
Does this bug crash tfs?
yes (not always)
Server Version
1.7 (Master)
Operation System
all (listed below)
OS Description
No response
Bug description
Going 'sleep' MAY crash server
Possible Pull Requests which are to blame
No response
Steps to reproduce
Actual Behavior
I get report from modified TFS. I cannot run 12+ client on Linux. Can someone confirm it?
This:
https://github.com/otland/forgottenserver/blob/master/src/actions.cpp#L337
sets
bedItem
inPlayer
toBedItem*
:https://github.com/otland/forgottenserver/blob/master/src/player.h#L226
but does not 'increase pointer' [old TFS] (or use Shared Pointer).
If it opens Dialog window and in meanwhile someone 'Wrap'
BedItem
(remove ite), it will crash, when someone closeDialog
around that line:https://github.com/otland/forgottenserver/blob/master/src/game.cpp#L5655
Expected Behavior
Not crash.
Backtrace
No response
The text was updated successfully, but these errors were encountered: