Gerald -

More on my production-only segfault...

I put the following code into eputil.c (the Embperl routine
closest to the segfault):

--- /home/install/httpd/2.1-db/src/embperl/embperl/eputil.c     2004-03-07 
09:44:14.000000000 -1000
+++ ../embperl/eputil.c 2004-04-28 05:43:01.118170288 -1000
@@ -745,6 +745,29 @@
     return nDefault ;
     }
 
+static void dumper_dump( unsigned char *buf, int offset, int len )
+{
+  int i;
+  fprintf( stderr, "%04x:", offset );
+  for( i = 0; i < len; i++ ) {
+    if( i % 4 == 0 ) fprintf( stderr, " " ); 
+    fprintf( stderr, "%02x", buf[offset+i] );
+  }
+  fprintf( stderr, " |" );
+  for( i = 0; i < len; i++ ) {
+    if( i % 4 == 0 ) fprintf( stderr, " " ); 
+    fprintf( stderr, "%c", ( buf[offset+i] >= '0' && buf[offset+i] <= 'z' ) ? 
buf[offset+i] : '.' );
+  }
+  fprintf( stderr, "\n" );
+}
+
+static void dumper( char *title, unsigned char *buf, int len )
+{
+  int i;
+  fprintf( stderr, "%s\n", title );
+  for( i = 0; i < len; i += 16 )
+    dumper_dump( buf, i, (len - i >= 16) ? 16 : len - i );
+}
 
 char * GetHashValueStr (/*in*/  pTHX_
                         /*in*/  HV *           pHash,
@@ -754,13 +777,37 @@
     {
     SV **   ppSV ;
     STRLEN  l ;
+    STRLEN len;
+    char * buf;
+    char check;
+    bool exists;
 
     /*EPENTRY (GetHashValueInt) ;*/
 
+    fprintf( stderr, "GetHashValueStr pHash '%p' sKey '%s' sDefault '%s'\n",
+             pHash, sKey, sDefault );
+    if( pHash == NULL )
+      fprintf( stderr, "pHash is NULL\n" );
+    else {
+      fprintf( stderr, "checking pointer to pHash\n" );
+      check = *( char * )pHash;
+      fprintf( stderr, "OK\n" );
+      dumper( "first 128 bytes of pHash", ( unsigned char * )pHash, 128 );
+      fprintf( stderr, "checking if key exists\n" );
+      exists = hv_exists( pHash, ( char * )sKey, strlen( sKey ) );
+      fprintf( stderr, "%s\n", ( exists ) ? "yes" : "no" );
+    }
+
     ppSV = hv_fetch(pHash, (char *)sKey, strlen (sKey), 0) ;  
-    if (ppSV != NULL)
+    if (ppSV != NULL) {
+      buf = SvPV( *ppSV, len );
+      fprintf( stderr, "ppSV: len = '%d', content = '%s'\n",
+               len, buf );
         return SvPV (*ppSV, l) ;
-        
+    }
+    
+    fprintf( stderr, "ppSV is NULL\n" );
+
     return sDefault ;
     }

What I am trying to do is see the parameters into and out of where the
seqfault occurs in GetHashValueStr.

Near the top if the error_log, a hash at 0x83695cc is sucessfully
accessed:

[Wed Apr 28 05:43:45 2004] [warn] EmbperlDebug: get_appname Embperl[7540/0]\n
[Wed Apr 28 05:43:45 2004] [warn] EmbperlDebug: Get MAILHOST (type=char *) 
beaucox.com\n
[Wed Apr 28 05:43:45 2004] [warn] EmbperlDebug: Get MAIL_ERRORS_TO (type=char 
*) [EMAIL PROTECTED]
GetHashValueStr pHash '0x83695cc' sKey 'EMBPERL_SESSION_ARGS' sDefault 
'(null)'
checking pointer to pHash
OK
first 128 bytes of pHash
0000: 90ab7808 01000000 0bc00020 90a83608 | ..x. .... .... ..6.
0010: 01000000 0d600000 00000000 01000000 | .... .`.. .... ....
0020: 00000000 00000000 01000000 00000000 | .... .... .... ....
0030: f8015208 01000000 07c00404 18574608 | ..R. .... .... .WF.
0040: 01000000 0c000000 20a83608 01000000 | .... .... ..6. ....
0050: 0d600000 a0c72b08 01000000 04000404 | .`.. .... .... ....
0060: c8564608 01000000 0c000404 00000000 | .VF. .... .... ....
0070: 01000000 00050000 089d3008 01000000 | .... .... ..0. ....
checking if key exists
no
ppSV is NULL

Now just before the segfault, that same hash at 0x83695cc is accessed
again. But look at the first word of the hash: it looks as if the hash
is no longer valid or has been released. Note, most of the other words
in that memory match the earlier dump:

[Wed Apr 28 05:43:47 2004] [warn] EmbperlDebug: GetApacheConfig for dir\n
[Wed Apr 28 05:43:47 2004] [warn] EmbperlDebug: get_appname 
my_embtest_app[7540/0]\n
GetHashValueStr pHash '0x83695cc' sKey 'EMBPERL_ALLOW' sDefault '(null)'
checking pointer to pHash
OK
first 128 bytes of pHash
0000: 000f5208 01000000 07c00404 90a83608 | ..R. .... .... ..6.
0010: 01000000 0d600000 00000000 01000000 | .... .`.. .... ....
0020: 00000000 00000000 01000000 00000000 | .... .... .... ....
0030: 18025208 01000000 07c00404 18574608 | ..R. .... .... .WF.
0040: 01000000 0c000000 20a83608 01000000 | .... .... ..6. ....
0050: 0d600000 a0c72b08 01000000 04000404 | .`.. .... .... ....
0060: c8564608 01000000 0c000404 00000000 | .VF. .... .... ....
0070: 01000000 00050000 58025208 01000000 | .... .... X.R. ....
checking if key exists

The segfault happens in my hv_exists() call prob. because the hash
is no more.

I don't know enough abount perl internals to make much sense if this,
but maybe something will ring a bell for you.

Aloha => Beau;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to