Bug 201919 - sysutils/monit delay of several minutes on "monit stop"
Summary: sysutils/monit delay of several minutes on "monit stop"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: patch, regression
Depends on:
Blocks:
 
Reported: 2015-07-27 12:51 UTC by sirdice
Modified: 2015-10-21 14:18 UTC (History)
3 users (show)

See Also:
koobs: maintainer-feedback+


Attachments
fix for monit-5.14 (834 bytes, patch)
2015-10-15 16:04 UTC, martinp
koobs: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sirdice 2015-07-27 12:51:35 UTC
We use sysutils/monit (and M/Monit) to control several services. Since version 5.12.2 there's a delay of several minutes when shutting down a service.

For example, we have the following in monitrc:
check process apache with pidfile  /var/run/httpd.pid
  start program = "/usr/local/etc/rc.d/apache22 start" with timeout 60 seconds
  stop program  = "/usr/local/etc/rc.d/apache22 stop"
  if cpu > 60% for 2 cycles then alert
  if cpu > 80% for 5 cycles then alert
  if cpu > 90% for 6 cycles then restart
  if totalmem > 14000.0 MB for 5 cycles then alert
  if totalmem > 15000.0 MB for 5 cycles then restart
  if children > 750 then alert
  if failed host 172.17.40.104 port 80 protocol http
                     and request "/system/"
                     for 2 cycles then restart
  if 3 restarts within 15 cycles then timeout
  group server

A "monit stop apache" takes several minutes for Apache to actually start shutting down. This causes problems with our automated deployment scripts. With previous versions the shutdown happened immediately after issuing "monit stop apache". A normal '/usr/local/etc/rc.d/apache22 stop' stops the service almost immediately. 

Version 5.12.1 did not exhibit this behavior, all versions (5.12.2, 5.13 and 5.14) after it do. 

For the time being I've downgraded to Monit 5.12.1. 

(This may need to be fixed upstream)
Comment 1 Carlo Strub freebsd_committer 2015-09-15 22:45:36 UTC
Did you raise this problem upstream?
Comment 2 martinp 2015-10-15 11:45:08 UTC
Hello,

the problem is fixed in the next Monit release (5.15), which should be available ca. within 1-2 weeks.

Best regards,
Martin
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2015-10-15 12:17:37 UTC
If anyone would like to propose that the port is fixed locally prior to the next release, *and* there is a relatively well isolated changeset upstream that addresses the fix, don't hesitate to provide references to it, or ideally, an svn diff against the monit port adding a patch to files/

Otherwise please provide alternative instructions for issue resolution
Comment 4 martinp 2015-10-15 16:04:55 UTC
Created attachment 162077 [details]
fix for monit-5.14

Hello,

the patch for monit-5.14 is attached.

Best regards,
Martin
Comment 5 commit-hook freebsd_committer 2015-10-21 14:18:15 UTC
A commit references this bug:

Author: mat
Date: Wed Oct 21 14:17:11 UTC 2015
New revision: 399918
URL: https://svnweb.freebsd.org/changeset/ports/399918

Log:
  Fix slow shutdown.

  PR:		201919
  Submitted by:	maintainer
  Sponsored by:	Absolight

Changes:
  head/sysutils/monit/files/patch-src_http.c
  head/sysutils/monit/files/patch-src_monit.c