ULX

Author Topic: Hook.lua  (Read 5908 times)

0 Members and 1 Guest are viewing this topic.

Offline LoloMan2

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Hook.lua
« on: March 17, 2018, 12:06:27 PM »
Hi, i know thats a weird question, but I need do it for test a thing, what happens if I delete hook.lua? Every stop work?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: Hook.lua
« Reply #1 on: March 17, 2018, 12:21:19 PM »
Ulib's hook.lua? I think it just overwrites gmods hook.lua so I think you'd be okay but I don't know for sure. You could try and see the repercussions for it, but I'd back it up first.

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: Hook.lua
« Reply #2 on: March 17, 2018, 02:29:44 PM »
But if you deleted Gmod's default hook.lua then you'd likely not be able to make or call hooks or do whatever to them. Hooks in Gmod, afaik, are there so you don't have to overwrite Gmod's default functions. I wouldn't go about deleting that file, would probably end up breaking something rather important.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Hook.lua
« Reply #3 on: March 17, 2018, 03:13:30 PM »
Stuff can break, especially our hook calls that require prioritization.
Why/what are you testing?

If you're getting some error stating ulib/hook.lua is mentioned 4-5 lines down in the error trace stack, it's 99% not ULib, but the code before it.
Our hook.lua grabs all hook.add calls and allows for prioritization.
If you remove it, stuff may still work, but your error isn't going to go away, it will just mention Gmod's default hook.lua or file containing hook.add
« Last Edit: March 17, 2018, 03:55:58 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LoloMan2

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Hook.lua
« Reply #4 on: March 20, 2018, 08:53:33 AM »
i get infinite loop error on hook.lua

Offline LoloMan2

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Hook.lua
« Reply #5 on: March 20, 2018, 09:03:54 AM »
I already know the only way for detect whats hanging my server, (i know its a lua loop) its doing elimination process 1 by 1 of addons, but thats very very bad way for me because it will make my server unplayable, and hangs only happens if there are at least some players, because when i migrated of host, i keep the other IP on, and it had same files of actually server and it stop hang when 0 players. There isnt really another way for detect whats making an infinite loop? Because we are sure a hook doing it. Isnt possible made a code what can try detect if any file is doing infinite loop? I know too its an old addon what is doing it, and I deleted lot of old addons but hangs never stop. Thanks. Regards. Lolo.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: Hook.lua
« Reply #6 on: March 20, 2018, 09:10:17 AM »
Are you sure it's an infinite loop or could it be bad code in a hook? For example, a Think hook could require a lot of data and since it's run every tick (higher tickrate = more ticks/second), that could be the cause of your issue. Deleting hook.lua will not prevent your issue if it is a problem with the hook, so the best bet is to, on a slow time or scheduled maintenance time, remove each add-on one by one and have a few of your staff or friends or something to come on. Once the server stops hanging, look through the most recent removed add-on's code to find a possible issue.

A general rule of thumb, a few hours of unplayability is better than constant server hanging making the game unplayable. I'm sure your players will understand.

Edit: Another way is looking through each of your add-ons one by one and examining each hook in them if you're positive it's a hook issue.

Another thing you could try is DBugR, but only use this if you have trusted players on. I'd disable cac! If you have it as DBugR is highly intrusive. This tool will hopefully point you in the right direction to find out the culprit of your server hanging.

Sent using Tapatalk. Owner of iViscosity Gaming.
« Last Edit: March 20, 2018, 09:13:02 AM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline LoloMan2

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Hook.lua
« Reply #7 on: March 20, 2018, 09:44:46 AM »
I will try do every before elimination process, because it isnt really few hours unplayable, you have to wait about 12-18h for server hang. My tickrate is 33-40 I think, im not sure
« Last Edit: March 20, 2018, 09:50:19 AM by LoloMan2 »

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: Hook.lua
« Reply #8 on: March 20, 2018, 10:15:16 AM »
You said you get errors on hook.lua, could you paste the whole error?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: Hook.lua
« Reply #9 on: March 20, 2018, 10:23:06 AM »
I will try do every before elimination process, because it isnt really few hours unplayable, you have to wait about 12-18h for server hang. My tickrate is 33-40 I think, im not sure
If the hangs take that long... Could you potentially schedule an automated server restart every, say, 10 hours? Or during slow times strewn in-between?

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline LoloMan2

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Hook.lua
« Reply #10 on: March 20, 2018, 10:24:22 AM »
Nop, because really sometimes happens before, sometimes at 6h, otehrs at 10, others at 16, others at 12, others at 8 hours, etc... So that really won't fix it :(

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 802
  • Karma: 58
Re: Hook.lua
« Reply #11 on: March 20, 2018, 11:46:59 AM »
Nop, because really sometimes happens before, sometimes at 6h, otehrs at 10, others at 16, others at 12, others at 8 hours, etc... So that really won't fix it :(
I'm not saying to fix it, but to use it as a temporary solution until you find out the reason it's happening.

Sent using Tapatalk. Owner of iViscosity Gaming.

I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline LoloMan2

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Hook.lua
« Reply #12 on: March 22, 2018, 06:57:20 AM »
where change tickrate?

Offline LoloMan2

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Re: Hook.lua
« Reply #13 on: March 22, 2018, 08:09:11 AM »
And I increase or decrease tickrate?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Hook.lua
« Reply #14 on: March 22, 2018, 06:34:59 PM »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming