Xymon Mailing List Archive search

Coredump when generating pre-built reports

7 messages in this thread

list Frédéric Mangeant · Thu, 01 Dec 2005 17:35:04 +0100 ·
Hi Henrik

I tried to generate the november monthly report, and bbgen coredumped :

$ ~/server/bin/bbcmd --env=/BB/hobbit/server/etc/hobbitserver.cfg hobbitreports.sh monthly
~/server/bin/hobbitreports.sh: line 78: 24827 Abandon                 (core dumped) BBWEB=$REPORTTOPURL/$REPDIR $BBHOME/bin/bbgen --reportopts=$STIME:$ETIME:0:nongr $BBGENREPOPTS $REPORTTOPDIR/$REPDIR


$ file core
core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, SVR4-style, from 'bbgen'


$ gdb ~/server/bin/bbgen core
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

Core was generated by `/BB/hobbit/server/bin/bbgen --reportopts=1130799600:1133391599:0:nongr --subpag'.
Program terminated with signal 6, Aborted.
Reading symbols from /usr/lib/libpcre.so.0...done.
Loaded symbols for /usr/lib/libpcre.so.0
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x40075941 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x40075941 in kill () from /lib/libc.so.6
#1  0x400756e5 in raise () from /lib/libc.so.6
#2  0x40076a86 in abort () from /lib/libc.so.6
#3  0x080639d1 in sigsegv_handler (signum=0) at sig.c:57
#4  <signal handler called>
#5  0x400b1939 in strcat () from /lib/libc.so.6
#6  0x0804fa3a in timename (timestring=0x0) at reportdata.c:322
#7  0x0804fc9f in parse_historyfile (fd=0x8f5cc80, repinfo=0x0, hostname=0x8ed3ae8 "ftvbufet",
    servicename=0x896a6c8 "swap", fromtime=0, totime=1133391599, for_history=0, warnlevel=97,
    greenlevel=99.995000000000005, reporttime=0x0) at reportdata.c:405
#8  0x0804e328 in init_state (filename=0xbfff6d20 "ftvbufet.swap", log=0xbfff6cf0) at loaddata.c:224
#9  0x0804ebf1 in load_state (sumhead=0x0) at loaddata.c:521
#10 0x08049d95 in main (argc=4, argv=0xbfffce04) at bbgen.c:569


Daily reports generation works fine.

Thanks in advance for your help.

Regards,

-- 

Frédéric Mangeant

Steria EDC Sophia-Antipolis
list Chris Morris · Fri, 2 Dec 2005 09:31:31 -0000 ·
quoted from Frédéric Mangeant
On Thursday, December 01, 2005 4:35 PM, Frédéric Mangeant wrote:
I tried to generate the november monthly report, and bbgen coredumped :

$ ~/server/bin/bbcmd --env=/BB/hobbit/server/etc/hobbitserver.cfg 
hobbitreports.sh monthly
~/server/bin/hobbitreports.sh: line 78: 24827 Abandon                 
(core dumped) BBWEB=$REPORTTOPURL/$REPDIR $BBHOME/bin/bbgen 
--reportopts=$STIME:$ETIME:0:nongr $BBGENREPOPTS $REPORTTOPDIR/$REPDIR
I have a similar problem on an AIX server (5.1 or 5.2) using 4.1.2p1 in that
bbgen coredumps generating any automated reports
but works ok doing a "custom" report


/usr/local/hobbit/server/bin/hobbitreports.sh: line 78: 30622 IOT/Abort trap
(core dumped) BBWEB=$REPORTTOPURL/$REPDIR $BBHOME/bin/bbgen
--reportopts=$STIME:$ETIME:0:nongr $BBGENREPOPTS $REPORTTOPDIR/$REPDIR

Core was generated by `bbgen'.
Program terminated with signal 6, Aborted.
#0  0xd01ecf40 in raise () from /usr/lib/libc.a(shr.o)
(gdb) bt
#0  0xd01ecf40 in raise () from /usr/lib/libc.a(shr.o)
#1  0xd020d2c8 in abort () from /usr/lib/libc.a(shr.o)
#2  0x1001fc18 in sigsegv_handler ()
#3  <signal handler called>
#4  0x1000b75c in strncpy ()
#5  0x10012fb8 in parse_histlogfile ()
#6  0x100138ac in parse_historyfile ()
#7  0x1000bf28 in init_state ()
#8  0x1000ccb8 in load_state ()
#9  0x2000ce28 in ?? ()

Regards

Chris


****************************************************************************
We would like to take this opportunity to send Seasons Greetings to all our customers, suppliers and colleagues and wish you a prosperous New Year. RWE npower will not be sending corporate Christmas cards this year. Instead, we will be making a donation to our chosen corporate charity Macmillan Cancer Relief. 

****************************************************************************
The information contained in this email is intended only for the use of the intended recipient at the email address to which it has been addressed. If the reader of this message is not an intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination or copying of the message or associated attachments is strictly prohibited.

If you have received this email in error, please contact the sender by return email or call 01793 877777 and ask for the sender and then delete it immediately from your system.Please note that neither RWE npower nor the sender accepts any responsibility for viruses and it is your responsibility to scan attachments (if any).
*****************************************************************************
list Henrik Størner · Fri, 2 Dec 2005 16:57:22 +0100 ·
Hi Frederic,
quoted from Frédéric Mangeant

On Thu, Dec 01, 2005 at 05:35:04PM +0100, Frédéric Mangeant wrote:
I tried to generate the november monthly report, and bbgen coredumped :
#6  0x0804fa3a in timename (timestring=0x0) at reportdata.c:322
#7  0x0804fc9f in parse_historyfile (fd=0x8f5cc80, repinfo=0x0, hostname=0x8ed3ae8 "ftvbufet",
   servicename=0x896a6c8 "swap", fromtime=0, totime=1133391599, for_history=0, warnlevel=97,
   greenlevel=99.995000000000005, reporttime=0x0) at reportdata.c:405
#8  0x0804e328 in init_state (filename=0xbfff6d20 "ftvbufet.swap", 
Looks like your ~hobbit/data/hist/ftvbufet.swap file has some broken
data in it, that causes the history parsing to break. There's some fragile code there that should be better at handling malformed input
files, but I'd like to see that file if you could send it to me, please?


Regards,
Henrik
list Henrik Størner · Fri, 2 Dec 2005 17:06:18 +0100 ·
quoted from Chris Morris
On Fri, Dec 02, 2005 at 09:31:31AM -0000, Morris, Chris (Shared Services) wrote:
On Thursday, December 01, 2005 4:35 PM, Frédéric Mangeant wrote:
I tried to generate the november monthly report, and bbgen coredumped :

$ ~/server/bin/bbcmd --env=/BB/hobbit/server/etc/hobbitserver.cfg 
hobbitreports.sh monthly
~/server/bin/hobbitreports.sh: line 78: 24827 Abandon                 
(core dumped) BBWEB=$REPORTTOPURL/$REPDIR $BBHOME/bin/bbgen 
--reportopts=$STIME:$ETIME:0:nongr $BBGENREPOPTS $REPORTTOPDIR/$REPDIR
I have a similar problem on an AIX server (5.1 or 5.2) using 4.1.2p1 in that
bbgen coredumps generating any automated reports
but works ok doing a "custom" report
I suspect this is somewhat the same problem both of you are seeing.
Could you try the attached patch and let me know if it helps ?

Henrik

-------------- next part --------------
--- bbdisplay/reportdata.c	2005/05/02 10:30:12	1.36
+++ bbdisplay/reportdata.c	2005/12/02 16:04:01
@@ -11,7 +11,7 @@
 /*                                                                            */
 /*----------------------------------------------------------------------------*/
 
-static char rcsid[] = "$Id: reportdata.c,v 1.36 2005/05/02 10:30:12 henrik Exp $";
+static char rcsid[] = "$Id: reportdata.c,v 1.37 2005/12/02 16:03:45 henrik Exp $";
 
 #include <limits.h>
 #include <stdio.h>
@@ -304,23 +304,27 @@
 static char *timename(char *timestring)
 {
 	static char timespec[26];
• -	char timecopy[26];
-	char *token;
+	char *timecopy;
+	char *tokens[5];
 	int i;
 
 	/* Compute the timespec string used as the name of the historical logfile */
-	strncpy(timecopy, timestring, 25);
-	timecopy[25] = '\0';
• -	token = strtok(timecopy, " ");
-	strcpy(timespec, token);
• -	for (i=1; i<5; i++) {
-		strcat(timespec, "_");
-		token = strtok(NULL, " ");
-		strcat(timespec, token);
+	*timespec = '\0';
+	timecopy = strdup(timestring);
+	tokens[0] = tokens[1] = tokens[2] = tokens[3] = tokens[4] = NULL;
• +	tokens[0] = strtok(timecopy, " "); i = 0;
+	while (tokens[i] && (i < 4)) { i++; tokens[i] = strtok(NULL, " "); }
• +	if (tokens[4]) {
+		/* Got all 5 elements */
+		snprintf(timespec, sizeof(timespec), "%s_%s_%s_%s_%s",
+			 tokens[0], tokens[1], tokens[2], tokens[3], tokens[4]);
 	}
+	else {
+		errprintf("Bad timespec in history file: %s\n", timestring);
+	}
+	xfree(timecopy);
 
 	return timespec;
 }
@@ -410,12 +414,12 @@
 				newentry->color = color;
 				newentry->affectssla = (reporttime && (sladuration > 0));
 
-				if (!for_history && (color != COL_GREEN)) {
+				if (!for_history && timespec && (color != COL_GREEN)) {
 					newentry->cause = parse_histlogfile(hostname, servicename, timespec);
 				}
 				else newentry->cause = "";
 
-				newentry->timespec = strdup(timespec);
+				newentry->timespec = (timespec ? strdup(timespec): NULL);
 				newentry->next = reploghead;
 				reploghead = newentry;
 			}
@@ -502,7 +506,9 @@
 	time_t duration;
 	char colstr[MAX_LINE_LEN];
 	int color;
+	char *p;
 
+	*histlogname = NULL;
 	fileerrors = scan_historyfile(fd, snapshot, snapshot, 
 				      l, sizeof(l), starttime, &duration, colstr);
 	
@@ -512,7 +518,8 @@
 		color = -2;
 	}
 
-	*histlogname = strdup(timename(l));
+	p = timename(l);
+	if (p) *histlogname = strdup(p);
 
 	return color;
 }
list Frédéric Mangeant · Fri, 02 Dec 2005 17:27:37 +0100 ·
quoted from Henrik Størner
Henrik Stoerner a écrit :
I suspect this is somewhat the same problem both of you are seeing.
Could you try the attached patch and let me know if it helps ?
  
Hi Henrik

thanks for the patch, however I cannot appy it :

$ patch -p0 < /tmp/hobbit-4.1.2p1-history.patch
patching file bbdisplay/reportdata.c
Hunk #1 FAILED at 11.
Hunk #2 FAILED at 304.
Hunk #3 FAILED at 414.
Hunk #4 FAILED at 506.
Hunk #5 FAILED at 518.
5 out of 5 hunks FAILED -- saving rejects to file bbdisplay/reportdata.c.rej


$ cat bbdisplay/reportdata.c.rej
***************
*** 11,17 ****
quoted from Henrik Størner
  /*                                                                            */
  /*----------------------------------------------------------------------------*/

- static char rcsid[] = "$Id: reportdata.c,v 1.36 2005/05/02 10:30:12 henrik Exp $";

  #include <limits.h>
  #include <stdio.h>

