Server freezes / "Changing collision rules within a callback is likely to cause crashes!"

Hi, I’m hosting a TTT server and sometimes it just stops working with no errors being printed into console/console.log file whatsoever. It freezes and I have to manually restart it. I can see the
Changing collision rules within a callback is likely to cause crashes! messages though and I’m pretty sure that’s the reason, however I don’t know which addon causes these and what should I be looking for in my addons’ code.

Or maybe these warnings have nothing to do with the issue itself?

Thanks in advance!

Edit: By now I’m not sure if the crashes are related to the error

Disabling your addons one by one until it stops happening will help you narrow down the problem addon. As for fixing it, read the error. Look for code that changes the collisions rules with (I assume) a collision callback.

Thanks for reply!

Crashes happen every few days, so it’d take a lot of time to find out what addon causes the error that way, even if I only choose few addons that are most likely to be related to this. So the best solution for me would be to look through all the code and locate whatever causes the error myself - and that’s exactly what i’m doing right now.

What I don’t like about it though is that I’m not even sure about crashes actually being related to the error. Might there be anything else to ‘freeze’ the server that way?

Freezes are related and the error is caused by an addon either not calling PhysObj:RecheckCollisionFilter() or Entity:CollisionRulesChanged() or even Entity:SetCollisionGroup() or, calling it inside of a hook that is related to “Touch”.
Given that it is saying “Changing collision rules within a callback is likely to cause crashes!” it should be because its called inside of the hook.

Any “Touch” hook can be the cause. SetCollisionGroup calls CollisionRulesChanged and CollisionRulesChanged calls RecheckCollisionFilter.

Touch hooks:


StartTouch
Touch
EndTouch
ShouldCollide
PhysicsCollide

I probably missed 1.

Search for these hooks and look if one of those functions are being called inside of them. If this is the case that it likely causing the problem.
I had the same problem and Willox pointed me into the right direction early 2016.

A little update on this issue.

I tried looking though all the code and even tried to fix some things, but the crash just happened again. At this point I’m not sure that this kind of behaviour is related to the ‘Changing collision rules within a callback is likely to cause crashes!’ warning. Another interesting thing I noticed is that these freezes seem to happen at round ends (as I said, it’s a TTT server).

Does anybody happen to know what else can cause the server to just freeze?

Infinite loops will cause freezes.

can you post what addons you have installed please

If it happens on round ends, try printing to your console all “TTTEndRound” hooks by doing


PrintTable(hook.GetTable()["TTTEndRound"])

That error usually occurs when an entity is being removed in a PhysCollide function which isn’t a problem at all, just another stupid warning in the game for no reason whatsoever.

I’m actually out of ideas by now, crashes keep happening and I don’t even know what causes them.

And the worst is that I always have to restart the server myself, because it doesn’t actually ‘crash’, server console just freezes and nobody can connect.

Did you read what i said?