• If you need help or want to discuss things, you now can also join us on our Discord Server!

Linux VPS: Can't start more than 4 bots.

Karate_Creeper

Active Member
Hi there,
At first I share all information needed as given by the "Read me before you post!"

General specs and stats:

Sinusbot version: 1.0.0-beta.1-06a54d7 (Latest!)
TeamSpeak Client Version: 3.2.5 Stable (Latest!)
TeamSpeak Server Version: 3.7.1 Stable (Latest!)

Ubuntu 18.04. 64 bit OS running Plesk
Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz 8 Core Linux VPS
16GB Ram

config.ini:
Code:
TS3Path = "/opt/sinusbot/teamspeak3-client/ts3client_linux_amd64"
ListenHost = "0.0.0.0"
DataDir = "/opt/sinusbot/data/"
ListenPort = 8087
LocalPlayback = false
EnableLocalFS = false
MaxBulkOperations = 300
LogLevel = 10
EnableProfiler = false
YoutubeDLPath = "/usr/local/bin/youtube-dl"
EnableDebugConsole = false
AllowStreamPush = false
UploadLimit = 83886080
RunAsUser = 0
RunAsGroup = 0
ExternalFileBase = ""
InstanceActionLimit = 12
UseSSL = false
SSLKeyFile = ""
SSLCertFile = ""
Hostname = ""
HostnameMask = ""
SampleInterval = 60
StartVNC = false
EnableWebStream = false
LogFile = "serverlog"
LicenseKey = "9pHa4g2L8YjJZtVJkF20wMIswbGPD29xpsZcw0djjCY="
IsProxied = false
DenyStreamURLs = []
Pragma = 0
UserAgent = ""

[YoutubeDL]
  BufferSize = 524288
  MaxDownloadSize = 419430400
  MaxDownloadRate = 104857600
  MaxSimultaneousChunkDownloads = 6
  CacheStreamed = false
  TimeoutSingleDownloader = 0
  TimeoutMultiDownloader = 0
  ChunkSize = 3145728

[TS3]
  AvatarMaxWidth = 0
  AvatarMaxHeight = 0
  AllowGIF = false

[StreamRewrites]

[Scripts]
  Debug = false
  AllowReload = false
  EnableTimer = false
  DisableLegacyEvents = false
  DevMode = false
  ScriptTimeout = 5

[Themes]
  Default = ""

[SpeechRecognition]
  Enable = false

[FFmpeg]
  UserAgent = "SinusBot (1.0.0-beta.1-06a54d7)"
  WaitTime = 0

[DAV]
  Enable = false

[XServer]
  Delay = 0
  Debug = false

[SHMem]
  Enable = false
  Size = 0
  Delay = 0
  Interval = 0

[RadioStations]
  URL = ""
  UpdateInterval = 0

[TTS]
  Enabled = false

Here's my problem:
I have a license to run 12 bots simultaneously. But as soon as I start the fifth bot, Sinusbot application freezes and crashes after some time. Sometimes the fifth bot also starts but isn't able to connect to the TeamSpeak server (I guess the bot itself starts but the Teamspeak Client crashes]. I used the installer script to set the bot up but I also tried a clean installation using the official tutorial. Here are the logs:

