alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
974 stars 422 forks source link

sourcemode server crashes. #1778

Closed laterre39 closed 2 years ago

laterre39 commented 2 years ago

Environment

Description

Server suddenly crashes while playing The error log does not appear, and I was able to receive the log through the accelerator.

https://crash.limetech.org/jj676tnalais << this log https://crash.limetech.org/kya6zufw4ck5 https://crash.limetech.org/sutoktm5l2bq https://crash.limetech.org/xoghqcubukjy

game.cstrike.ext.2.csgo.so!CS_DropWeapon [natives.cpp:74183 + 0x2e3]

Overall, I found this to be the problem. I've checked several times that the log contains this.

Problematic Code (or Steps to Reproduce)

There is a phenomenon in which weapons are discarded multiple times when automatically purchasing weapons in the ZR plugin, and I wonder if that may be a problem. I don't know, but... If it is a DropWeapon, it is expected that it may be the problem.

Logs

A list of plugins and extensions is also attached as text.

Plugin list.txt Exts list.txt

`

Alexeyt89 commented 2 years ago

I had a similar problem on my server. On random occasions players found in own inventory two knives or other weapons which were not supposed to be there, or zombies cold find themselves without knives. I analized the problem and found out that weapon_healthshots sometimes are not cleaned from m_hMyWeapons after using. On some maps where players are attached to other entities (crazy carts), it happens to primary weapons as well. It is fine if the not cleaned index is reused for another weapon, it only leads to glitches, but if it is used for another entity type, the engine still tries to deal with it as with an ordinary weapon and the server crashes. Not sure if the crash here happens for the same reason, but you cold try to check when a weapon is being deleted whether any player still has it in m_hMyWeapons. You could also try using this function instead https://sm.alliedmods.net/new-api/sdkhooks/SDKHooks_DropWeapon

laterre39 commented 2 years ago

Oh thanks for the advice on that matter

I don't have much knowledge about coding. If I understand a lot, does that mean that there is a problem with weapon_healthshots not being deleted and that deleting weapon_healthshots with a plugin can solve that problem? I wonder if the plug-in provided as an option in ZR is correct...

psychonic commented 2 years ago

Closing as this isn't a bug in SourceMod itself. There will always be the potential for adverse reactions with certain combinations of plugin interaction with the game.

Alexeyt89 commented 2 years ago

What I meant is that in OnEntityDestroyed call for a weapon, the weapon index should not be present in m_hMyWeapons property of the player who possesed the weapon before it was marked for deletion. If the weapon index is still there, the property should be nulled. That's what I do to avoid glitches and crashes. If the index is not nulled, the property can eventially refer to any entity which is created with the same index after the weapon is deleted. Entity handlers are meant to protect from such problems, but in this case it somehow doesn't work. Here is the problem discussion: https://forums.alliedmods.net/showthread.php?t=316315

laterre39 commented 2 years ago

Ah I understand, thanks for your help, I'll apply and test...