Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  06 Sep 2021, Andreas Suter, Forum, mhttpd crash 
    Reply  06 Sep 2021, Konstantin Olchanski, Forum, mhttpd crash 
       Reply  07 Sep 2021, Andreas Suter, Forum, mhttpd crash 
          Reply  17 Sep 2021, Stefan Ritt, Forum, mhttpd crash mhttpdScreenshot_2021-09-17_at_21.11.15_.png
Message ID: 2276     Entry time: 17 Sep 2021     In reply to: 2275
Author: Stefan Ritt 
Topic: Forum 
Subject: mhttpd crash 
To limit the impact of the numerous crashes of mhttpd, I installed the monit tool at MEG at PSI 
(https://en.wikipedia.org/wiki/Monit). It monitors mhttpd, and if it cannot connect to it for a certain
time, it kills the process and restarts it. This covers endless loops, simple crashes (caused by the
known multi-threading issue in mongoose), and also cases where mhttpd develops a memory leak and becomes
unresponsive. 

To configure monit for mhttpd, first install the package, make sure the daemon gets started automatically
after reboot (typically "sysemctl enable monit"), and put the attached file into

/etc/monit.d/mhttpd

You have to adjust the <path-to-midas> according to your midas installation, and probably also the port
under which mhttpd is listening (8082 in my case). Put 

set daemon 10

into /etc/monitrc if you want monit to check mhttpd every 10 seconds (default is 30 seconds). Then, every
10 seconds monit request "midas.css" from mhttpd, and if it cannot obtain it after 30 seconds, it kills
mhttpd and restarts it.

Loading long history plots taking more than 30 seconds should probably not be an issue since mhttpd is 
multi-threaded, but I haven't tested this in detail.

Attached below is a typical status page produced by monit, which has its own built-in web server (normally
listening at port 2812, accessible only from localhost by default).

I hope this helps some of you.

Stefan
Attachment 1: mhttpd  301 Bytes  Uploaded 17 Sep 2021  | Show | Hide all | Show all
Attachment 2: Screenshot_2021-09-17_at_21.11.15_.png  135 kB  Uploaded 17 Sep 2021  | Hide | Hide all | Show all
Screenshot_2021-09-17_at_21.11.15_.png
ELOG V3.1.4-2e1708b5