Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Threads are always increasing

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?

like image 367
Aycan Yaşıt Avatar asked Sep 06 '16 19:09

Aycan Yaşıt


2 Answers

A good start would be to try and determine what all the threads are. You can use jstack (included in the JDK) to get stack dumps of all the threads which should help you discover their purpose and hopefully how to reduce their number.

jstack -l JAVA_PID > jstack.out
like image 140
tul Avatar answered Sep 19 '22 22:09

tul


You have memory leaks.

» Memory leaks

In Java a memory leak occurs when objects in memory are not released even though the application itself no longer needs them. A common example is unused event listeners that aren't removed from their event source.

If the program keeps adding new listener objects but never gets rid of those that are no longer used, we will end up with potentially lots of memory waste. The GC won't be able to regain such memory because the unused listeners are still referenced. If these objects keep piling up we will see a progressive performance degradation which may end up in a JVM crash.

Memory leaks are not always very obvious to find, lurking in the code for quite some time before they are spotted. In other instances the leaks can become very nasty very quickly causing major spikes in the memory usage and ultimately the death of the process.
Source: http://docs2x.smartfoxserver.com/AdvancedTopics/troubleshooting-live-server#mem

like image 27
Sky Voyager Avatar answered Sep 19 '22 22:09

Sky Voyager