Restarting Smartfox server on new jar

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

Moderators: Lapo, Bax

smartfoxserver2x
Posts: 7
Joined: 27 Sep 2011, 22:40

Restarting Smartfox server on new jar

Postby smartfoxserver2x » 13 Jul 2012, 07:25

On uploading a new jar most of the times all the changes are reflected but sometimes the changes are not reflected, when we restart the server it starts reflecting the changes.

Our app is about to go live soon and would like to know if we happen to upload a new jar, is there any way to have the changes reflect without having to restart the server while in production.
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: Restarting Smartfox server on new jar

Postby itsmylifesoham » 13 Jul 2012, 07:47

go in the zone configurator in the admin tool. go to the zone extension tab. their is a option AUTO for Reload of the extension.
When the server is running and you replace the existing jar with another jar you will not need to restart the server and changes will be reloaded automatically.

however AUTO setting is recommended only for development/testing environment. You should keep this option to MANUAL for production environment.

understanding that you had kept the above discussed option to MANUAL before you go live..you can do this if you are live and want to change the extension without restarting the server :

1. upload your new jar for your zone.
2. go to zone monitor in the admin tool while you are live .
3. click the zone you are changing the extension for and hit monitor selection in the admin tool.
4. go to zone extension tab.
5. under Manual reloading hit the RELOAD button.

this should make the changes come into effect. However note that any previous rooms created in the zone before the upload will continue to use the previous extension ... only new rooms created now on will use the new extension.
wajitarar
Posts: 13
Joined: 12 Aug 2012, 10:28

Re: Restarting Smartfox server on new jar

Postby wajitarar » 24 Aug 2012, 16:17

I am following the same procedure, however, when i press reload button in zone Monitor and Zone extension tab.
Extension does not work at all. When a user is connected to SFS, it disconnects it immediately.
When we restart server, same extension works fine.
itsmylifesoham
Posts: 186
Joined: 16 Oct 2011, 14:33

Re: Restarting Smartfox server on new jar

Postby itsmylifesoham » 24 Aug 2012, 16:54

are you seeing this -

1. you are live and people are logged into the zone
2. you go to zone monitor and press reload for the zone you uploaded the new extension for.
3. the connected users get logged out
?

well i dont think this should be happening, the reload button in the zone monitor is to make the changes on the fly. make sure you are using the latest server and client

http://www.smartfoxserver.com/download/sfs2x#p=updates
wajitarar
Posts: 13
Joined: 12 Aug 2012, 10:28

Re: Restarting Smartfox server on new jar

Postby wajitarar » 28 Aug 2012, 20:57

Connected users are not logged out.
New users are logged out immediately.
I am using patch 2.2.0
wajitarar
Posts: 13
Joined: 12 Aug 2012, 10:28

Re: Restarting Smartfox server on new jar

Postby wajitarar » 28 Aug 2012, 20:58

1. We configured SFS for manual Reload extension (change settings from auto to Manual).
2. Restarted SFS.
3. User wzt Started playing game for few mins, (current extension build #10)
4. replaced Extension (new ext. build # 11) while wzt was playing
5. Hit Reload Button in Zone Monitor. (wzt still playing)
6. wzt kept on playing, (logs show that this user is using build # 10).
7. New user tried to enter a table, Logs show that new user uses Build # 11.
8. new User is Disconnected immediately, Disconnected Event's logs show Build #11 is running.
9. new User tries to enter again, It is able to join room, logs tell that Room Join event is fired for both build #10 and #11.
10. After that it is disconnected immediately. two disconnect events fired, one for build#10 and other for #11
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Restarting Smartfox server on new jar

Postby rjgtav » 29 Aug 2012, 13:13

Hi.
Is this a Room-Level or a Zone-Level Extension?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
wajitarar
Posts: 13
Joined: 12 Aug 2012, 10:28

Re: Restarting Smartfox server on new jar

Postby wajitarar » 30 Aug 2012, 13:37

it is zone level extension
i am using sfs2x
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restarting Smartfox server on new jar

Postby Lapo » 30 Aug 2012, 13:51

Sounds like you are not getting rid of the Extension handlers correctly, which explains the multple logs with different version numbers.
Can you show me what the destroy() method in your main Extension class does?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
wajitarar
Posts: 13
Joined: 12 Aug 2012, 10:28

Re: Restarting Smartfox server on new jar

Postby wajitarar » 30 Aug 2012, 15:09

@Override
public void destroy() {

removeEventHandler(SFSEventType.USER_LOGIN);
removeEventHandler(SFSEventType.USER_JOIN_ROOM );

removeEventHandler(SFSEventType.SPECTATOR_TO_PLAYER );
removeEventHandler(SFSEventType.PLAYER_TO_SPECTATOR );
removeEventHandler(SFSEventType.ROOM_REMOVED );

removeEventHandler(SFSEventType.USER_DISCONNECT );
removeEventHandler(SFSEventType.USER_LOGOUT );

removeEventHandler(SFSEventType.USER_LEAVE_ROOM );

removeEventHandler(SFSEventType.PUBLIC_MESSAGE );

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
removeRequestHandler("chairNumber" );
removeRequestHandler(Command.tableState );
removeRequestHandler(Command.startGame );
removeRequestHandler(Command.userAction );
removeRequestHandler(Command.newRound );
removeRequestHandler(Command.rule );
removeRequestHandler(Command.play );
removeRequestHandler(Command.token );


super.destroy();

}
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restarting Smartfox server on new jar

Postby Lapo » 30 Aug 2012, 15:22

NOTE: you can remove all those manual calls, and just leave the super.destroy() which alone will remove all listeners.
It's not that it will change much, in my opinion, but all those manual removes are redundant and not useful.

There's one more thing to check, are you using the @Instantiation annotation in any of your handlers? If you do that could be the cause.
Lapo

--

gotoAndPlay()

...addicted to flash games
wajitarar
Posts: 13
Joined: 12 Aug 2012, 10:28

Re: Restarting Smartfox server on new jar

Postby wajitarar » 30 Aug 2012, 18:07

when i upload new extension.

this is working fine for all the new users, however, existing live users are having problems.

my previous extension is BUILD #10
after manual Reload my new extension is BUILD #11

All the eventListeners fired for old users from server (like abc extendsBaseServerEventHandler) and eventListeners received from client(like abc extends BaseClientRequestHandler) show that it is BUILD #11. These users are of old extension (BUILD #10).
But server and client listeners' traces show that they are called for BUILd #11.

In these listeners i am accessing extension instance by getParentExtension() method.

please advise
gull
Posts: 1
Joined: 09 Sep 2012, 09:18

Re: Restarting Smartfox server on new jar

Postby gull » 09 Sep 2012, 16:38

Hi,
i am using sfs2x ver. 2.2.0
i have zone level extension.
If i manually reload new extension, old game rooms will keep using old ext and new game rooms will use new extension.
Please correct me if i am wrong.
i have few questions:
1) does manual reload affect old game rooms and old users?
2) if it affects then is there any way that after manual reload my old and new user or rooms are not disturbed?


Note: after manual reload, i want that my current users keep on playing game smoothly, they should not be disturbed by manual reload.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Restarting Smartfox server on new jar

Postby rjgtav » 11 Sep 2012, 11:05

Hi,
If you're manually reloading a Zone-Level extension, after it successfully gets reloaded, all the new requests sent from the clients (old and new) will be processed by the new extension, as the old version gets deleted.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Baidu [Spider] and 113 guests