Java error while restarting Smartfox server

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

Moderators: Lapo, Bax

vokial_voc
Posts: 37
Joined: 24 Oct 2013, 14:17

Java error while restarting Smartfox server

Postby vokial_voc » 07 Nov 2018, 10:25

hi, i'm having problem when restaring smartfox, and this is the thread dump

Code: Select all

"SocketAcceptor-2" #32 prio=5 os_prio=0 tid=0x00007f6fa4b25000 nid=0x2c71 waiting for monitor entry [0x00007f6f86bdd000]
  java.lang.Thread.State: BLOCKED (on object monitor)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:81)
    - waiting to lock <0x00000000c0fcd480> (a sun.nio.ch.EPollSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
    at com.smartfoxserver.bitswarm.core.SocketAcceptor.acceptLoop(SocketAcceptor.java:181)
    at com.smartfoxserver.bitswarm.core.SocketAcceptor.run(SocketAcceptor.java:160)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

"SocketAcceptor-1" #31 prio=5 os_prio=0 tid=0x00007f6fa4b23000 nid=0x2c70 runnable [0x00007f6f86cde000]
  java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
    at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
    at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
    - locked <0x00000000c0fcd4d8> (a sun.nio.ch.Util$3)
    - locked <0x00000000c0fcd4c8> (a java.util.Collections$UnmodifiableSet)
    - locked <0x00000000c0fcd480> (a sun.nio.ch.EPollSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
    at com.smartfoxserver.bitswarm.core.SocketAcceptor.acceptLoop(SocketAcceptor.java:181)
    at com.smartfoxserver.bitswarm.core.SocketAcceptor.run(SocketAcceptor.java:160)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)


can you help me to find the problem, here is some of my server information, i create two zone, zona A and zone B, zone B has smarrtfox ciient and connect to zone A, both zone have TaskScheduler thread and got canceled when extension destroyed.

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

Re: Java error while restarting Smartfox server

Postby Lapo » 07 Nov 2018, 10:35

Hi,
what is the problem when restarting? Doesn't the server restart?
If not, are there any errors server side?

thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
vokial_voc
Posts: 37
Joined: 24 Oct 2013, 14:17

Re: Java error while restarting Smartfox server

Postby vokial_voc » 07 Nov 2018, 10:57

hi lapo, the problem is the server won't start until i kill the java process in linux
User avatar
Lapo
Site Admin
Posts: 20392
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java error while restarting Smartfox server

Postby Lapo » 07 Nov 2018, 15:10

Sounds strange, but maybe the client API connection is preventing the complete shutdown?
You may try to detect the shutdown signal with a Shutdown hook and close the client connections.
https://www.geeksforgeeks.org/jvm-shutdown-hook-java/

How are you restarting the server? Via the admin tool?
Have you tried from the service restart instead?

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
vokial_voc
Posts: 37
Joined: 24 Oct 2013, 14:17

Re: Java error while restarting Smartfox server

Postby vokial_voc » 08 Nov 2018, 07:26

hi lapo, so you guest client API connection has problem? i'll check into it,

i never use admin tool for restart, i ussually use

Code: Select all

./sfs2x-service start/stop

for restart
User avatar
Lapo
Site Admin
Posts: 20392
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java error while restarting Smartfox server

Postby Lapo » 08 Nov 2018, 08:36

That's quite strange that it doesn't stop/restart when using the service command.
Maybe you could try modify your Extension so that it doesn't start any client connections and then try the restart. If it works as expected then it's probably due to the client, though I still find it strange...

Let us know what you find.
Lapo

--

gotoAndPlay()

...addicted to flash games
vokial_voc
Posts: 37
Joined: 24 Oct 2013, 14:17

Re: Java error while restarting Smartfox server

Postby vokial_voc » 15 Nov 2018, 11:17

hi lapo, sorry for late reply,
after removing client connection from code, i got this error when restaring server, stress test with around 1k users

Code: Select all

Exception: com.smartfoxserver.v2.exceptions.SFSRuntimeException
Message: java.nio.channels.ClosedChannelException
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.api.SFSApi.disconnectUser(SFSApi.java:300)
com.smartfoxserver.v2.entities.SFSZone.removeAllUsers(SFSZone.java:1217)
mbs.quiz.trivia.QuizTriviaZoneExtension$DiconnectAll.run(QuizTriviaZoneExtension.java:978)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
User avatar
Lapo
Site Admin
Posts: 20392
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Java error while restarting Smartfox server

Postby Lapo » 15 Nov 2018, 15:01

Hi,
it doesn't look like a particular issue. You have invoked the removeAllUsers() method and one of the clients has probably just disconnected causing an exception. It's not a problem.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 21 guests