Problem: Server won't launch

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

Moderators: Lapo, Bax

Post Reply
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Problem: Server won't launch

Post by Damace »

I made a shell script in /usr/bin, that was supposed to execute sfs2x.sh, so I could start SmartFox Server from any directory.
The script didn't work, and now when I try to launch the server with the native sfs2x.sh, it throws this exception.

Exception: java.net.BindException
Message: Address already in use
Description: Unexpected error during Server boot. The server cannot start.
Solution: Please email us the content of this error message, including the stack trace to support@smartfoxserver.com
+--- --- ---+
Stack Trace:
+--- --- ---+
sun.nio.ch.Net.bind(Native Method)
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:315)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
org.mortbay.jetty.Server.doStart(Server.java:235)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
com.smartfoxserver.v2.http.SFSHttpServer.start(SFSHttpServer.java:110)
com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:231)
com.smartfoxserver.v2.Main.main(Main.java:31)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Tried to reinstall the server - didn't work.
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Post by Damace »

Uninstalled. Deleted the SFS2X installation folder. Restarted. Installed RC1a, updated to RC3. Up and running..
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

The error message simply meant that you had another instance of SFS2X already running (probably as a service).
Paolo Bax
The SmartFoxServer Team
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Post by Damace »

I want to be able to restart the SFS from the AdminTool, but something is wrong, and I don't know what.

Here is what I do:

1) Install SFS2X
2) Go to AdminTool
3) Do something
4) Press restart button in the AdminTool so the changes will take place
5) Get an error saying ./sfs2x.sh permission denied
6) Goto terminal to fix the permissions on the sfs2x.sh
7) chmod go+x sfs2x.sh
8) Start the server again via SFS2X.app
9) Try to restart it from the AdminTool
10) Don't get the permissions error, but get the error from the first post
11) Listen to smart people on the forum and try to shut down the sfs2x-service (./sfs2x-service stop)
12) Try to start the server again and get this:

Code: Select all

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.net.BindException
Message: Address already in use
Description: Unexpected error during Server boot. The server cannot start.
Solution: Please email us the content of this error message, including the stack trace to support@smartfoxserver.com
+--- --- ---+
Stack Trace:
+--- --- ---+
sun.nio.ch.Net.bind(Native Method)
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:315)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
org.mortbay.jetty.Server.doStart(Server.java:235)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
com.smartfoxserver.v2.http.SFSHttpServer.start(SFSHttpServer.java:110)
com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:231)
com.smartfoxserver.v2.Main.main(Main.java:31)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I must say that all of this is just to get the Restart button in the AdminTool to work. And it is still not working.
jurekf
Posts: 69
Joined: 08 Dec 2010, 23:46

Post by jurekf »

It's the Jetty web server in SFS that can't start because another web server has already taken its preferred port. There's another thread on the forum with the same problem but I can't find it now.

1. Shut down SFS2X
2. Go to http://localhost:8080
3. Figure out what webserver that is, and shut it down as well
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Post by Damace »

If I shutdown SFS2X then http://localhost:8080/ doesn't load.
jurekf
Posts: 69
Joined: 08 Dec 2010, 23:46

Post by jurekf »

Perhaps SFS2X is starting twice. Check TaskManager or ps -A and see how many java processes are started.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Which operating system are you using?
Paolo Bax
The SmartFoxServer Team
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Post by Damace »

When I first start SFS2X there is only 1 java process:

Code: Select all

