Open ELadner opened 3 years ago
Apparently selling to ANY vendor results in a crash.
Has that scroll been split manually from a player from an henchmen inventory? I had a similar case a while ago. A player found out that if you split a stack of potion into his henchmen inventory (from inside a bag), and then tried to sell the split potion, the server would crash.
I had to hook NWNX_ON_ITEM_SPLIT_BEFORE
and make sure it was skipped unless the potion was inside the splitter inventory.
But it was a while ago, i still have the workaround running, not sure if necessary anymore
Not able to repro this myself, so I dunno.
Can confirm this happened on my server as TomRotfl described only a week ago. Ended up using the same workaround as Tom as well.
Below are some general observations from my testing that I posted on our bug report for it. I think the main problem is that when splitting an item from a container in a henchman's inventory, OBJECT_SELF in the NWNX_ON_ITEM_SPLIT event(s) is considered the PC master, not the henchman itself.
More Testing Info: This only appeared to occur when a stack was split in a container that was in a NPC Associate's inventory, which would have the split off stack go to the PC's inventory. That split stack in the PC's inventory could even be split further, but when any stack created this way was sold to store (one that was either open as this splitting happened, or even opened after this splitting), the server crash would occur. Simply splitting stacks in the NPC associate's inventory and selling them to the store directly from the NPC's inventory would not cause this, so it is technically still allowed.
More Technical Info: Oddly enough, when an item is split in a NPC's inventory, the GetItemPossessor and OBJECT_SELF doing the splitting is the NPC, at least as far as NWNX is concerned. But when an item is split in a container within an NPC Associate's inventory, the GetItemPossessor is the NPC, but OBJECT_SELF is the PC - and hence why the PC gets the split off stack that then causes the crash. Certainly doesn't seem right, and is likely part of the reason behind why the crash was occurring.
Tried this originally with a scroll (not sure if it was split) but also tried selling a non-stackable item (a sword or ax or something like that) and also encountered the crash.
This also did not involve an NPC associate or henchman. PC selling directly to the merchant.
Confirmed. The first item was a scroll (not part of a stack, so not split) and the second item was a halberd. Both caused same kind of crash.
Just got this selling a helmet:
Backtrace:
/home/arabel/server/bin/linux-x86/NWNX_Core.so(_ZN7NWNXLib8Platform13GetStackTraceB5cxx11Eh+0x49) [0x7f941ae758d9]
/home/arabel/server/bin/linux-x86/NWNX_Core.so(nwnx_signal_handler+0x99) [0x7f941adc6059]
/lib/x86_64-linux-gnu/libc.so.6(<UNKNOWN>) [0x7f941999ffd0]
nwserver-linux(_ZN12CNWSCreature11RequestSellEjj+0x58) [0x5650a6624e98]
nwserver-linux(_ZN11CNWSMessage32HandlePlayerToServerStoreMessageEP10CNWSPlayerh+0x28e) [0x5650a67c97be]
nwserver-linux(_ZN11CNWSMessage27HandlePlayerToServerMessageEjPhj+0x5f4) [0x5650a67dd874]
/home/arabel/nwnee-dedicated-8193.33/bin/linux-x86/NWNX_Profiler.so(_ZN8Profiler11NetMessages31HandlePlayerToServerMessageHookEP11CNWSMessagejPhj+0x801) [0x7f94134615f1]
nwserver-linux(_ZN21CServerExoAppInternal13HandleMessageEjPhji+0x9d) [0x5650a675928d]
nwserver-linux(_ZN19CNetLayerPlayerInfo8SetCDKeyEiRK10CExoStringS2_+0x656) [0x5650a65519d6]
nwserver-linux(_ZN15CNetLayerWindow23UnpacketizeFullMessagesEi+0x407) [0x5650a6551f07]
nwserver-linux(_ZN19CNetLayerPlayerInfo8AddCDKeyERK10CExoStringS2_+0x2d9d) [0x5650a65605dd]
/home/arabel/nwnee-dedicated-8193.33/bin/linux-x86/NWNX_Profiler.so(+0x18394) [0x7f941345f394]
nwserver-linux(_ZN21CServerExoAppInternal8MainLoopEv+0x7f) [0x5650a676970f]
/home/arabel/nwnee-dedicated-8193.33/bin/linux-x86/NWNX_Profiler.so(+0x17b36) [0x7f941345eb36]
/home/arabel/nwnee-dedicated-8193.33/bin/linux-x86/NWNX_Profiler.so(_ZN8Profiler8Profiler14MainLoopUpdateEP21CServerExoAppInternal+0x4c) [0x7f941345811c]
/home/arabel/nwnee-dedicated-8193.33/bin/linux-x86/NWNX_Tracking.so(_ZN8Tracking8Activity14MainLoopUpdateEP21CServerExoAppInternal+0x53) [0x7f940ce71ef3]
/home/arabel/nwnee-dedicated-8193.33/bin/linux-x86/NWNX_Util.so(<UNKNOWN>) [0x7f940ca01c13]
nwserver-linux(<UNKNOWN>) [0x5650a64e5f45]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f9419982b97]
nwserver-linux(_start+0x2a) [0x5650a64e9f0a]
Have you tried a clean rebuild of nwnx + making sure your server binary is for 8193.33?
Have you tried a clean rebuild of nwnx + making sure your server binary is for 8193.33?
Yes, this was a complete rebuild from the .33 tag. Server binary version in the original backtrace matches: NWNX 8193.33 (c3e95f64d5)
Sounds like there are maybe two different issues here. But since I forgot to include it in my comment, I just wanted to provide the dump for the server crash caused by selling a stack split from a container in a henchmen's inventory (in case it may be useful to anyone looking into that particular issue) -
Backtrace:
/home/userdir/unified/Binaries/NWNX_Core.so(_ZN7NWNXLib8Platform13GetStackTraceB5cxx11Eh+0x49) [0x7f086c6738d9]
/home/userdir/unified/Binaries/NWNX_Core.so(nwnx_signal_handler+0x99) [0x7f086c5c4059]
/lib/x86_64-linux-gnu/libc.so.6(<UNKNOWN>) [0x7f086b1e8fd0]
./nwserver-linux(_ZN11CNWSMessage21WriteRepositoryUpdateEP10CNWSPlayerP10CNWSObjectP15CItemRepositoryP22CNWSPlayerLUOInventoryhch+0x1f8) [0x55dfad260e68]
./nwserver-linux(_ZN11CNWSMessage43WriteGameObjUpdate_MajorGUIPanels_InventoryEP10CNWSPlayerP22CNWSPlayerInventoryGUI+0x21c) [0x55dfad2757ac]
./nwserver-linux(_ZN11CNWSMessage33WriteGameObjUpdate_MajorGUIPanelsEP10CNWSPlayer+0x18b) [0x55dfad27aa0b]
./nwserver-linux(_ZN11CNWSMessage31SendServerToPlayerGameObjUpdateEP10CNWSPlayerj+0x1c0) [0x55dfad281fc0]
./nwserver-linux(_ZN21CServerExoAppInternal32UpdateClientGameObjectsForPlayerEP10CNWSPlayerim+0x197) [0x55dfad2a3367]
./nwserver-linux(_ZN21CServerExoAppInternal23UpdateClientGameObjectsEi+0x80) [0x55dfad2a3540]
./nwserver-linux(_ZN21CServerExoAppInternal8MainLoopEv+0x1c8) [0x55dfad2b2858]
./nwserver-linux(<UNKNOWN>) [0x55dfad02ef45]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f086b1cbb97]
./nwserver-linux(_start+0x2a) [0x55dfad032f0a]
Does anybody have any insight into what _ZN12CNWSCreature11RequestSellEjj+0x58
is trying to do?
Also, I think the comments about splitting are confusing this issue. This problem doesn't appear to be related to the splitting issue (stack traces are wildly different).
It checks if you can sell the item to the store, eg, not a plot item, cursed, container containing items, etc.
Attempted to sell a plot item and a stolen item. Both also crashed the server with the exact same stacktrace.
Does it happen with a clean module with no haks etc?
good question. I'd have to do quite a bit of legwork to test that one. I'll see if I can whip something up this weekend.
On Thu, Oct 14, 2021 at 9:18 PM Daz @.***> wrote:
Does it happen with a clean module with no haks etc?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nwnxee/unified/issues/1433#issuecomment-943930094, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4C3KWDV52SQB63VF4ZIRLUG6FOHANCNFSM5FY5LOYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Eric Ladner
Yes.. Same crash with a simple module.
Not getting a crash with that module.
I'd nuke NWNX from orbit by deleting your nwnx build files/binaries maybe the repo too and recompile it from scratch. Also delete the server binaries and grab 8193.33 again :D
nwserver-linux(_ZN12CNWSCreature11RequestSellEjj+0x58) [0x55c50cc24e98]
Uhh.. what? that's not at the instruction boundary..
0000000000224e40 <_ZN12CNWSCreature11RequestSellEjj>:
224e40: 55 push %rbp
224e41: 48 89 e5 mov %rsp,%rbp
224e44: 41 57 push %r15
...
224e8d: 0f 84 bd 00 00 00 je 224f50 <_ZN12CNWSCreature11RequestSellEjj+0x110>
224e93: 48 8b 83 e0 05 00 00 mov 0x5e0(%rbx),%rax
224e9a: 48 85 c0 test %rax,%rax
224e9d: 74 0f je 224eae <_ZN12CNWSCreature11RequestSellEjj+0x6e>
224e9f: 48 8b 40 10 mov 0x10(%rax),%rax
Done. I don't know why yet, but that resolved the problem.
On Sun, Oct 17, 2021 at 2:32 PM Daz @.***> wrote:
Not getting a crash with that module.
I'd nuke NWNX from orbit by deleting your nwnx build files/binaries maybe the repo too and recompile it from scratch. Also delete the server binaries and grab 8193.33 again :D
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nwnxee/unified/issues/1433#issuecomment-945181596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4C3KQ7STPQIRTNNXF745DUHMQEHANCNFSM5FY5LOYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Eric Ladner
The crash occurred while selling a scroll to a merchant. Maybe.