--- 11,17 ----
quoted from Henrik Størner
  /*                                                                            */
  /*----------------------------------------------------------------------------*/

+ static char rcsid[] = "$Id: reportdata.c,v 1.37 2005/12/02 16:03:45 henrik Exp $";

  #include <limits.h>
  #include <stdio.h>
***************

*** 304,326 ****
quoted from Henrik Størner
  static char *timename(char *timestring)
  {
        static char timespec[26];
• -       char timecopy[26];
-       char *token;
        int i;

        /* Compute the timespec string used as the name of the historical logfile */
-       strncpy(timecopy, timestring, 25);
-       timecopy[25] = '\0';
• -       token = strtok(timecopy, " ");
-       strcpy(timespec, token);
• -       for (i=1; i<5; i++) {
-               strcat(timespec, "_");
-               token = strtok(NULL, " ");
-               strcat(timespec, token);
        }

        return timespec;
  }
--- 304,330 ----
quoted from Henrik Størner
  static char *timename(char *timestring)
  {
        static char timespec[26];
+       char *timecopy;
+       char *tokens[5];
        int i;

        /* Compute the timespec string used as the name of the historical logfile */
+       *timespec = '\0';
+       timecopy = strdup(timestring);
+       tokens[0] = tokens[1] = tokens[2] = tokens[3] = tokens[4] = NULL;
• +       tokens[0] = strtok(timecopy, " "); i = 0;
+       while (tokens[i] && (i < 4)) { i++; tokens[i] = strtok(NULL, " "); }
• +       if (tokens[4]) {
+               /* Got all 5 elements */
+               snprintf(timespec, sizeof(timespec), "%s_%s_%s_%s_%s",
+                        tokens[0], tokens[1], tokens[2], tokens[3], tokens[4]);
        }
+       else {
+               errprintf("Bad timespec in history file: %s\n", timestring);
+       }
+       xfree(timecopy);

        return timespec;
  }
***************

*** 410,421 ****
quoted from Henrik Størner
                                newentry->color = color;
                                newentry->affectssla = (reporttime && (sladuration > 0));

-                               if (!for_history && (color != COL_GREEN)) {
                                        newentry->cause = parse_histlogfile(hostname, servicename, timespec);
                                }
                                else newentry->cause = "";

-                               newentry->timespec = strdup(timespec);

                                newentry->next = reploghead;
                                reploghead = newentry;
                        }
--- 414,425 ----
quoted from Henrik Størner
                                newentry->color = color;
                                newentry->affectssla = (reporttime && (sladuration > 0));

+                               if (!for_history && timespec && (color != COL_GREEN)) {
                                        newentry->cause = parse_histlogfile(hostname, servicename, timespec);
                                }
                                else newentry->cause = "";

+                               newentry->timespec = (timespec ? strdup(timespec): NULL);
                                newentry->next = reploghead;
                                reploghead = newentry;
                        }
***************

*** 502,508 ****
quoted from Henrik Størner
        time_t duration;
        char colstr[MAX_LINE_LEN];
        int color;

        fileerrors = scan_historyfile(fd, snapshot, snapshot,
                                      l, sizeof(l), starttime, &duration, colstr);

--- 506,514 ----
quoted from Henrik Størner
        time_t duration;
        char colstr[MAX_LINE_LEN];
        int color;
+       char *p;

+       *histlogname = NULL;
        fileerrors = scan_historyfile(fd, snapshot, snapshot,
                                      l, sizeof(l), starttime, &duration, colstr);

***************

*** 512,518 ****
                color = -2;
        }

-       *histlogname = strdup(timename(l));

        return color;
  }
--- 518,525 ----
                color = -2;
        }

+       p = timename(l);
+       if (p) *histlogname = strdup(p);

        return color;
  }


-- 

Frédéric Mangeant

