The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sever goes unstable and crashes
Author Message
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #5
RE: Sever goes unstable and crashes
probably your function is making the server unstable because you're executing too much SQL commands
everytime you execute a SQL command, sphere will freeze until the SQL server return back the SQL response to sphere. On lightweight SQL functions, you won't notice any freeze because it will execute the function in just 0.1s. But if you execute 100x this same SQL command on loop, the total execution time will be increase to 10s (100 x 0.1s) and this will freeze sphere for about 10 seconds until all SQL commands got executed

so unfortunately to fix this you must rewrite your code to make it use less SQL commands

also you can optimize a lot this passable function, reducing 48478647864763874 lines to just a few lines
instead check for every single value, you can check an entire value range on just a single line

this:
Code:
[function passable]
if <argv0>==3
        return 1
elseif <argv0>==4
        return 1
elseif <argv0>==5
        return 1
elseif <argv0>==6
        return 1
elseif <argv0>==7
        return 1
elseif <argv0>==8
        return 1
elseif <argv0>==9
        return 1
elseif <argv0>==10
        return 1
elseif <argv0>==11
        return 1
elseif <argv0>==12
        return 1
elseif <argv0>==13
        return 1
elseif <argv0>==14
        return 1
elseif <argv0>==15
        return 1
elseif <argv0>==16
        return 1
elseif <argv0>==17
        return 1
elseif <argv0>==18
        return 1
elseif <argv0>==19
        return 1
elseif <argv0>==20
        return 1
elseif <argv0>==21
        return 1
elseif <argv0>==22
        return 1
elseif <argv0>==23
        return 1
elseif <argv0>==24
        return 1
elseif <argv0>==25
        return 1
elseif <argv0>==51
        return 1
elseif <argv0>==52
        return 1
elseif <argv0>==53
        return 1
elseif <argv0>==54
        return 1
elseif <argv0>==55
        return 1
elseif <argv0>==56
        return 1
elseif <argv0>==57
        return 1
elseif <argv0>==58
        return 1
elseif <argv0>==59
        return 1
elseif <argv0>==60
        return 1
elseif <argv0>==61
        return 1
elseif <argv0>==62
        return 1
...

can be reduced to:
Code:
[function passable]
if (<argv0> >= 3) && (<argv0> <= 25)
        return 1
elseif (<argv0> >= 51) && (<argv0> <= 62)
        return 1
...
(This post was last modified: 01-26-2015 05:55 AM by Coruja.)
01-26-2015 03:09 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Sever goes unstable and crashes - Ankron - 01-25-2015, 06:14 PM
RE: Sever goes unstable and crashes - XuN - 01-25-2015, 06:20 PM
RE: Sever goes unstable and crashes - XuN - 01-25-2015, 07:32 PM
RE: Sever goes unstable and crashes - Coruja - 01-26-2015 03:09 AM
RE: Sever goes unstable and crashes - XuN - 01-27-2015, 01:10 AM

Forum Jump:


User(s) browsing this thread: 4 Guest(s)