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 
( 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

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


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.

Attachment 1: mhttpd  301 Bytes  Uploaded 17 Sep 2021  | Hide | Hide all
check process mhttpd matching "mhttpd"
  start program = "/bin/su -l meg -c '/<path-to-midas>/bin/mhttpd -D'"
  stop program = "/usr/bin/killall mhttpd"
  if failed
    port 8082 
    protocol http
    method GET
    request "/midas.css"
    with timeout 30 seconds 
  then restart
Attachment 2: Screenshot_2021-09-17_at_21.11.15_.png  135 kB  Uploaded 17 Sep 2021  | Hide | Hide all
ELOG V3.1.4-2e1708b5