Steria EDC Sophia-Antipolis
list Frédéric Mangeant · Fri, 02 Dec 2005 18:43:48 +0100 ·
quoted from Frédéric Mangeant
Henrik Stoerner a écrit :
On Fri, Dec 02, 2005 at 09:31:31AM -0000, Morris, Chris (Shared Services) wrote:
  
I suspect this is somewhat the same problem both of you are seeing.
Could you try the attached patch and let me know if it helps ?
  
I modified bbdisplay/reportdata.c by hand, and pre-built reports work 
fine now :


$ ~/server/bin/bbcmd --env=~/server/etc/hobbitserver.cfg 
hobbitreports.sh monthly

2005-12-02 17:39:17 Bad timespec in history file: Mon Nov 21 1132550988

2005-12-02 17:39:20 Weird file '/BB/hobbit/data/hist/ftvmonet.LVM' skipped
2005-12-02 17:41:08 Bad timespec in history file: Thu Nov  24 1132806476

2005-12-02 17:41:18 Bad timespec in history file: Mon Nov  7 1131396507

2005-12-02 17:42:38 Bad timespec in history file: Tue No 1131353699 1332469

2005-12-02 17:42:43 Weird file '/BB/hobbit/data/hist/slsedid.tape' skipped
2005-12-02 17:42:43 Weird file '/BB/hobbit/data/hist/slsedip.tape' skipped
2005-12-02 17:42:45 Weird file '/BB/hobbit/data/hist/slsgmao.tape' skipped
2005-12-02 17:42:45 Weird file '/BB/hobbit/data/hist/slstrac.tape' skipped

Thanks again !

-- 

Frédéric Mangeant

Steria EDC Sophia-Antipolis
list Chris Morris · Mon, 5 Dec 2005 09:59:26 -0000 ·
quoted from Frédéric Mangeant
On Friday, December 02, 2005 4:06 PM, Henrik wrote :
I suspect this is somewhat the same problem both of you are seeing.
Could you try the attached patch and let me know if it helps ?
Patch applied but still getting the same problem on AIX :-
 
/usr/local/hobbit/server/bin/hobbitreports.sh: line 78: 19204 IOT/Abort trap
quoted from Chris Morris
(core dumped) BBWEB=$REPORTTOPURL/$REPDIR $BBHOME/bin/bbgen
--reportopts=$STIME:$ETIME:0:nongr $BBGENREPOPTS $REPORTTOPDIR/$REPDIR

Core was generated by `bbgen'.
Program terminated with signal 6, Aborted.
#0  0xd01ecf40 in raise () from /usr/lib/libc.a(shr.o)
(gdb) bt
#0  0xd01ecf40 in raise () from /usr/lib/libc.a(shr.o)
#1  0xd020d2c8 in abort () from /usr/lib/libc.a(shr.o)

#2  0x1001fce8 in sigsegv_handler ()
quoted from Chris Morris
#3  <signal handler called>
#4  0x1000b75c in strncpy ()
#5  0x10012fb8 in parse_histlogfile ()

#6  0x10013960 in parse_historyfile ()
#7  0x1000bf28 in init_state ()
#8  0x1000ccb8 in load_state ()
#9  0x2000cf38 in ?? ()
quoted from Chris Morris

Regards,

Chris


****************************************************************************
We would like to take this opportunity to send Seasons Greetings to all our customers, suppliers and colleagues and wish you a prosperous New Year. RWE npower will not be sending corporate Christmas cards this year. Instead, we will be making a donation to our chosen corporate charity Macmillan Cancer Relief. 

****************************************************************************
The information contained in this email is intended only for the use of the intended recipient at the email address to which it has been addressed. If the reader of this message is not an intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination or copying of the message or associated attachments is strictly prohibited.

If you have received this email in error, please contact the sender by return email or call 01793 877777 and ask for the sender and then delete it immediately from your system.Please note that neither RWE npower nor the sender accepts any responsibility for viruses and it is your responsibility to scan attachments (if any).
*****************************************************************************