Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Bug Report (https://forums.graalonline.com/forums/forumdisplay.php?f=193)
-   -   New NPCServer Bug: return in switch statements (https://forums.graalonline.com/forums/showthread.php?t=134265932)

cbk1994 03-10-2012 11:12 AM

New NPCServer Bug: return in switch statements
 
This started happening after Era was restarted earlier today.

PHP Code:

function onCreated() {
  
temp.key "abc";
  
  switch (
temp.key) {
    case 
"foo":
      echo(
"key=foo");
      return; 
// this line is problematic
    
break;
    
    case 
"abc":
      echo(
"key=abc");
    break;
  }


If you run the following code, nothing will echo. If you comment out the return statement, then it will echo "key=abc" as expected.

It appears that a return statement in a switch causes everything below it to be ignored, even if that case shouldn't have been executed. This is new functionality which is breaking a few things on Era. It did not happen before the server restart today.

This bug also appears to exist clientside on both v5 and v6.

fowlplay4 03-10-2012 11:30 AM

Zodiac's (npcserver) is ****ed and won't even start up without crashing now.

Admins 03-10-2012 11:59 AM

Zodiac: needed to restart the gserver.
Switch statement: seems to be an optimization bug, if you correctly put case "123": { blabla } then it will not happen, didn't had any problem on era and classic iphone :) will fix it today though

fowlplay4 03-10-2012 08:57 PM

This bug pretty much broke everything on Zodiac.

cbk1994 03-10-2012 09:08 PM

Quote:

Originally Posted by Stefan (Post 1687707)
if you correctly put case "123": { blabla } then it will not happen

Why is this the "correct" syntax? C++/C#/Java/Groovy/PHP/JavaScript all prefer to do it without braces, and they're misleading to new scripters (and reduce readability for all scripters) because they give you the false impression that execution stops at the end of the braces, which may not be true if you're falling through.

Admins 03-10-2012 09:32 PM

Ok fixed the problem and uploaded a new npcserver, may be should restart all servers sometime soon.

cbk1994 03-10-2012 11:06 PM

Quote:

Originally Posted by Stefan (Post 1687746)
Ok fixed the problem and uploaded a new npcserver, may be should restart all servers sometime soon.

Our NPC-server is crashing every 20 minutes or so since the new NPCserver.

edit: era is offline until you can fix this!
edit 2: restarting the gserver seems to have fixed it...for now...

fowlplay4 03-11-2012 11:10 PM

1 Attachment(s)
Having issues with the NPC-Server again, whenever we update:

levels/icons/icons.txt

It causes the NPC-Server to crash. I've also caused it to crash by uploading a large text file and deleting it. Attached it.

Admins 03-12-2012 01:05 AM

Is it possible that some script is catching the onLevelFileUpdated event and then doing nasty things? I can check the problem sometime soon.

fowlplay4 03-12-2012 01:14 AM

Quote:

Originally Posted by Stefan (Post 1688018)
Is it possible that some script is catching the onLevelFileUpdated event and then doing nasty things? I can check the problem sometime soon.

I placed echos in the onLevelFileUpdated functions and they don't even appear. It seems like right after the file is saved or deleted it crashes the (npcserver).

Admins 03-13-2012 04:53 PM

Ok the problem was not the file size, it was the problem that there were at least 3 versions of the same file (same filename) on the server. I'm fixing it in this moment.

Update: fixed on Zodiac and uploaded a new version.

fowlplay4 03-16-2012 05:54 AM

NPC is crashing every 30 minutes to an hour again, getting very tired of backups slowing down the playerworlds servers and the lack of stability as of late.

Admins 03-18-2012 01:07 AM

It shows in the logs that it got disconnected, and didn't crash. I will try to debug the npcserver tomorrow.

ffcmike 03-21-2012 08:31 PM

Quote:

Originally Posted by fowlplay4 (Post 1687703)
Zodiac's (npcserver) is ****ed and won't even start up without crashing now.

Same now for Classic. (presumably might happen for other servers whenever they restart their NPC-Server)

Admins 03-22-2012 01:16 AM

Restart your gserver. The new problem on Zodiac was related to a script adding tons of array members to a client. variable, might need to add limit of array length at least for client and clientr variables.


All times are GMT +2. The time now is 02:05 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.