Skip to content
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

fix: close parcel send thru mail system to other player #4538

Merged
merged 4 commits into from
Dec 13, 2023
Merged

fix: close parcel send thru mail system to other player #4538

merged 4 commits into from
Dec 13, 2023

Conversation

omarcopires
Copy link
Contributor

@omarcopires omarcopires commented Sep 25, 2023

Pull Request Prelude

Changes Proposed

Auto close parcel, when it's send to other player thru mail system.
Credits: @gesior

Issues addressed:
Close #4536

@omarcopires omarcopires changed the title close parcel send thru mail system to other player fix: close parcel send thru mail system to other player Sep 27, 2023
@gunzino
Copy link
Contributor

gunzino commented Oct 27, 2023

After applying this fix I've experienced rare crash bug with checkDecay:
Seems it's after someone cleans house and get dead bodies imported to the Inbox directly while they're still decaying.

#0  0x00007ffe665ce330 in ?? ()
#1  0x0000555555906555 in Player::autoCloseContainers (this=0x7ffe4d819e60,
    container=0x7fffa7fdb3e0) at /sources/gunzodus-engine/src/player.cpp:3671
#2  0x00005555559074fc in Player::postRemoveNotification (this=0x7ffe4d819e60,
    thing=<optimized out>, newParent=<optimized out>, index=<optimized out>,
    isCompleteRemoval=<optimized out>, link=LINK_NEAR, count=0 '\000', actor=0x0)
    at /sources/gunzodus-engine/src/player.cpp:4622
#3  0x00005555559e85bf in Tile::postRemoveNotification (this=0x7fff3678f640,
    thing=0x7fffa7fdb3e0, newParent=0x7fff3678f640, index=2, isCompleteRemoval=false, actor=0x0)
    at /sources/gunzodus-engine/src/tile.cpp:1551
#4  0x00005555557751dd in Game::transformItem (this=0x555555b5ed00 <g_game>,
    item=0x7fffa7fdb3e0, newId=2813, newCount=-1) at /sources/gunzodus-engine/src/game.cpp:2387
#5  0x00005555557758e1 in Game::internalDecayItem (this=0x555555b5ed00 <g_game>,
    item=0x7fffa7fdb3e0) at /sources/gunzodus-engine/src/game.cpp:6254
#6  0x0000555555775f43 in Game::checkDecay (this=0x555555b5ed00 <g_game>,
    thread=<optimized out>) at /sources/gunzodus-engine/src/game.cpp:6321
#7  0x00005555558de9ef in std::function<void ()>::operator()() const (this=0x7fffebffee40)
    at /usr/include/c++/10/bits/std_function.h:622
#8  MultiTasks::threadMain (this=0x555556b5fac0 <g_multitasks>, id=<optimized out>)
    at /sources/gunzodus-engine/src/multitasks.cpp:18
#9  0x00007ffff79a7ed0 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00007ffff7ebdea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007ffff76a0a2f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

@gesior
Copy link
Contributor

gesior commented Oct 27, 2023

After applying this fix I've experienced rare crash bug with checkDecay: Seems it's after someone cleans house and get dead bodies imported to the Inbox directly while they're still decaying.

Looks like Rat corpse decayed on tile (not in BP) and it executed postRemoveNotification on players around tile.
What you got in player.cpp in line 3671? Is it new code or old?

Game::checkDecay (this=0x555555b5ed00 <g_game>, thread=<optimized out>)
thread? Looks like you got some decay system with multithreading.
IDK who made it and how he handled problem of modifying same player in 2 threads in same time. Looks like he did not handle it.
Here is my new decay system:
gesior@c6865c8
It runs in 1 thread and makes decay infinite times faster by not decaying items, which duration is higher than zero - normal decay system decay all items every second.

@EPuncker EPuncker merged commit 70fab9c into otland:master Dec 13, 2023
19 checks passed
@omarcopires omarcopires deleted the issue/4536 branch December 13, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mailbox steal depot items bug, crash OTS bug [clone items]
4 participants