ePN (embedded Perl Nag) with Perl 5.8.0. Not broken on all OS ...

Ethan Galstad nagios at nagios.org
Wed Jan 29 05:38:39 CET 2003


On 31 Jan 2003 at 13:29, Stanley Hopcroft wrote:

> Dear Ladies and Gentlemen,
> 
> 
> I am writing to withdraw my earlier mistaken claim that Nagios-1.0 (and
> probably Netsaint) with the embedded Perl interpreter (ePN), is broken
> with Perl 5.8.0.
> 
> (This claim was based on seeing the embedded Perl simulator - mini_epn.c 
> SEGV wtih Perl 5.8.0. In fact there was a coding error in mini_epn.c 
> [not unfortunately visible in any of the Nag base code that can use 
> Perl]).
> 
> I have ePN running on this FreeBSD 4.7-RELEASE host with the FreeBSD 
> Perl 5.8.0 port.
> 
> pc09011# cd /usr/local/nagios
> pc09011# bin/nagios -m
> 
> Nagios 1.0
> Copyright (c) 1999-2002 Ethan Galstad (nagios at nagios.org)
> Last Modified: 11-24-2002
> License: GPL
> 
> External Data I/O
> -----------------
> Object Data:      TEMPLATE
> Status Data:      DEFAULT
> Retention Data:   DEFAULT
> Comment Data:     DEFAULT
> Downtime Data:    DEFAULT
> Performance Data: DEFAULT
> 
> Options
> -------
> * Embedded Perl compiler (With caching)
> 
> pc09011# perl -v | head -3
> 
> This is perl, v5.8.0 built for i386-freebsd
> 
> This Perl is built without _any_ thread support 
> 
> (usethreads=undef use5005threads=undef useithreads=undef 
> usemultiplicity=undef)
> 
> So. it may be the case that the systems having problems with ePN are 
> those systems that have Perls built with thread support, and there is a 
> problem with Nag support for threaded Perls (or there are still problems 
> with Perl threads).
> 
> I would like to hear from those that would like to spend some more time 
> trying to deal with this problem.
> 
> Please would you send me
> 
> 1 OS details (Name and major version)
> 2 Perl threaded details (perl -V | grep thread)
> 3 Whether or not you can try ePN with an unthreaded Perl
> 
> FWIW, none of the Perl plugins I am aware of takes advantage of threads. 
> An unthreaded Perl would therefore work as well as a threaded one.
> 
> Yours sincerely.
> 
[snip]

Reuben Farrelly just sent me the patch below which might solve the 
problem.  I haven't applied it to CVS yet, but will this weekend if 
it looks okay.  Any chance you can give it a try and see if it solves 
the problem?


==

Hi Ethan,

This patch is included in the SuSE-8.0 linux distribution version of Nagios 
1.0.  I've just set up the latest 2.0a code from CVS and it too requires 
this patch which is included in the SuSE RPM.  Without it Nagios sigsegv's 
and dies silently - after applying Nagios seems to run just 
fine.  Obviously the CVS version is quite different so the patch had to be 
merged by hand..

Would be good if this could be merged into CVS  8)  Would it be helpful to 
run Nagios under gdb to get a backtrace of that fault?

This is with Perl 5.8.0 built for i586-linux-thread-multi

Reuben


--- base/nagios.c.orig	2002-09-16 04:25:36.000000000 +0200
+++ base/nagios.c	2002-10-16 13:03:11.000000000 +0200
@@ -57,6 +57,8 @@
  #include <EXTERN.h>
  #include <perl.h>
  #include <fcntl.h>
+#undef ctime	/* don't need perl's threaded version */
+#undef printf   /* can't use perl's printf until initialized */

  /* include PERL xs_init code for module and C library support */

@@ -85,17 +87,14 @@
  #  endif
  #endif

-EXTERN_C void xs_init _((void));
+EXTERN_C void xs_init _((pTHX));

-EXTERN_C void boot_DynaLoader _((CV* cv));
+EXTERN_C void boot_DynaLoader _((pTHX_ CV* cv));

  EXTERN_C void
-xs_init(void)
+xs_init(pTHX)
  {
  	char *file = __FILE__;
-#ifdef THREADEDPERL
-	dTHX;
-#endif
  	dXSUB_SYS;

  	/* DynaLoader is a special case */
@@ -778,9 +777,12 @@

  		/* cleanup embedded perl */
  #ifdef EMBEDDEDPERL
-		PL_perl_destruct_level=0;
-		perl_destruct(perl);
-		perl_free(perl);
+		{
+		    dTHX;
+		    PL_perl_destruct_level=0;
+		    perl_destruct(perl);
+		    perl_free(perl);
+		}
  #endif

  		/* log a shutdown message */
--- base/utils.c.orig	2002-07-03 06:41:43.000000000 +0200
+++ base/utils.c	2002-10-16 13:02:28.000000000 +0200
@@ -48,6 +48,11 @@
  #include <fcntl.h>
  /* In perl.h (or friends) there is a macro that defines sighandler as 
Perl_sighandler, so we must #undef it so we can use our sighandler() 
function */
  #undef sighandler
+/* and we don't need perl's reentrant versions */
+#undef localtime
+#undef getpwnam
+#undef getgrnam
+#undef strerror
  #endif

  char            *my_strtok_buffer=NULL;





Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com




More information about the Users mailing list