Phil25 / RTD

Roll The Dice SourceMod plugin for Team Fortress 2
GNU General Public License v3.0
56 stars 20 forks source link

Deadlock when calling RTDPerkList.Get() #107

Closed naydef closed 4 months ago

naydef commented 5 months ago

Bug description

L 04/01/2024 - 17:02:08: [SM] Exception reported: Not enough space on the stack
L 04/01/2024 - 17:02:08: [SM] Blaming: chaos_machine.smx
L 04/01/2024 - 17:02:08: [SM] Call stack trace:
L 04/01/2024 - 17:02:08: [SM] [1] Line 744, C:\TF2SERVER\steamapps\common\Team Fortress 2 Dedicated Server\tf\addons\sourcemod\scripting\NEC\chaos_machine.sp::RTDPerkList.Get
L 04/01/2024 - 17:03:39: [SM] [33] Line 587, rtd2::RTDPerkList.Get
L 04/01/2024 - 17:03:39: [SM] [34] Line 587, rtd2::RTDPerkList.Get
L 04/01/2024 - 17:03:39: [SM] [35] Line 587, rtd2::RTDPerkList.Get
L 04/01/2024 - 17:03:39: [SM] [36] Line 587, rtd2::RTDPerkList.Get
L 04/01/2024 - 17:03:39: [SM] [37] Line 587, rtd2::RTDPerkList.Get
L 04/01/2024 - 17:03:39: [SM] [38] Line 587, rtd2::RTDPerkList.Get
L 04/01/2024 - 17:03:39: [SM] [39] Line 587, rtd2::RTDPerkList.Get
...

Report checks

The stack trace below is of older version of the plugin, but I guess the issue still occurs depending on circumstances. We're using SM 1.11 some build. It seems the compiler has different behavior depending on version. Basically the methodmap RTDPerkList has a method called Get(), while at the same time deriving from ArrayList which also has a method called Get(). For some reason when the method tries to call ArrayList.Get(), it instead calls RTDPerkList.Get thus resulting in a deadlock.

I can guess the same issue will occur if we use latest RTD plugin with this SM compiler, so I guess the code should be more explicit when calling the Get method:

public RTDPerk Get(int i){
-       return view_as<RTDPerk>(this.Get(i));
+       return view_as<RTDPerk>(view_as<ArrayList>(this).Get(i));
    }

Required

Phil25 commented 5 months ago

Thanks for letting me know, this issue has been fixed inside the plugin some time ago, but I forgot the part about the include file. I'll get on it soon-ish (this week?).

In the meantime, since it's a header file, correcting that line yourself should work fine.

Phil25 commented 4 months ago

Fixed in 2.5.5.