Ghost Rooms Causing Join Room Failures
Posted: 11 Aug 2009, 14:53
Hello,
Our game has grown rapidly over the past few months, and we're nearly ready to upgrade to the unlimited license as we have several hundred concurrent users at this point. But along with more users comes more problems.
We've encountered a recurring problem regarding joining a room. In our system, battle rooms (game rooms) are created and destroyed rapidly.
After adding several traces, I've discovered that some rooms are "getting stuck" and are never destroyed. The even more interesting thing is that these rooms DO NOT display within the SmartFox AdminTool.
These "Ghost Rooms" are leading to problems because when players in our system attempt to search for a battle, they are often matched to these invisible rooms that seemingly no longer exist.
Here is how I've confirmed that "Ghost Rooms" exist. When a user attempts to find a battle in our game, a request is sent to the server to find an available room on the serverside. To get a list of all available rooms on the server, I call:
This returns an array that we iterate through to assemble a list of qualifying rooms:
Now that we have an array of qualifying rooms, we iterate through each room to determine the best match. When a good match is found, we attempt to join the player to the room:
The problem occurs after our server is online for a few days and after thousands of rooms have been created and destroyed. It's at this point that we begin seeing the "Ghost Rooms". The above joinRoom will begin to fail, tracing loads of errors that look like the following:
The most interesting part is the roomId that the system is trying to join (roomId: 137408) is a roomId that no longer exists. If I scroll through the rooms in the SmartFox Admin Tool a room with the id 137408 does NOT exist. In our traces we receive the above error hundreds of times from different users. The only thing consistent among the errors is that the roomId 137408 appears in every single error.
If we restart the server, the "Ghost Rooms" are seemingly cleared because the error will go away for a few days until another room gets stuck, at which point errors will begin firing repeatedly again.
It doesn't seem possible that the id could be incorrect because of something I've written. I simply call the room.getId() method on the server to determine the number each time. If the room didn't exist this would throw a null error... so clearly the room still exists somehow.
Here are our specs:
SmartFoxServer Pro 1.6.6
API 1.5.8
Any thoughts on what's going on here? Why are we seeing these left over "Ghost Rooms"?
Thanks for any help.
Our game has grown rapidly over the past few months, and we're nearly ready to upgrade to the unlimited license as we have several hundred concurrent users at this point. But along with more users comes more problems.
We've encountered a recurring problem regarding joining a room. In our system, battle rooms (game rooms) are created and destroyed rapidly.
After adding several traces, I've discovered that some rooms are "getting stuck" and are never destroyed. The even more interesting thing is that these rooms DO NOT display within the SmartFox AdminTool.
These "Ghost Rooms" are leading to problems because when players in our system attempt to search for a battle, they are often matched to these invisible rooms that seemingly no longer exist.
Here is how I've confirmed that "Ghost Rooms" exist. When a user attempts to find a battle in our game, a request is sent to the server to find an available room on the serverside. To get a list of all available rooms on the server, I call:
Code: Select all
var allRooms = zone.getRooms();Code: Select all
for(i = 0; i < allRooms.length; i++){
if(allRooms[i].isGame() &&
allRooms[i].getName().substr(0, 5) == "AUTO_"){
rooms.push(allRooms[i])
}
}
Code: Select all
var ok = _server.joinRoom(user,
currRoomId,
true,
rooms[i].getId(),
"",
false,
true
);
if(!ok){
trace("join failed!");
trace(" -- username: " + user.getName());
trace(" -- currRoomId: " + currRoomId);
trace(" -- roomId: " + rooms[i].getId());
}
Code: Select all
[ WARNING ] > JavaException: java.lang.NullPointerException: null
[main.as]: join failed!
[main.as]: -- username: tester
[main.as]: -- currRoomId: 8
[main.as]: -- roomId: 137408
[ WARNING ] > JavaException: java.lang.NullPointerException: null
[main.as]: join failed!
[main.as]: -- username: tester2
[main.as]: -- currRoomId: 54
[main.as]: -- roomId: 137408
[ WARNING ] > JavaException: java.lang.NullPointerException: null
[main.as]: join failed!
[main.as]: -- username: tester3
[main.as]: -- currRoomId: 32
[main.as]: -- roomId: 137408
If we restart the server, the "Ghost Rooms" are seemingly cleared because the error will go away for a few days until another room gets stuck, at which point errors will begin firing repeatedly again.
It doesn't seem possible that the id could be incorrect because of something I've written. I simply call the room.getId() method on the server to determine the number each time. If the room didn't exist this would throw a null error... so clearly the room still exists somehow.
Here are our specs:
SmartFoxServer Pro 1.6.6
API 1.5.8
Any thoughts on what's going on here? Why are we seeing these left over "Ghost Rooms"?
Thanks for any help.