Raised This Month: $ Target: $400
 0% 

Solved Server timed out.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-28-2017 , 10:02   Server timed out.
Reply With Quote #1

As the title says, can u help me with what is causing this server crash.

I was working on a plugin and i got a few of these, with no error logs or any indication what caused it.

Last edited by maqi; 12-08-2017 at 02:53.
maqi is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 11-28-2017 , 10:06   Re: Server timed out.
Reply With Quote #2

infinite loop
jimaway is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-28-2017 , 10:10   Re: Server timed out.
Reply With Quote #3

PHP Code:
set_task(1.0"checkPlayers"TASKID_AFK_CHECK__"b"); 
this ??
maqi is offline
TheWhitesmith
Senior Member
Join Date: Oct 2017
Location: Morocco :c
Old 11-28-2017 , 12:14   Re: Server timed out.
Reply With Quote #4

Quote:
Originally Posted by maqi View Post
PHP Code:
set_task(1.0"checkPlayers"TASKID_AFK_CHECK__"b"); 
this ??
Not really, he means that in your code there is an infinite loop somewhere, like if a function is calling itself. By the way which plugin does cause the timeout?
__________________
TheWhitesmith is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-28-2017 , 13:30   Re: Server timed out.
Reply With Quote #5

I didn't think so, but anyway, that's the only infinite loop.

And i dont know which plugin, it would be much easier if i did, but probably the new one ive been working on, there isn't a reason for any old plugins to suddenly start doing that.
maqi is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-28-2017 , 14:35   Re: Server timed out.
Reply With Quote #6

Quote:
Originally Posted by maqi View Post
I didn't think so, but anyway, that's the only infinite loop.

And i dont know which plugin, it would be much easier if i did, but probably the new one ive been working on, there isn't a reason for any old plugins to suddenly start doing that.
by infinite loop they mean infinite recursion or for / while loops, not a delayed task, that can't freeze the server, while(true){}; can
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-28-2017 , 17:22   Re: Server timed out.
Reply With Quote #7

I know what an infinite loop is but no, there are just a few of these

PHP Code:
for ( new 1<= MAX_PLAYERSi++ ) 
maqi is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 11-28-2017 , 17:38   Re: Server timed out.
Reply With Quote #8

Quote:
Originally Posted by maqi View Post
I know what an infinite loop is but no, there are just a few of these

PHP Code:
for ( new 1<= MAX_PLAYERSi++ ) 
make sure that the value of i is not being modified inside the loop
also, in case you use this loop to go through players, I would heavily recommend using get_players instead
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.

Last edited by aron9forever; 11-28-2017 at 17:38.
aron9forever is offline
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 11-28-2017 , 18:03   Re: Server timed out.
Reply With Quote #9

Its not being modified, good idea tho.

And yes im using because i recently read that get_players is shamed upon, so what is it in the end ?

I also check for

PHP Code:
 is_user_connected(i) && !is_user_bot(i) && !is_user_hltv(i
so i dont get any errors.
maqi is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 11-28-2017 , 18:21   Re: Server timed out.
Reply With Quote #10

Better loop with get_players.

Code:
#if !defined MAX_PLAYERS     #define MAX_PLAYERS 32 #endif new players[MAX_PLAYERS], pnum get_players(players, pnum, "ahc") // 'a' - alive / 'c' - skip bots / 'h' - skip hltv new id //,count for (--pnum; pnum >= 0; pnum--) // for (count = 0; count < pnum; count++) {     id = players[pnum] // players[count]         // Do something with the player }

Last edited by CrazY.; 11-28-2017 at 18:23.
CrazY. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode