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

Tried removing item from object which did not contain it with no clear cause #39402

Closed
Gammro opened this issue Apr 9, 2020 · 12 comments · Fixed by #40098
Closed

Tried removing item from object which did not contain it with no clear cause #39402

Gammro opened this issue Apr 9, 2020 · 12 comments · Fixed by #40098
Assignees
Labels
<Bug> This needs to be fixed Items / Item Actions / Item Qualities Items and how they work and interact (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Gammro
Copy link

Gammro commented Apr 9, 2020

Describe the bug

Every once in a while the following error pops up a number of times. I've had this happen while reading, while crafting and just walking around. The game doesn't crash, and I can sort of ignore it.

item visitable<T>::remove_item(item&) [with T = item]] Tried removing item from object which did not contain it

I couldn't find any other reports with this issue, and most related seem to be related to butchering(?) instead of "just popping up"

Steps To Reproduce

No discernable pattern(to me) on when it happens. Sometimes it doesn't happen for a long time, sometimes it fires multiple turns after another.

Expected behavior

It doesn't bug out

Versions and configuration

  • OS: Windows
    • OS Version: 10.0 1909
  • Game Version: 0.E-439-gdf00ef1 [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Aftershock [aftershock],
    Simplified Nutrition [novitamins],
    C.R.I.T Expansion Mod [crt_expansion],
    MSX Hide DEBUG [UDP_No_Debug_Tile],
    Mythical Martial Arts [MMA],
    Urban Development [Urban_Development],
    Alternative Map Key [alt_map_key],
    Disable NPC Needs [no_npc_food],
    Craftable Gun Pack [craftgp],
    Fuji's Military Profession Pack [fuji_mpp],
    Beta National Guard Camp [national_guard_camp],
    SpeedyDex [speedydex],
    Stats Through Skills [StatsThroughSkills]

Additional context

Debug trace:

10:58:09.194 ERROR : (error message will follow backtrace)
  #0
    (dbghelp: @0x62cf96[cataclysm-tiles.exe+0x22cf96]), 
    (libbacktrace: Z21debug_write_backtraceRSo+0x56@0x62cf96),
    (libbacktrace: 0x62cf96    [unknown src]:0    [unknown func]),
  #1
    (dbghelp: @0x62da2a[cataclysm-tiles.exe+0x22da2a]), 
    (libbacktrace: Z8DebugLog10DebugLevel10DebugClass+0x34a@0x62da2a),
    (libbacktrace: 0x62da2a    [unknown src]:0    [unknown func]),
  #2
    (dbghelp: @0x631306[cataclysm-tiles.exe+0x231306]), 
    (libbacktrace: Z12realDebugmsgPKcS0_S0_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x76@0x631306),
    (libbacktrace: 0x631306    [unknown src]:0    [unknown func]),
  #3
    (dbghelp: IMG_LoadWEBP_RW+0x11ab05@0x1282b45[cataclysm-tiles.exe+0xe82b45]), 
    (libbacktrace: Z12realDebugmsgIJEEvPKcS1_S1_S1_DpOT_+0x35@0x1282b45),
    (libbacktrace: 0x1282b45    [unknown src]:0    [unknown func]),
  #4
    (dbghelp: IMG_LoadWEBP_RW+0x339be1@0x14a1c21[cataclysm-tiles.exe+0x10a1c21]), 
    (libbacktrace: ZN9visitableI4itemE11remove_itemERS0_+0xd1@0x14a1c21),
    (libbacktrace: 0x14a1c21    [unknown src]:0    [unknown func]),
  #5
    (dbghelp: @0x82b1de[cataclysm-tiles.exe+0x42b1de]), 
    (libbacktrace: ZN4item7processEP6playerRK8tripointbf16temperature_flag+0x11e@0x82b1de),
    (libbacktrace: 0x82b1de    [unknown src]:0    [unknown func]),
  #6
    (dbghelp: @0x9c8f4b[cataclysm-tiles.exe+0x5c8f4b]), 
    (libbacktrace: ZN3map13process_itemsEbPFbR10item_stackR14safe_referenceI4itemERK8tripointRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEf16temperature_flagESG_.constprop.2347+0x1a7b@0x9c8f4b),
    (libbacktrace: 0x9c8f4b    [unknown src]:0    [unknown func]),
  #7
    (dbghelp: @0x9c91da[cataclysm-tiles.exe+0x5c91da]), 
    (libbacktrace: ZN3map20process_active_itemsEv+0x2a@0x9c91da),
    (libbacktrace: 0x9c91da    [unknown src]:0    [unknown func]),
  #8
    (dbghelp: @0x754840[cataclysm-tiles.exe+0x354840]), 
    (libbacktrace: ZN4game7do_turnEv+0x670@0x754840),
    (libbacktrace: 0x754840    [unknown src]:0    [unknown func]),
  #9
    (dbghelp: IMG_LoadWEBP_RW+0x67ea09@0x17e6a49[cataclysm-tiles.exe+0x13e6a49]), 
    (libbacktrace: main+0x1199@0x17e6a49),
    (libbacktrace: 0x17e6a49    [unknown src]:0    [unknown func]),
  #10
    (dbghelp: @0x4013ed[cataclysm-tiles.exe+0x13ed]), 
    (libbacktrace: _tmainCRTStartup+0x23d@0x4013ed),
    (libbacktrace: 0x4013ed    /home/narc/src/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-5.4.0.build_/mingw-w64-v5.0.2/mingw-w64-crt/crt/crtexe.c:336    __tmainCRTStartup),
  #11
    (dbghelp: @0x4014fb[cataclysm-tiles.exe+0x14fb]), 
    (libbacktrace: WinMainCRTStartup+0x1b@0x4014fb),
    (libbacktrace: 0x4014fb    /home/narc/src/mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-5.4.0.build_/mingw-w64-v5.0.2/mingw-w64-crt/crt/crtexe.c:186    WinMainCRTStartup),
  #12
    (dbghelp: BaseThreadInitThunk+0x14@0x7fffda047bd4[KERNEL32.DLL+0x17bd4]), 
    (backtrace_syminfo failed: errno = -1, msg = no symbol table in PE/COFF executable),
    (backtrace_pcinfo failed: errno = -1, msg = no debug info in PE/COFF executable),
  #13
    (dbghelp: RtlUserThreadStart+0x21@0x7fffdba6ced1[ntdll.dll+0x6ced1]), 
    (backtrace_syminfo failed: errno = -1, msg = no symbol table in PE/COFF executable),
    (backtrace_pcinfo failed: errno = -1, msg = no debug info in PE/COFF executable),
Backtrace emission took 0 seconds.

Attached save:
Saved right after the incidents.
save.zip

@KorGgenT
Copy link
Member

KorGgenT commented Apr 9, 2020

there were some recent issues that were closed by a PR i made ~6 hours ago. this is very likely related to the PR that caused those, which was the encapsulate item contents pr. i don't know the number off the top of my head.

@GGgatherer
Copy link
Contributor

GGgatherer commented Apr 10, 2020

I just updated to the latest build(10508) and had it happen. Even figured out reproduction steps:

  1. spawn a container for liquids, I used plastic canteen;
  2. find (can't find out how to spawn one) another container with liquid inside, bottle/can of soda will do;
  3. reload canteen with soda or whatever you had in second container;
  4. get aforementioned error message, and also second container will have no liquid inside but will still have it in its name, like "opened aluminum can of orange soda" with no soda in it (and not even "0/1", just can of soda without any soda).

upd: if you have multiple containers with the liquid and choose to reload your container, in source container selection list previously emptied ones will show 1 in "amount" column (but even if you choose them they won't provide any).

@GGgatherer
Copy link
Contributor

oooohkay, it's even worse than that. Those containers that showed amount:1 in reload selection list? after reloading a save, they actually DO have an amount of liquid. I had 3 condoms of motor oil which were most definitely empty after loading their contents into a jerrycan (but still had amount:1 as noted in previous post), but after reloading the save each one had 250ml of motor oil. Loadable into other containers and all that. That's not just an error, it's an exploit.

@l29ah
Copy link
Contributor

l29ah commented Apr 15, 2020

Tried bisecting it but it turns out a week old code can't read modern save files.

@l29ah
Copy link
Contributor

l29ah commented Apr 17, 2020

e03227a is the first bad commit

@l29ah
Copy link
Contributor

l29ah commented Apr 17, 2020

Damn i'm too C++-dump to grok it.

@GGgatherer
Copy link
Contributor

GGgatherer commented Apr 19, 2020

Just want to add - bug doesn't happen if you are refilling vehicle from container, drinking from it or spilling its contents on ground. It only happens when you are filling one container from another.
e: that's about player-managed containers only, it still happens sometime for no discernible reason so they aren't the only culprit.

@l29ah
Copy link
Contributor

l29ah commented Apr 19, 2020

filling one container from another

i have a save file when it occurs w/o any such event

@Termineitor244
Copy link
Contributor

Termineitor244 commented Apr 25, 2020

filling one container from another

i have a save file when it occurs w/o any such event

Just returning to the game after some months, and what do I find in my new game? This exact bug, I attach the save file, you just need to go east (To the closest city) and it will start happening without doing anything but walking, but if you go west it wont happen (I have just looted a single house in that city, so I don't know why this is happening)

Go east to find the bug.zip

Edit:
Version of the game:
0.E-1178-g842ba94 (tiles), Windows 10 x64
Mods:
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
SpeedyDex [speedydex],
Stats Through Skills [StatsThroughSkills]

@GGgatherer
Copy link
Contributor

GGgatherer commented Apr 25, 2020

i have a save file when it occurs w/o any such event

I specifically added that it was regarding player-managed containers only. 100% reproducible steps to help find (at least one of) the source(s) of the problem. I, too, have it happen sometimes in cities, my guess is something to do with zombies moving through RB boundaries.

Anyway, something for @KorGgenT to meditate on if he hadn't fixed it yet: after getting kinda-but-not-empty container as described in one of my previous posts here, trying to drink from such container generates another error:

DEBUG    : Tried to remove charges that do not exist, removing maximum available charges instead.

FUNCTION : void item::mod_charges(int)
FILE     : src/item.cpp
LINE     : 9578

After which the bottle becomes regular empty bottle, with no charges and no liquid name slapped on it.

@KorGgenT
Copy link
Member

i will have to revisit this and the handful of other similar issues after nested containers, and see if they go away due to that PR.

@kevingranade
Copy link
Member

This issue has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/experimental-crashes-tried-removing-item-from-object-which-did-not-contain-it/23447/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Items / Item Actions / Item Qualities Items and how they work and interact (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants