Restart SFS2X from Web Admin Panel Fails

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

Moderators: Lapo, Bax

albymack
Posts: 17
Joined: 09 May 2022, 21:17

Restart SFS2X from Web Admin Panel Fails

Postby albymack » 09 May 2022, 21:27

I'm using SFS2X version 2.18
Running Ubuntu 20.4 on Linode VSP, 1 core, 4 gigs memory
Installed using user smartfoxuser rather than root
Installed with SSL enabled
Running as a daemon per instructions on your website.
Here's my smartfox.service daemon script:

[Unit]
Description=SmartFoxServer 2X
After=network.target

[Service]
Type=forking
User=smartfoxuser
LimitNOFILE=100000
WorkingDirectory=/home/smartfoxuser/smartfoxserver/SmartFoxServer_2X/SFS2X
ExecStart=/home/smartfoxuser/smartfoxserver/SmartFoxServer_2X/SFS2X/sfs2x-service start
ExecStop=/home/smartfoxuser/smartfoxserver/SmartFoxServer_2X/SFS2X/sfs2x-service stop
Restart=on-abort

[Install]
WantedBy=multi-user.target

The server seems to run fine using systemctl start smartfox.service. I can access web admin panel via port 8443.

I am able to restart server via linux command line systemct restart smartfox.service. That seems to work just fine.

The problem is that when I use the button in the web admin to restart the server, it seems to fail to restart the server. Looking at the smartfox.log, I get this:

09 May 2022 | 21:15:35,143 | INFO | SFSWorker:Ext:2 | Extensions | | {Admin}: Restarting SmartFoxServer...
09 May 2022 | 21:15:35,144 | WARN | SFSWorker:Ext:2 | smartfoxserver.v2.SmartFoxServer | | *** SERVER RESTARTING ***
09 May 2022 | 21:15:35,145 | WARN | SocketWriter::TCP-3 | bitswarm.core.SocketWriter | | SocketWriter::TCP thread interrupted
java.lang.InterruptedException
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2056)
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2090)
at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
at com.smartfoxserver.bitswarm.core.SocketWriterV3$TCPWriteRunner.run(SocketWriterV3.java:818)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
09 May 2022 | 21:15:35,145 | INFO | SocketWriter::TCP-3 | bitswarm.core.SocketWriter | | SocketWriter::TCP threadpool shutting down.
09 May 2022 | 21:15:35,146 | WARN | SocketWriter::TCP-2 | bitswarm.core.SocketWriter | | SocketWriter::TCP thread interrupted
java.lang.InterruptedException
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2056)
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2090)
at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
at com.smartfoxserver.bitswarm.core.SocketWriterV3$TCPWriteRunner.run(SocketWriterV3.java:818)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
09 May 2022 | 21:15:35,146 | INFO | SocketWriter::TCP-2 | bitswarm.core.SocketWriter | | SocketWriter::TCP threadpool shutting down.
09 May 2022 | 21:15:35,146 | WARN | SocketWriter::TCP-1 | bitswarm.core.SocketWriter | | SocketWriter::TCP thread interrupted
java.lang.InterruptedException
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2056)
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2090)
at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
at com.smartfoxserver.bitswarm.core.SocketWriterV3$TCPWriteRunner.run(SocketWriterV3.java:818)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
09 May 2022 | 21:15:35,146 | INFO | SocketWriter::TCP-1 | bitswarm.core.SocketWriter | | SocketWriter::TCP threadpool shutting down.
09 May 2022 | 21:15:35,146 | WARN | SocketWriter::UDP-1 | bitswarm.core.SocketWriter | | SocketWriter::UDP thread interrupted
java.lang.InterruptedException
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2056)
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2090)
at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
at com.smartfoxserver.bitswarm.core.SocketWriterV3$UDPWriteRunner.run(SocketWriterV3.java:857)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
09 May 2022 | 21:15:35,147 | INFO | SocketWriter::UDP-1 | bitswarm.core.SocketWriter | | SocketWriter::UDP threadpool shutting down.
09 May 2022 | 21:15:35,146 | WARN | SocketWriter::UDP-2 | bitswarm.core.SocketWriter | | SocketWriter::UDP thread interrupted
java.lang.InterruptedException
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2056)
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2090)
at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
at com.smartfoxserver.bitswarm.core.SocketWriterV3$UDPWriteRunner.run(SocketWriterV3.java:857)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
09 May 2022 | 21:15:35,147 | INFO | SocketWriter::UDP-2 | bitswarm.core.SocketWriter | | SocketWriter::UDP threadpool shutting down.
09 May 2022 | 21:15:35,146 | WARN | SocketWriter::UDP-3 | bitswarm.core.SocketWriter | | SocketWriter::UDP thread interrupted
java.lang.InterruptedException
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2056)
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2090)
at java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
at com.smartfoxserver.bitswarm.core.SocketWriterV3$UDPWriteRunner.run(SocketWriterV3.java:857)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
09 May 2022 | 21:15:35,148 | INFO | SocketWriter::UDP-3 | bitswarm.core.SocketWriter | | SocketWriter::UDP threadpool shutting down.
09 May 2022 | 21:15:35,151 | WARN | SocketReader | bitswarm.core.SocketReader | | Problems in SocketReader main loop: java.lang.InterruptedException: sleep interrupted, Thread: Thread[SocketReader,5,main]
09 May 2022 | 21:15:35,152 | WARN | SocketReader | bitswarm.core.SocketReader | | java.lang.InterruptedException: sleep interrupted
java.base/java.lang.Thread.sleep(Native Method)
com.smartfoxserver.bitswarm.core.SocketReader.run(SocketReader.java:173)
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java.base/java.lang.Thread.run(Thread.java:829)

09 May 2022 | 21:15:38,146 | INFO | SFSWorker:Ext:2 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 3, Type: DEFAULT, Logged: Yes, IP: 67.188.152.247:50086 }
09 May 2022 | 21:15:38,146 | INFO | SFSWorker:Ext:2 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 5, Type: WEBSOCKET, Logged: Yes, IP: 67.188.152.247:60670 }
09 May 2022 | 21:15:38,147 | INFO | SFSWorker:Sys:1 | v2.api.SFSApi | | User disconnected: { Zone: --=={{{ AdminZone }}}==-- }, ( User Name: albert2, Id: 4, Priv: 0, Sess: 67.188.152.247:60670 ) , SessionLen: 19761, Type: JavaScript
09 May 2022 | 21:15:38,147 | INFO | SFSWorker:Ext:2 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 5, Type: WEBSOCKET, Logged: No, IP: 67.188.152.247:60670 }
09 May 2022 | 21:15:38,147 | INFO | SFSWorker:Ext:2 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 6, Type: WEBSOCKET, Logged: Yes, IP: 67.188.152.247:60695 }
09 May 2022 | 21:15:38,148 | INFO | SFSWorker:Sys:4 | v2.api.SFSApi | | User disconnected: { Zone: --=={{{ AdminZone }}}==-- }, ( User Name: albert1, Id: 5, Priv: 0, Sess: 67.188.152.247:60695 ) , SessionLen: 15767, Type: JavaScript
09 May 2022 | 21:15:38,148 | INFO | SFSWorker:Ext:2 | bitswarm.sessions.DefaultSessionManager | | Session removed: { Id: 6, Type: WEBSOCKET, Logged: No, IP: 67.188.152.247:60695 }
09 May 2022 | 21:15:38,661 | INFO | :::SFSRestarter::: | v2.util.SFSRestart | | Process restarted: Process[pid=11033, exitValue="not exited"]
09 May 2022 | 21:15:39,204 | INFO | Thread-3 | entities.managers.SFSZoneManager | | BuddyList saveAll...
09 May 2022 | 21:15:39,205 | INFO | Thread-4 | entities.managers.SFSBannedUserManager | | BanUser data saved.
09 May 2022 | 21:15:39,206 | WARN | SFS2X ShutdownHook | v2.core.SFSShutdownHook | | SFS2X is shutting down. The process may take a few seconds...
09 May 2022 | 21:15:39,918 | INFO | main | smartfoxserver.v2.SmartFoxServer | | Boot sequence starts...
09 May 2022 | 21:15:39,930 | INFO | Thread-0 | entities.managers.SFSZoneManager | | BuddyList saveAll...



Any ideas what might be going on? Perhaps it's a permission problem with the smartfoxuser that I'm running the process as? Is there more detailed instructions on running SFS2X as something other than root, as most of the instructions seem to assume root user?

I'd like to use the web admin's soft restart so that destructs are properly called on my extensions and db connections can be properly cleaned up.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart SFS2X from Web Admin Panel Fails

Postby Lapo » 10 May 2022, 12:10

Hi,
from those log messages it doesn't look like there's any specific issue during the restart. It is expected to see several "Thread interrupted" messages while restarting because that's what is going to inevitably happen during the process: several threads are going to be interrupted.

Unless you're having issues getting the server back online you can disregard those messages.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
albymack
Posts: 17
Joined: 09 May 2022, 21:17

Re: Restart SFS2X from Web Admin Panel Fails

Postby albymack » 10 May 2022, 17:44

There's a problem with the server not actually restarting.
If I use systemctl restart smartfox.service, the server restarts propertly. I'm able to relogin to web admin and my server is actually running (connected to with unity client)

If I use the button in the web admin to restart the server, I'm not actually able to relogin to the webadmin and the server is not accessible via unity client.

On that server, using root, I use top -u smartfoxuser to see if the server is running. And I can see it running but then the process disappears, and then it reappears, and then it disappears, over and over again as if the server is restarting and failing to restart and restarting over and over again.

There's nothing unusual in the boot.log file. The smartfox.log file doesn't seem to show the server restarting over and over again.
albymack
Posts: 17
Joined: 09 May 2022, 21:17

Re: Restart SFS2X from Web Admin Panel Fails

Postby albymack » 10 May 2022, 18:06

Looking at boot.log after hitting the webadmin restart button

10 May 2022 | 18:09:37,492 | WARN | Scheduler1-thread-1 | bootLogger | | Scheduler: scheduler interrupted.
10 May 2022 | 18:09:37,493 | INFO | SFSWorker:Ext:4 | bootLogger | | Scheduler stopped. Unprocessed tasks: 0
10 May 2022 | 18:09:37,501 | INFO | SFSWorker:Ext:4 | bootLogger | | SocketWriter v3 stopped. Unprocessed TCP tasks: 0, UDP Tasks: 0
10 May 2022 | 18:09:37,502 | INFO | SocketReader | bootLogger | | SocketReader threadpool shutting down.
10 May 2022 | 18:09:38,004 | INFO | SFSWorker:Ext:4 | bootLogger | | SocketReader stopped. Unprocessed tasks: 0
10 May 2022 | 18:09:38,504 | INFO | DatagramReader | bootLogger | | DatagramReader thread(s) shutting down.
10 May 2022 | 18:09:40,520 | INFO | SFSWorker:Ext:4 | bootLogger | | Security Manager stopped
10 May 2022 | 18:09:40,521 | INFO | SocketAcceptor-1 | bootLogger | | SocketAcceptor threadpool shutting down.
10 May 2022 | 18:09:41,022 | INFO | SFSWorker:Ext:4 | bootLogger | | SocketAcceptor stopped. Unprocessed tasks: 0


That's all there is. it doesn't look like it's restarting at all.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart SFS2X from Web Admin Panel Fails

Postby Lapo » 11 May 2022, 09:16

Hi,
sounds really strange, but I was able to reproduce it on a local Ubuntu 20.x
It sounds strange because we've been using Ubuntu for over a decade for both testing and production and have never seen this behavior before. In fact our Overcast service uses Ubuntu (18.x) with SFS2X 2.18 and it works flawlessly. Still on 20.x it does appear to fail, using the same setup.

At this time we have no idea what might be going on. It needs further investigation.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
albymack
Posts: 17
Joined: 09 May 2022, 21:17

Re: Restart SFS2X from Web Admin Panel Fails

Postby albymack » 14 Jun 2022, 17:17

Just wondering if there's been any new insights regarding this problem?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart SFS2X from Web Admin Panel Fails

Postby Lapo » 16 Jun 2022, 13:18

Sorry, no. Not yet.
Lapo

--

gotoAndPlay()

...addicted to flash games
albymack
Posts: 17
Joined: 09 May 2022, 21:17

Re: Restart SFS2X from Web Admin Panel Fails

Postby albymack » 30 Jun 2022, 21:18

So I was experimenting with the smartfox.service script that starts up smartfox server on ubuntu 20.04.

I changed it to this and now the smartfox server restart server button from the admin panel seems to restart the smartfox server after it goes down.

------------------------------
[Unit]
Description=SmartFoxServer 2X
After=network.target

[Service]
Type=forking
User=smartfoxuser
Group=nogroup
LimitNOFILE=100000
WorkingDirectory=/home/smartfoxuser/smartfoxserver/SmartFoxServer_2X/SFS2X
ExecStart=/home/smartfoxuser/smartfoxserver/SmartFoxServer_2X/SFS2X/sfs2x-service start
ExecStop=/home/smartfoxuser/smartfoxserver/SmartFoxServer_2X/SFS2X/sfs2x-service stop
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

--------------

Note that in my case, I am running smartfoxserver as non-root user (smartfoxuser). The main change is to change the line Restart=always. I don't know if this is some change to the systemd Restart=on-abort that caused smartfox server to not restart itself after hitting the restart button.

I don't know enough about systemd to know what ramifications the changes I made might have. Anyway, how this helps somebody else who may be running into this problem.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart SFS2X from Web Admin Panel Fails

Postby Lapo » 01 Jul 2022, 06:37

Thanks for the update, we'll experiment with the change you have suggested.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart SFS2X from Web Admin Panel Fails

Postby Lapo » 01 Jul 2022, 07:35

It kind of works for the restart on Ubuntu 20 and higher (22 is the same) but it doesn't for the "Stop Server" command in the sense that the server gets stopped but because of the new directive the OS will restart it again.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Restart SFS2X from Web Admin Panel Fails

Postby Lapo » 01 Jul 2022, 15:20

I have one more update that may be used as a workaround. After testing on Ubuntu 22 we found that setting this:

Code: Select all

Restart=on-failure

produces the desired effect and also doesn't affect the stop command, which instead wouldn't work when set to "always".
I am not sure if this will be the final solution, but for the time-being it seems to solve the problem.

If you want, give it a try and let us know. We should be able to ship a definitive fix in the next release.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
albymack
Posts: 17
Joined: 09 May 2022, 21:17

Re: Restart SFS2X from Web Admin Panel Fails

Postby albymack » 01 Jul 2022, 18:22

That seemed to work.

Return to “SFS2X Questions”

Who is online

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