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.