Page 1 of 1

Threads are always increasing

Posted: 26 Sep 2016, 08:46
by moonlife
Hello,

I've just installed SmartFoxServer

Thread count in thread pool at Dashboard are constantly increasing after restarting Sfs, and never decrease again until next restart. If I increase thread pool limit, thread count increase up to that limit.

Any extension or services are not running yet, and thread count increases up to 1232 in 10 minutes. So this doesn't seem like a memory leak, because no extension code is involved, just plain SmartFox.

I've tried version 2.9, but results didn't change.

What may cause Sfs threads to that kind of behavior without even running an extension?

Re: Threads are always increasing

Posted: 26 Sep 2016, 09:46
by Lapo
Hi,
are you entirely sure no Extensions are running?
Is this a production server? Is there traffic going on? How many CCU?

Can you grab a thread dump?
http://www.smartfoxserver.com/forums/vi ... 18&t=14458
You can send it zipped to our support@... email box, with a reference to this thread.

Also, is there a specific reason why this was posted un the Java/Android client section? If not I will move it to the generic "SFS2X Questions" section.

Cheers

Re: Threads are always increasing

Posted: 28 Sep 2016, 07:27
by Lapo
Thanks,
we received the thread dump.

There's approximately a 1000 threads like this one:

Code: Select all

"pool-1-thread-877" prio=10 tid=0xaafb0c00 nid=0xd45b waiting on condition [0x99567000]
   java.lang.Thread.State: WAITING (parking)
   at sun.misc.Unsafe.park(Native Method)
   - parking to wait for  <0xb4455f38> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
   at java.util.concurrent.locks.LockSupport.park(Unknown Source)
   at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
   at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
   at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


Which are worker threads of a ScheduledExecutor.

There's two options here:
1- you erroneously configured the "Server task scheduler thread pool size" parameter (AdminTool > Server Config) to a very high value
2- you're running some server side code that created a ScheduledThreadPoolExecutor with a high thread count

hope it helps

Re: Threads are always increasing

Posted: 28 Sep 2016, 18:19
by moonlife
Thank you for your quick response.

I'm using CentOs now. The fact which confuses me is that when I've installed SmartFox to a Windows PC within default configurations, I get into a similar situation about thread count increasing up to between 1100 - 1300.

After that threads doesn't spread up, but that value seemed enormous to me. Am I supposed to install a patch or something else, after Sfs installation? Or might it relative with my Jdk version or anything else?

Re: Threads are always increasing

Posted: 29 Sep 2016, 08:29
by Lapo
A clean installation of SmartFoxServer will start up with 50-100 threads, depending on how many cores your CPU has.

We've have never seen anything like you describe, nor anyone has ever reported something like it in over 6 years so I am inclined to think that there's something else going on.

Especially because the thread dump clearly shows a huge amount of one very specific type of threads, those of a ScheduledThreadPoolExecutor.

If the problem persists we should analyze your server's config.