On Thu, 26 Feb 2004, Ralf Hack wrote:
Hello!
I monitor an ssh tunnel and get the following message after several
hours. It appears that kvm_read fails reading the memory size once
the process is swapped out on the monitoring server (STAT
+= W). Once I active the monitored process by simply using the
session, the problem disappears. Sorry, I do not know enough about
FreeBSD programming to offer a fix for this.
(...)
I could track down the problem using gdb to line 376 in sysdep_FREEBSD.c
Breakpoint 3, get_process_info_sysdep (p=0x808f4c0)
at process/sysdep_FREEBSD.c:376
376 return FALSE;
(gdb) c
/* ----------------------------- MEMORY --------------------------------*/
/* Got it from libgtop/sysdep/freebsd/procmem.c */
if (kvm_read (kvm_handle,
#if (__FreeBSD_version > 500000)
(unsigned long) &pinfo->ki_addr->p_limit,
#else
(unsigned long) pinfo [0].kp_proc.p_limit,
#endif
(char *) &plimit, sizeof (plimit)) != sizeof (plimit)) {
return FALSE;
}
Yep, it has to be there! It's really tricky. If this kvm_read call
fails, too less data is transmitted from the kernel (see man page or
other implementations). I am hesitant to guess the amount of memory
at that point (e.g. 0), but it is the only solution I see at that
point.
I would love to have more docs about freebsd and kvm, but I haven't
googled anything useful yet. I have cursed about all this already a
lot!
Christian