mys-macbook-air:bin Damace$ ps -ax | grep java
 4154 ??         0:10.82 /usr/bin/java -cp ./:build/:lib/*:lib/Jetty/*:extensions/__lib__/* -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main
When I hit the restart button, the SFS2X.app shows this log:

Code: Select all

17:02:36,822 INFO  [com.smartfoxserver.v2.controllers.ExtensionController-1] Extensions     - {Admin}: Restarting SmartFoxServer... 
17:02:36,827 WARN  [com.smartfoxserver.v2.controllers.ExtensionController-1] v2.SmartFoxServer     - *** SERVER RESTARTING ***
17:02:37,898 WARN  [SocketWriter-1] core.SocketWriter     - SocketWriter thread interruped: Thread[SocketWriter-1,5,main]
17:02:37,897 WARN  [Scheduler1-thread-1] bootLogger     - Scheduler: scheduler interrupted.
17:02:40,405 INFO  [com.smartfoxserver.v2.controllers.ExtensionController-1] controllers.SystemController     - Controller stopping: com.smartfoxserver.v2.controllers.SystemController, Unprocessed tasks: 0
17:02:40,405 INFO  [com.smartfoxserver.v2.controllers.ExtensionController-1] controllers.ExtensionController     - Controller stopping: com.smartfoxserver.v2.controllers.ExtensionController, Unprocessed tasks: 0
17:02:40,405 WARN  [com.smartfoxserver.v2.controllers.SystemController-1] controllers.SystemController     - Controller main loop was interrupted
17:02:40,408 INFO  [com.smartfoxserver.v2.controllers.ExtensionController-1] sessions.DefaultSessionManager     - Session removed: { Id: 2, Type: DEFAULT, Logged: Yes, IP: 127.0.0.1:54544 }
17:02:40,410 WARN  [com.smartfoxserver.v2.controllers.SystemController-1] controllers.SystemController     - 
java.lang.InterruptedException
	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:1961)
	java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
	java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:220)
	com.smartfoxserver.bitswarm.controllers.AbstractController.run(AbstractController.java:95)
	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	java.lang.Thread.run(Thread.java:680)

17:02:40,416 WARN  [com.smartfoxserver.v2.controllers.ExtensionController-1] bootLogger     - Error when shutting down Accept selector: sleep interrupted
17:02:40,417 WARN  [com.smartfoxserver.v2.controllers.ExtensionController-1] bootLogger     - 
java.lang.InterruptedException: sleep interrupted
	java.lang.Thread.sleep(Native Method)
	com.smartfoxserver.bitswarm.core.SocketAcceptor.destroy(SocketAcceptor.java:118)
	com.smartfoxserver.bitswarm.core.BitSwarmEngine.stopCoreServices(BitSwarmEngine.java:397)
	com.smartfoxserver.bitswarm.core.BitSwarmEngine.shutDownSequence(BitSwarmEngine.java:311)
	com.smartfoxserver.v2.SmartFoxServer.restart(SmartFoxServer.java:308)
	com.smartfoxserver.v2.admin.handlers.AdminReqHandler.handleClientRequest(AdminReqHandler.java:50)
	com.smartfoxserver.v2.extensions.SFSExtension.handleClientRequest(SFSExtension.java:192)
	com.smartfoxserver.v2.controllers.ExtensionController.processRequest(ExtensionController.java:137)
	com.smartfoxserver.bitswarm.controllers.AbstractController.run(AbstractController.java:96)
	java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	java.lang.Thread.run(Thread.java:680)

17:02:40,488 INFO  [:::SFSRestarter:::] util.SFSRestart     - Process restarted: java.lang.UNIXProcess@5e9c8834
17:02:44,498 WARN  [SFS2X ShutdownHook] core.SFSShutdownHook     - SFS2X is shutting down. The process may take a few seconds...
17:02:44,501 INFO  [Thread-1] managers.SFSZoneManager     - BuddyList saveAll...
17:02:44,520 INFO  [Thread-2] managers.SFSBannedUserManager     - BanUser data saved.

Now if I check the java processes, then there is still 1 running, differing from the first one, but there is no instance of SFS:

Code: Select all

mys-macbook-air:bin Damace$ ps -ax | grep java
 4646 ??         0:07.64 /usr/bin/java -cp ./:lib/*:lib/Jetty/*:extensions/__lib__/* -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main
Lastly if I try to start up SFS2X.app, then this log comes up:

Code: Select all

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.net.BindException
Message: Address already in use
Description: Unexpected error during Server boot. The server cannot start.
Solution: Please email us the content of this error message, including the stack trace to support@smartfoxserver.com
+--- --- ---+
Stack Trace:
+--- --- ---+
sun.nio.ch.Net.bind(Native Method)
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:126)
sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:315)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
org.mortbay.jetty.Server.doStart(Server.java:235)
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
com.smartfoxserver.v2.http.SFSHttpServer.start(SFSHttpServer.java:110)
com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:231)
com.smartfoxserver.v2.Main.main(Main.java:31)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
And if I check my java processes after this then there are 2 running:

Code: Select all

mys-macbook-air:bin Damace$ ps -ax | grep java
 4646 ??         0:08.29 /usr/bin/java -cp ./:lib/*:lib/Jetty/*:extensions/__lib__/* -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main
 4655 ??         0:06.86 /usr/bin/java -cp ./:build/:lib/*:lib/Jetty/*:extensions/__lib__/* -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main
2 bax: I running OS X 1.6.7

P.S. It is definitely about too much SFS2X running at the same time, because after all that I just described I did "jps -l" and 2 smartfoxserver processes came up. I killed them and successfully started SFS2X.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

You should read the informations about the Restart feature contained in the yellow box near the bottom of this page.
The restart is working fine (those errors you see are normal and make no harm): it simply creates a new process which isn't running in the terminal anymore. In fact if you try to connect to the server instance using the AdminTool, you will succeed.
Paolo Bax
The SmartFoxServer Team
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Post by Damace »

Yes, I already read that.

Problem is that when I restart the server from the AdminTool SFS2X.app stops logging and the only button left for me to press is "Quit". Is that supposed to be that way - no visible logs after restart from AdminTool?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

Not in the terminal window, but the SFS log files are still updated of course.
Paolo Bax
The SmartFoxServer Team
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Post by Damace »

I don't use terminal window, I only use SFS2X.app and AdminTool.

I'll rephrase - Is there a way to restart SFS2X from AdminTool and after that see real-time the logs in SFS2X.app like it was just opened? Because right now after restart I can only close SFS2X.app.
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post by Bax »

SFS2X.app is just a wrapped terminal window, more or less.
Anyway, the answer is no: the restart button of the AdminTool terminates the current process (the one started by SFS2X.app) and launches a new one executing the startup script directly.
Paolo Bax
The SmartFoxServer Team
Damace
Posts: 58
Joined: 04 Jul 2011, 16:45

Post by Damace »

Ok, I guess this sums it up.
Post Reply