Extension stops handling requests

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

mlindsayea
Posts: 8
Joined: 05 Jan 2012, 18:15
Location: Redwood Shores

Extension stops handling requests

Postby mlindsayea » 30 Jan 2012, 23:44

I have a custom extension I created using the class serialization tutorial with the addition of dumping data to mysql on sync from client. It works fine for a few minutes, then it just stops handing the request off to my extension handler. I've been scouring the logs and there's nothing to indicate what changed. Here is what happens with a working request...

Code: Select all

30 Jan 2012 15:31:13,693 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - Binary size: 257
80 00 FE 12 00 03 00 01 63 02 01 00 01 61 03 00    ........c....a..
...blah blah blah binary packet data...
74 65 73 74 54 75 62 65 4C 6F 6F 74 04 00 00 00    testTubeLoot....
01                 
30 Jan 2012 15:31:13,693 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - STATE: WAIT_NEW_PACKET
30 Jan 2012 15:31:13,693 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - NORMAL SIZED PACKET: 254
30 Jan 2012 15:31:13,694 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - <<< PACKET COMPLETE >>>
30 Jan 2012 15:31:13,694 DEBUG [SocketReader] v2.protocol.SFSProtocolCodec     -
   (short) a: 13
   (byte) c: 1
   (sfs_object) p:
      (int) r: -1
      (utf_string) c: setModel
      (sfs_object) p:
         (class) inventory: gamelib.users.model.UserInventoryModel

30 Jan 2012 15:31:13,695 DEBUG [com.smartfoxserver.v2.controllers.ExtensionController-1] v2.controllers.ExtensionController     - [Req Type: (Tcp), Prt: { NORMAL }, Sender: { Id: 6, Type: DEFAULT, Logged: Yes, IP: 10.15.125.9:30479 }]
30 Jan 2012 15:31:13,695 DEBUG [com.smartfoxserver.v2.controllers.ExtensionController-1] v2.controllers.ExtensionController     -
   (int) r: -1
   (utf_string) c: setModel
   (sfs_object) p:
      (class) inventory: gamelib.users.model.UserInventoryModel
30 Jan 2012 15:31:13,696 INFO  [com.smartfoxserver.v2.controllers.ExtensionController-1] Extensions     - {mygame}: Received Model: {"inventory":{"resource":{"itemA":1,"itemB":1,"itemC":1,"itemD":1}}}


Then suddenly, the very next request does this:

Code: Select all

30 Jan 2012 15:32:18,854 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - Binary size: 275
80 01 10 12 00 03 00 01 63 02 01 00 01 61 03 00    ........c....a..
...blah blah blah binary packet data...
00 0C 74 65 73 74 54 75 62 65 4C 6F 6F 74 04 00    ..testTubeLoot..
00 00 01                                           ...             

30 Jan 2012 15:32:18,854 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - STATE: WAIT_NEW_PACKET
30 Jan 2012 15:32:18,854 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - NORMAL SIZED PACKET: 272
30 Jan 2012 15:32:18,855 DEBUG [SocketReader] protocol.binary.BinaryIoHandler     - <<< PACKET COMPLETE >>>
30 Jan 2012 15:32:18,855 DEBUG [SocketReader] v2.protocol.SFSProtocolCodec     -
   (short) a: 13
   (byte) c: 1
   (sfs_object) p:
      (int) r: -1
      (utf_string) c: setModel
      (sfs_object) p:
         (class) inventory: gamelib.users.model.UserInventoryModel

but doesn't move on to this:

Code: Select all

30 Jan 2012 15:31:13,695 DEBUG [com.smartfoxserver.v2.controllers.ExtensionController-1] v2.controllers.ExtensionController     - [Req Type: (Tcp), Prt: { NORMAL }, Sender: { Id: 6, Type: DEFAULT, Logged: Yes, IP: 10.15.125.9:30479 }]


Restarting the SFS2X service gets it working again.

Any idea's how I can track this down?

Many Thanks!
mlindsayea
Posts: 8
Joined: 05 Jan 2012, 18:15
Location: Redwood Shores

[SOLVED] Extension stops handling requests

Postby mlindsayea » 31 Jan 2012, 17:27

I wasn't closing the connection in one of my models. No exception was thrown. Don't forget to close those connections and statements!
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Postby appels » 31 Jan 2012, 18:19

The database connection ?
mlindsayea
Posts: 8
Joined: 05 Jan 2012, 18:15
Location: Redwood Shores

Postby mlindsayea » 31 Jan 2012, 20:02

Yes. Base model now has a cleanup script I run after it's finished it's business:

Code: Select all

   protected void dbClose()
   {
      // Return connection to the DBManager connection pool
      if(connection != null)
      {
         try {
            connection.close();
         } catch (SQLException e) {
            Logger.getLogger(UserModel.class).warn("Unable to close connection: " + e.toString());
         }
      }
      
      // Dispose Prepared Statement
      if(stmt != null)
      {
         try {
            stmt.close();
         } catch (SQLException e) {
            Logger.getLogger(UserModel.class).warn("Unable to close statment: " + e.toString());
         }
      }
      
      // Dispose Result set
      if(rs != null)
      {
         try {
            rs.close();
         } catch (SQLException e) {
            Logger.getLogger(UserModel.class).warn("Unable to close Result Set: " + e.toString());
         }
      }
   }

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 42 guests