... looking on your trace in more detail i was able to reproduce the crash.

You have set the event queue directory and the state file to the same directory:

  set statefile /var/lib/monit/monit.state
  set eventqueue basedir /var/lib/monit

This causes the crash, since monit tries to load on start all regular files in the eventqueue directory and process it (including statefile). The statefile has different format and causes the crash when enters the queue processor.

There are two recommendations:

1.) don't set the statefile and eventqueue to the same directory (by default monit statefile is create in the home directory, whereas the eventqueue is in /var/monit)

2.) i will fix the event queue loader/processor to prevent the crash when some file appears in the event queue which was not written by the event queue writer / doesn't correspond to the event format.

Thanks for report :)
Martin



Michal Čihař wrote:
Package: monit
Version: 1:4.8.1-2.1
Severity: important

Hi

I see this problem for more time, but didn't yet find time to report.
Monit segfaults for me just after startup. Here is end of strace:

rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
open("/var/lib/monit", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
fstat(3, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
getdents64(3, /* 7 entries */, 4096)    = 240
write(2, "Processing postponed events queu"..., 34Processing postponed events 
queue
) = 34
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=806, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=806, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=806, ...}) = 0
sendto(4, "<31>Nov 17 09:20:47 monit[32479]"..., 69, MSG_NOSIGNAL, NULL, 0) = 69
stat("/var/lib/monit/.", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/var/lib/monit/monit.state", {st_mode=S_IFREG|0644, st_size=1684, ...}) = 0
write(2, "monit: processing queued event /"..., 58monit: processing queued 
event /var/lib/monit/monit.state
) = 58
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=806, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=806, ...}) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=806, ...}) = 0
sendto(4, "<31>Nov 17 09:20:47 monit[32479]"..., 93, MSG_NOSIGNAL, NULL, 0) = 93
open("/var/lib/monit/monit.state", O_RDONLY) = 6
fstat(6, {st_mode=S_IFREG|0644, st_size=1684, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x2aaaaaaae000
read(6, "\6\0\0\0lighttpd\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 
1684
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 32479 detached

When I remove state file, it starts and seem to work fine (it didn't yet run too long, but looks good enough so far). So there must be something
wrong with state saving/parsing. It fails whenever there is some state
file. I'm attaching one as example.



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to