Service status sinusbot when running fine (4 bots):
Code:
● sinusbot.service - Sinusbot, the Teamspeak 3 and Discord music bot.
   Loaded: loaded (/lib/systemd/system/sinusbot.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-05-27 23:20:29 CEST; 23h ago
 Main PID: 31057 (sinusbot)
    Tasks: 154 (limit: 165)
   CGroup: /system.slice/sinusbot.service
           ├─31057 /opt/sinusbot/sinusbot
           ├─31058 /opt/sinusbot/sinusbot
           ├─31083 /opt/sinusbot/teamspeak3-client/ts3client_linux_amd64 -nosingleinstance ts3server://127.0.0.1?port=9987&nickname=Party-Bot%201&password=&chann
           ├─31109 /opt/sinusbot/teamspeak3-client/ts3client_linux_amd64 -nosingleinstance ts3server://127.0.0.1?port=9987&nickname=Party-Bot%202&password=&chann
           ├─31150 /opt/sinusbot/teamspeak3-client/ts3client_linux_amd64 -nosingleinstance ts3server://127.0.0.1?port=9987&nickname=Lappen-Bot%202&password=&cid=
           └─31362 /opt/sinusbot/teamspeak3-client/ts3client_linux_amd64 -nosingleinstance ts3server://127.0.0.1?port=9987&nickname=Kindergarten-Bot%201&password

Mai 27 23:20:34 [IP removed] pulseaudio[31204]: [pulseaudio] main.c: Start des Hintergrunddienstes fehlgeschlagen.
Mai 27 23:20:38 [IP removed] pulseaudio[31240]: [pulseaudio] module-udev-detect.c: Failed to scan for devices.
Mai 27 23:20:38 [IP removed] pulseaudio[31240]: [pulseaudio] module.c: Failed to load module "module-udev-detect" (argument: ""): initialization fai
Mai 27 23:20:38 [IP removed] pulseaudio[31240]: [pulseaudio] main.c: Module load failed.
Mai 27 23:20:38 [IP removed] pulseaudio[31240]: [pulseaudio] main.c: Hintergrunddienst konnte nicht initialisiert werden.
Mai 27 23:20:38 [IP removed] pulseaudio[31237]: [pulseaudio] main.c: Start des Hintergrunddienstes fehlgeschlagen.
Mai 27 23:30:40 [IP removed] pulseaudio[31381]: [pulseaudio] module-udev-detect.c: Failed to scan for devices.
Mai 27 23:30:40 [IP removed] pulseaudio[31381]: [pulseaudio] module.c: Failed to load module "module-udev-detect" (argument: ""): initialization fai
Mai 27 23:30:40 [IP removed] pulseaudio[31381]: [pulseaudio] main.c: Module load failed.
Mai 27 23:30:40 [IP removed] pulseaudio[31381]: [pulseaudio] main.c: Hintergrunddienst konnte nicht initialisiert werden.

I noticed that there's a task limit in the service status (165) which seems to be almost there when using 4 bots. But I honestly have no clue how to remove such a limit. I checked for limits in Linux system files but they are all set to some value like 60.000. So I highly doubt that's the reason.

Instance log of a instance crashing when trying to run more than 4 bots:
Code:
2019-05-28T23:03:44+02:00 Closed.
2019-05-28T23:03:44+02:00 TSClient quit. LogLevel has been increased, please try to connect again to see more details.
2019-05-28T23:03:44+02:00 Error spawning instancefork/exec /opt/sinusbot/teamspeak3-client/ts3client_linux_amd64: resource temporarily unavailable
2019-05-28T23:03:44+02:00 Starting instance ts3server://127.0.0.1?port=9987&nickname=Kindergarten-Bot%202&password=&cid=58&channelpassword=
2019-05-28T23:03:44+02:00 Could not insert into FileTransfer-Tableno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not delete from FileTransferno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not insert into FileTransfer-Tableno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not delete from FileTransferno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not insert into FileTransfer-Tableno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not delete from FileTransferno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not insert into FileTransfer-Tableno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not delete from FileTransferno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not insert into FileTransfer-Tableno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not delete from FileTransferno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not insert into FileTransfer-Tableno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not delete from FileTransferno such table: FileTransfer
2019-05-28T23:03:44+02:00 Could not create Notifications-Tabletable Notifications already exists
2019-05-28T23:03:44+02:00 Could not create WhisperReceive-Tabletable WhisperReceive already exists
2019-05-28T23:03:44+02:00 Could not create Chat-Tabletable Chat already exists
2019-05-28T23:03:44+02:00 About to run.
2019-05-28T23:03:44+02:00 Prespawn.
2019-05-28T23:02:39+02:00 registered callback for event clientMove
2019-05-28T23:02:39+02:00 imported module: OKlib.js
2019-05-28T23:02:39+02:00 resolving module OKlib.js
2019-05-28T23:02:39+02:00 script come loaded
2019-05-28T23:02:39+02:00 registered callback for event chat
2019-05-28T23:02:39+02:00 script alonemode loaded
2019-05-28T23:02:39+02:00 Initialization complete
2019-05-28T23:02:39+02:00 registered callback for event clientMove
2019-05-28T23:02:39+02:00 script Default-Channel loaded
2019-05-28T23:02:39+02:00 registered callback for event load
2019-05-28T23:02:39+02:00 executing script come
2019-05-28T23:02:39+02:00 executing script alonemode
2019-05-28T23:02:39+02:00 script OKlib loaded
2019-05-28T23:02:39+02:00 module registered as OKlib
2019-05-28T23:02:39+02:00 registered callback for event chat
2019-05-28T23:02:39+02:00 registered callback for event connect
2019-05-28T23:02:39+02:00 executing script Default-Channel
2019-05-28T23:02:39+02:00 script command loaded
2019-05-28T23:02:39+02:00 module registered as command
2019-05-28T23:02:39+02:00 registered callback for event chat
2019-05-28T23:02:39+02:00 executing script OKlib
2019-05-28T23:02:39+02:00 executing script command

Bot log doesn't show anything besides "Loading instances" so I don't believe there's a reason to share the bot log.

I also ran the diagSinusbot Script, here's the output:
Code:
==========================================================
SINUSBOT RELATED
SYSTEM INFORMATION
 - Operating System: Ubuntu 18.04.2 LTS (OpenVZ)
 - Kernel: Linux 4.15.0 x86_64
 - Load Average: 2.01 1.88 1.83
 - Uptime: 4 days, 13 hours, 32 minutes, 22 seconds
 - OS x64 check: OK
 - OS Updates: 0 (well done!)
 - OS Missing Packages: None
 - OS APT Last Update: 28.05.2019 04:46:48 CEST +02:00:00
 - SHELL LOCALE LANG: de_DE.utf8
 - Bot Start Script: not found
 - DNS resolution check: www.sinusbot.com resolved to 104.28.15.74 -> OK
 - HTTPS check with IPv4 mode: SUCCESS [Connection was established to www.sinusbot.com, CODE #200]
 - HTTPS check with IPv6 mode: IGNORE
 - CPU:
    CPU(s):              0
    CPU MHz:             1999.853
    Hypervisor-Anbieter: Parallels
 - RAM: 4.59 GB/16.00 GB in use (28%)
 - SWAP: 0 B/0 B in use (0%) (SWAP disabled)
 - DISK: 36.05 GB/605.78 GB in use (5%)
 - Package versions:
   + libglib: 2.56.4-0ubuntu0.18.04.2

BOT INFORMATION
 - Status: running (PIDs: 13825 13824, User: sinusbot)
 - Webinterface: port locally reachable (Port: 8087)
 - Binary: /opt/sinusbot/sinusbot
 - Binary Info: MD5 Hash: 6f301dac3e4dfd45ce149933c5dadd08, Perms: 755, User: sinusbot
 - Version: 1.0.0-beta.1-06a54d7
 - TS3 Plugin: installed (md5 hash match)
   - Bot Plugin: 59c9a688307aa73af9573029a7625fc5
   - TS3 Client: 59c9a688307aa73af9573029a7625fc5
 - Config:
   - LogLevel = 10 (debug log active)
   - TS3Path = /opt/sinusbot/teamspeak3-client/ts3client_linux_amd64 (Version 3.2.5)
   - YoutubeDLPath = /usr/local/bin/youtube-dl (does exist, version: 2019.05.20)
 - Installed scripts: advertising.js; alonemode.js; bookmark.js; Change_Channelcodec_And_Quality_Automaticly.js; come.js; command.js; Default-Channel.js; followme.js; norecording.js; OKlib.js; rememberChannel.js; welcome.js

TIME INFORMATION
 - Time (local): 28.05.2019 23:22:13 CEST +02:00:00
 - Time (remote): <Failed retrieving remote time!>
 - Time (difference): n/a secs
 - Timezone: Europe/Berlin

OTHER INFORMATION
 - TeamSpeak 3 Version: 3.2.5
 - youtube-dl Version: 2019.05.20
 - DiagScript Version: 0.7.1
==========================================================

If there's any information missing feel free to contact me. I tried to put as much information as possible together.
Thank you in advance and kind regards,

Moritz!
 

flyth

is reticulating splines
Staff member
Developer
Contributor
Wonderful support request, I really appreciate the effort, it sadly doesn't happen a lot these days!

From what I can see, the bot is out of resources.
Error spawning instancefork/exec /opt/sinusbot/teamspeak3-client/ts3client_linux_amd64: resource temporarily unavailable
That message (resource temporarily unavailable) comes directly from the OS - so the OS doesn't let the bot start a new client.
You're probably hitting some limits on your machine - that might either be RAM (if on a shared host and it's overbooked) or settings like maximum open files (this affects actual files as well as network connections, as those are also basically files on Linux) or maximum running processes. You can check those by using ulimit -a using the account your bot is running with. You might need to tweak those (if your host allows it) and edit those tweaks into the start script you're using.
 

Karate_Creeper

Active Member
Hey there,

thanks for the kind words! it felt like a necessity for me to provide as much information as possible if I ask for support!
As suggested by you I used ulimit -a on both the root and sinusbot user. As I used the installer script the bot runs as a service launched by root account but the bot itself is run by sinusbot user. Stopping every other server (Minecraft Modded f.Ex.). Still I am not able to start more than 4 bots. So I don't believe it's about RAM usage, as the Minecraft Server is able to use 8 to 12 GB without any problems at all.

The number of user processes is set to 62987. Still I don't know what "Tasks: 154 (limit: 165)" from my service status output means.

When talking about start script, do you mean the start script used to start up sinusbot or the server itself? How am I able to change the limits that are visible by ulimit -a. I saw some thread talking about changing parameters in "/etc/security/limits.conf " but I am a bit unsure about it! Is there any way to see how many files Sinusbot uses and whether the limit is reached at any time?

ulimit -a as root outputs:
Code:
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 1030716
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

ulimit -a as sinusbot user outputs:

Code:
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 1030716
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

Thank you for the fast answer!
 

olokos

Insider
Insider
Service status sinusbot when running fine (4 bots):
This doesn't look fine at all
module-udev-detect.c: Failed to scan for devices. Mai 27 23:20:38 [IP removed] pulseaudio[31240]: [pulseaudio] module.c: Failed to load module "module-udev-detect" (argument: ""): initialization fai Mai 27 23:20:38 [IP removed] pulseaudio[31240]: [pulseaudio] main.c: Module load failed.
I found this online, maybe it would be similar to your problem?
https://smartos.org/bugview/OS-5925

Another thing worth trying
https://askubuntu.com/questions/882198/no-sound-device-detected
 
Top