Closed Thomseeen closed 4 years ago
It doesn’t seem to be a general incompatibility, I can successfully run java -version
while a bot is running.
What does your memory usage look like? (e.g. with free -h
)
Memory seems fine:
free -h
Gesamt belegt frei gemns. Puffer/Cache verfügbar
Speicher: 8,0G 77M 7,8G 1,1M 100M 7,9G
Auslagerungsspeicher: 0B 0B 0B
Thread limit seems fine too:
ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 1030709
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 62987
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END { print num_threads }'
73
File limit too:
lsof -u teamspeak3 | wc -l
346
The only thing I can see and slightly wonder about, is the 20.2GB use of virtual memory the bot is using according to htop
.
This is indeed a weird case. The only related thing I could find is this: https://stackoverflow.com/questions/16789288/java-lang-outofmemoryerror-unable-to-create-new-native-thread Since both runtimes threw while trying to create a new thread:
java.lang.OutOfMemoryError: unable to create native thread
at System.Threading.Thread.StartInternal()
but 73 really isnt a lot of threads, so it would be weird if it would hit the thread limit here.
From what I see in the stacktrace of the bot, this should be the first thread which the bot manually starts. However the dotnet runtime probably will start a few threads too before that.
So far my observations. Stuff you can try:
--no-llgc
, this will use the default garbage collector which (afaik) allocates less threads and cleans up more regularlyTS3AudioBot.runtimeconfig.json
file set the runtimeOptions.configProperties."System.GC.Server"
to false
this should allocate less threads and reserve less memory per thread (see msdn)The only thing I can see and slightly wonder about, is the 20.2GB use of virtual memory
That's normal for dotnet core, since it's only virtual memory it's not really allocated. The real used physical memory will be adjusted and can also shrink again when freed,
So I tried the --no-llgc
option and that runtime option without any positive results.
To check for the thread/task limitation is just opened a bunch of ssh-connections, after about 11 I wasn't able to spawn any more and was unable to start the JVM with the same error as listed above... I had to close half of the ssh-connections to be able to start java -version
... so I guess there is some weird task or thread limitation in place, which I can't find. Guess I will try to contact my hoster's support.
Solved; it was a problem with the threads being limited by Ubuntu.
My hoster uses Virtuozzo which limits the maximum processes per VM-instance in /proc/user_beancounters
- numproc
. This value is 400 for my type of server, which doesn't explain the problems I get at around 60 tasks. It appears Ubuntu takes this value and sets the maximum allowed tasks, according to systemctl show --property=DefaultTasksMax
, to 15% of that by default. 400*0.15=60 so that's where the 60 tasks-limit comes from.
DefaultTasksMax
can be changed in /etc/systemd/system.conf
(120 for me now). Everything works as expected now.
Describe the bug I am unable to start the Java VM alongside the Audio Bot. This is true for
I'm unsure whether this is a bug/issue with your bot or some setup thing as dotnet and java don't like each other. Not being the most advanced Linux user, I tried everything I could find about checking thread- and memory-limits, but without finding anything that's wrong. Maybe someone on here can reproduce my problem or knows, what exactly could cause this.
To Reproduce
java -version
-> crashOR
Version Version: 0.10.1+7 Branch: master CommitHash: 65aa9a18ca5f72f0be9adc6aa93571b9291a9398
Platform
Log Starting TS3AudioBot after any Java program
Starting any Java program after TS3AudioBot