Hey Folks,
Noticed that all repeat timers seem to break after a few hours of being up. Not sure what is causing this, but pretty much every Timer.repeat breaks after about 8-10 hours of running. Have also noticed that I'm not the only person having this issue.
Highly doubt its another plugin that is causing this, but removed a bunch of plugins that were not required, and still seem to be having the issue.
If you guys need more information, feel more than welcome to ask!
Have also tried adding in things to revive the timer by checking if its alive on player connection, and reviving it if its not around, but it still does not seem to help for some reason. The only thing that seems to bring it back is reloading the plugins that have the timer die.
Fixed Timers breaking randomly
Discussion in 'Rust Discussion' started by Spiritwind, Mar 16, 2015.
-
Wulf Community Admin
Please post your code and the actual errors you are receiving. I've not experienced this issue, but generally timers break because a plugin is either using them improperly or calling something inside them that is broken.
-
For instance, here are some of the plugins where the timer quits functioning after a few hours;
http://oxidemod.org/resources/airdrop-settings.785/
http://forum.rustoxide.com/resources/rotag-radevent.808/
http://oxidemod.org/resources/day-night-system.671/
The timers within these break without any error in console, and as said before, won't function until I oxide.reload the plugin or restart the server.
As you can see in this thread, some other people are complaining about timers as well;
http://oxidemod.org/threads/airdrop-settings.6517/page-7
Have also posted in the threads of the other ones to see if other people are having the problem there. -
Wulf Community Admin
-
Just to clarify, should it be exactly
self.Plugin
Or should Plugin be replaced with something like that plugins name?
Looked at the timer in your update plugin, and it does not have self.Plugin in the timer.repeat.
timer.Repeat(tonumber(self.Config.Settings.CheckInterval), 0, function() self:UpdateCheck() end) -
Wulf Community Admin
Code:timer.Repeat(self.Config.AirdropSettings.DropFrequency * 60, 0, function() self:SpawnPlane() end, self.Plugin)
Code:timer.Once(1, function() self:CheckSupplyLanded(Entity) end, self.Plugin)
Code:timer.Once(1, function() self:CheckSupplyLanded(SupplyDrop) end, self.Plugin)
Code:timer.Once(self.Config.AirdropSettings.SupplyStayTime * 60, function() self:RemoveEntity(SupplyDrop) end, self.Plugin)
Code:timer.Once(self.Config.RadTime, function() self:TurnRad() return end, self.Plugin)
Code:end, self.Plugin)
Code:timer.Repeat( UpdateInterval, 0, function() Sky.Cycle.Hour = TimeData.Hour end, self.Plugin )
Code:timer.Repeat( UpdateInterval, 0, function() self:TimeTick() end, self.Plugin )
Code:timer.Repeat( UpdateInterval, 0, function() self:TimeTick() end, self.Plugin )
Code:timer.Repeat( UpdateInterval, 0, function() Sky.Cycle.Hour = TimeData.Hour end, self.Plugin )
Code:timer.Repeat( UpdateInterval, 0, function() self:TimeTick() end, self.Plugin )
Code:timer.Repeat( UpdateInterval, 0, function() self:TimeTick() end, self.Plugin )
Code:timer.Repeat( UpdateInterval, 0, function() self:TimeTick() end, self.Plugin )
-
Alright, will get back to you with the results. Thanks for the help Wulf!
-
Thank you for information, going to send link to this thread to all authors of this plugins. Also going to fix this on my server, i also tired of this (already had script what automatically reload plugins via rcon). I hope everything will work fine after this changes.
Also this concern to timer.once what also requires self.Plugin as third parameter if used timer.once inside timer.once or it will stop work.Last edited by a moderator: Mar 16, 2015 -
Wulf Community Admin
-
6 hours in an all the timer.repeats have failed again, no error log, using the fixes you gave above. Rad Events have stopped working, Day and Night cycle is back to default, and no airdrops have came in the last 45 minutes, even though their set to happen ever 23 minutes.
Last edited by a moderator: Mar 17, 2015 -
Hmm, i'll also then make test plugin and run it for long time on test server and then report. If it will stop working - then it will be an issue with oxide/rust.
[DOUBLEPOST=1426557273][/DOUBLEPOST]So i wrote this and will report after some time what happens.
Code:PLUGIN.Name = "Timer Test" PLUGIN.Title = "Timer Test" PLUGIN.Version = V(0, 0, 1) PLUGIN.Description = "Testing oxide timer" PLUGIN.Author = "AlexALX"function PLUGIN:Init() local count = 0 self.TestTimer = timer.Repeat (600 , 0 , function() count = count + 1; print("TEST TIMER - #"..count) end, self.Plugin ) endfunction PLUGIN:Unload() if self.TestTimer then self.TestTimer:Destroy() end end
-
Did a test on my end too with different code but pretty much the same, died after 4 hours.
[DOUBLEPOST=1426576557][/DOUBLEPOST]Running it now on a server with no other plugins, should give us a good idea on whether or not its oxide. Will get back to you in the morning with the results. -
For me timers still working on my test server:
[3/17/2015 1:45:21 PM] [Oxide] 1:45 PM [Info] TEST TIMER - #59
Already 590 minutes (almost 10 hours) Going to continue waiting. -
Will try it with the exact code you used @AlexALX_[rus-ua] to see if I get the same or different results.Last edited by a moderator: Mar 17, 2015 -
Wulf Community Admin
I've been testing numerous times without any issues yet. I did change up the previously posted plugin a bit, removing the unnecessary PLUGIN.Name, Unload hook, and timers as variables, and added more timers and types of timers. I've also added some functions in a couple timers that will error, but they don't affect the other timers.
Code:PLUGIN.Title = "Timer Test" PLUGIN.Version = V(0, 0, 1) PLUGIN.Description = "Oxide timer test" PLUGIN.Author = "Wulf"function PLUGIN:OnServerInitialized() local count = 0 timer.Repeat(5, 0, function() count = count + 1; print("5 SECOND REPEAT TIMER - #" .. count) end, self.Plugin) timer.Repeat(7, 0, function() count = count + 1; print("7 SECOND REPEAT TIMER - #" .. count); self:Test() end, self.Plugin) timer.Repeat(10, 0, function() count = count + 1; print("10 SECOND REPEAT TIMER - #" .. count) end, self.Plugin) timer.Repeat(25, 0, function() count = count + 1; print("10 SECOND REPEAT TIMER - #" .. count); print(test) end, self.Plugin) timer.Once(3, function() count = count + 1; print("3 SECOND ONCE TIMER - #" .. count) end, self.Plugin) timer.Once(20, function() count = count + 1; print("3 SECOND ONCE TIMER - #" .. count) end, self.Plugin) timer.NextFrame(function() count = count + 1; print("NEXT FRAME TIMER - #" .. count) end) endfunction PLUGIN:Test() timer.Once(0.1, function() print("INSTANT ONCE SUB TIMER") end, self.Plugin) end
-
Yeah, they do perfectly fine for me until about 4-8 hours in. Now two hours in on this test, and so far its doing fine, will check it again tonight.
-
@Wulf
Nice test pluginbut probably also should to check timer.once inside timer.once as someone do in some plugins.
As for now i accidentally shutdown my test server so timers going from zero againfor now #34.. Probably i'll also later test Wulf version of plugin with some additions and will see.
Also just small offtopic, Wulf - how you choose lua as language for code tag? In drop down menu i have only General, PHP, JS, CSS, HTML. Whats wrongI know that i can manually edit code tag but i lazy for this
-
Wulf Community Admin
[DOUBLEPOST=1426629369][/DOUBLEPOST]
[DOUBLEPOST=1426641422,1426629156][/DOUBLEPOST]Out of curiosity, what is the version of the Oxide build you are using @Spiritwind? -
Using version
v2.0.443
Anyways, using the code from Alex's timer test, it only made it through to #21 for me...
Here is the entire log for that run.
http://paste.ubuntu.com/10618690/
I'll now shut it down and try with yours Wulf. If you need any more info, be sure and let me know.
Also, if you need it, I can get you set up to access tcadmin for it, just pm me if this is the case.
---
See you updated Oxide, will get it switched over to that version now. -
Wulf Community Admin