Restart server within SFS error

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

Moderators: Lapo, Bax

User avatar
moccha
Posts: 112
Joined: 13 Feb 2014, 16:09

Restart server within SFS error

Postby moccha » 22 Jul 2015, 15:57

I'm running SFS version 2.10.0. As another topic said, I've made sure that all of the file permissions are 755 on the extension folder and everything in it.

I've tried calling the function

Code: Select all

SmartFoxServer.getInstance().restart()
and it works fine locally but in a live enviornment I get the error:

Code: Select all

15:40:20,328 ERROR [pool-1-thread-2] v2.SmartFoxServer     - Restart Failure: java.lang.NullPointerException


Does anyone have an idea on why this may be or how I can better restart the server from within SFS? Thanks a bunch. :|
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart server within SFS error

Postby Lapo » 23 Jul 2015, 10:07

Does the restart work on the live server when invoked from the AdminTool?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
moccha
Posts: 112
Joined: 13 Feb 2014, 16:09

Re: Restart server within SFS error

Postby moccha » 23 Jul 2015, 17:48

In my live environment I am unable to open the port for the webtool so it is disabled. Even though I can't test this, do you have any idea why it may be failing to restart the server or have any suggestions I may try?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart server within SFS error

Postby Lapo » 23 Jul 2015, 18:48

Have you turned off the webserver entirely?
That might explain it. Try turning it on again and re-test.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
moccha
Posts: 112
Joined: 13 Feb 2014, 16:09

Re: Restart server within SFS error

Postby moccha » 23 Jul 2015, 19:11

I definitely tried turning off the webserver itself before trying again, but when i did it again via your suggestion the restart command seems to be working without a null pointer exception. Do you have an idea why? I'm happy but still a bit worried that it might happen again :lol:

Also, since the new update it seems that after I try to "stop" the daemon it says that the daemon is not running, although it is clearly still running as a process via linux command

Code: Select all

ps -u <username>


Anyways, thank you very much for the suggestion. I feel stupid a bit.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart server within SFS error

Postby Lapo » 23 Jul 2015, 19:31

The webserver is used for many things in SFS2X and I suspect you've found a bug in the restart when it's turned off. I've added a ticket in our bug tracker.

As regards shutting down, I have no idea how you can see the process after you have shut down the server.
We have several Linux machines with SFS on them and I am not able to reproduce your problem. "ps" doesn't find any process .

Also we're not aware of any similar bug. Again, is it possible you were running with the web server turned off?
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
moccha
Posts: 112
Joined: 13 Feb 2014, 16:09

Re: Restart server within SFS error

Postby moccha » 23 Jul 2015, 20:28

After additional testing I can confirm I am running into the same error that's reproducible.

If i initiate the command "SmartFoxServer.getInstance().restart()" from the server with the following settings in server.xml, the server successfully reboots itself:

Code: Select all

<webServer>
    <isActive>true</isActive>
    <blueBoxPollingTimeout>26</blueBoxPollingTimeout>
    <blueBoxMsgQueueSize>40</blueBoxMsgQueueSize>
  </webServer>


However, if I set <isActive> to false, I again get the nullPointer error when trying to reboot the server using "SmartFoxServer.getInstance().restart()".

The server runs into a nullPointer exception if the webServer isn't active. For now I will leave it active but hopefully we'll find another solution.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart server within SFS error

Postby Lapo » 24 Jul 2015, 06:47

Thanks.
Keep in mind that disabling the web-server removes the possibility for clients to connect via HTTP-tunnel, which is pretty useful for people behind proxies and firewalls.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
moccha
Posts: 112
Joined: 13 Feb 2014, 16:09

Re: Restart server within SFS error

Postby moccha » 24 Jul 2015, 15:38

Lapo wrote:Thanks.
Keep in mind that disabling the web-server removes the possibility for clients to connect via HTTP-tunnel, which is pretty useful for people behind proxies and firewalls.

cheers


I was not aware of this. Thanks for the info, lapo. I guess I can just keep in enabled. Are there any cons of the web server, such as memory consumption? Also, proxy users sometimes abuse them to bypass IP bans.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart server within SFS error

Postby Lapo » 24 Jul 2015, 16:03

The memory use of the embedded http-server (Jetty 9) is absolutely negligible.
As for bypassing IP bans, SFS2X bans by user name by default.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
moccha
Posts: 112
Joined: 13 Feb 2014, 16:09

Re: Restart server within SFS error

Postby moccha » 24 Jul 2015, 18:16

Do you think there will a feature in the future to ban by both username and IP? I'd really like an option like this.

Thanks for your continued and excellent customer support, Lapo.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart server within SFS error

Postby Lapo » 25 Jul 2015, 08:12

moccha wrote:Do you think there will a feature in the future to ban by both username and IP? I'd really like an option like this.

The option is already there since the earliest version of SFS2X :)

You can ban people by IP in three ways:

1- from the AdminTool > ZoneMonitor: selecting the user and banning him (you can choose between name and ip address)
2- from the AdminTool > ServerConfigurator: you can configure the IP filter to deny access to specific IP addresses
3- from server side code, by calling SFSApi.banUser(...) and passing BanMode.BY_ADDRESS in the relative parameter.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
moccha
Posts: 112
Joined: 13 Feb 2014, 16:09

Re: Restart server within SFS error

Postby moccha » 25 Jul 2015, 16:43

Lapo wrote:
moccha wrote:Do you think there will a feature in the future to ban by both username and IP? I'd really like an option like this.

The option is already there since the earliest version of SFS2X :)

You can ban people by IP in three ways:

1- from the AdminTool > ZoneMonitor: selecting the user and banning him (you can choose between name and ip address)
2- from the AdminTool > ServerConfigurator: you can configure the IP filter to deny access to specific IP addresses
3- from server side code, by calling SFSApi.banUser(...) and passing BanMode.BY_ADDRESS in the relative parameter.

cheers


Sorry for not clarifying, but I meant the ability to ban users by the ip address and the name at the same time. A solution I suppose would be to manually ban by IP after a name ban, but if there was an option like BanMode.BY_BOTH it would be helpful. Again sorry for not clarifying.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 111 guests