DDVTECH / mistserver

The official mistserver source repository - www.mistserver.com
The Unlicense
385 stars 133 forks source link

mistserv.conf is not loaded #167

Open EvgenyKirichenko opened 1 year ago

EvgenyKirichenko commented 1 year ago

Hello, guys.

Faced with this situation. I have CentOS 9 server running (8 GB Memory / 25 GB Disk). The size of the configuration file has reached 123 KB, the server can't read it on startup. I deleted the config file, the server started instantly. I returned the config file, increased the RAM size to 16GB, didn't help. I have a suspicion that the issue here is not the amount of memory, but the fact that the entire configuration is written in one line, now it has reached such a size that the script, which reads config line by line, can not do it. Advice on what to do? Perhaps the approach to reading config should be reconsidered.

Thulinma commented 1 year ago

Hey there! The config is actually read character by character, not line by line (newlines are completely ignored by the system). So the problem is definitely not that the config is a single file 🤔. (And the parser has been tested with files up to several gigabytes in size, so the 123KiB size should not be a problem, either...)

Could you share a copy of your config, so that we can analyse what's wrong? If you don't want to post it publicly, feel free to instead email it to info@mistserver.org

EvgenyKirichenko commented 1 year ago

Thank you for your reply. I sent the configuration file to your email.

cyberj0g commented 1 year ago

BTW shouldn't the config get pretty printed on exit?

https://github.com/DDVTECH/mistserver/pull/113

nerijus commented 1 year ago

Yes, it would be nice to merge to development branch too.

EvgenyKirichenko commented 1 year ago

A small addition, perhaps a significant one. I add new streams via API, and after each call I force saving the config.

EvgenyKirichenko commented 1 year ago

Is there any news on this subject? I switched the configuration file saving mode, now it is saved only when the server is stopped. Unfortunately, this did not help. Another reboot generated a configuration file of 124,547 bytes and the server cannot get up. The file itself is valid -- I checked it with a json parser. I sent the file to the mailbox info@mistserver.org

Rokamun commented 1 year ago

Hey there,

We received the config and had a look. The amount of streams configured most likely would've hit the file descriptor limit (usually 1024) of your system. As we keep a file open per stream configured (to work towards Windows compatibility, Windows shared memory requires keeping everything in shared memory "active" or it would be deleted)

You can test or work around this problem by raising the limit applied to MistServer.

If you're using MistServer as a service you could raise this by adding the following to the mistserver.service file: LimitNOFILE=5000 This goes into the [Service] section. Don't forget to systemctl daemon-reload and then (re)start MistServer

If you don't want to edit the service script immediately you can test it by hand. First turn off the mistserver service then: ulimit -n 5000 then: MistController -c /etc/mistserver.conf

Seeing this issue we'll most likely make adjustments for the Linux builds to not keep all these files open as it's not needed. Thanks for reporting!

By the way, while there's no problem in having 1k+ streams configured, you might want to look into the wildcard system, which allows you to do this in a much more simple way. The following article should explain you how to set this up: https://news.mistserver.org/news/90/How+to+build+a+Twitch-alike+service+with+MistServer

EvgenyKirichenko commented 1 year ago

Thank you for your prompt reply. I will definitely take your advice and monitor the server's behavior.