You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Marc Beyer <dj...@tirwhan.org> on 2003/11/24 23:42:34 UTC

Segmentation fault

Hi,

I'm getting segmentation faults on a Redhat 7.2 machine with Apache 
1.3.27 (Redhat rpm apache-1.3.27-2.7.2), mod_perl 1.26 (Redhat rpm  
mod_perl-1.26-2) and HTML::Embperl 1.3.6 (from CPAN). I compiled Embperl 
with debug enabled which produced the attached backtrace (hope it's not 
too much). I've also attached a snippet of the .htmpl file which seems 
to cause the segfault, I can reproduce the error by posting the form and 
filling out the field "directorfirst" but not "starfirst", then pressing 
back on the browser and posting again with the field "starfirst" filled 
out but not "directorfirst" (dunno if that's any help).

Embperl builds without errors, tests run through without errors as well 
until the point where they try to start apache which doesn't work cause 
this is a production machine which runs a server I can't take down for 
testing.

I'd be happy if you could give me any pointers as to what I can do next, 
I'm kinda stuck at this point.

Thanks,

Marc

Re: Segmentation fault

Posted by Gerald Richter <ri...@ecos.de>.
>
>> Perl itself has some trouble with your $$searchdata.
>>
> Hmm, is there any way I can find out which part of perl (short of
> recompiling perl with debugging turned on)?
>

Maybe this helps, but I think you will not get much more information. I
think somehow the content of $$searchdata is corrupted, so Perl cannot
access it. I guess the problem is somewhere in the interaction of Perl and
Embperl

>
>> or try to change the way $$searchdata is
>> initialized/declared (I can#t say much about this, because I can't
>> see what else you are doing in your code)
>>
>>
> The data is POSTed to a CGI which parses it, puts it into a hash,
> decides which Embperl page to call and then calls that with
>

I first try to make a copy into a global and pass a reference to this
global. This is to try to find out what data is corrupted and maybe make a
copy before it gets problematic and use this copy.

>  HTML::Embperl::Execute({inputfile => "$HTMPLDIR/searchresults.htmpl",
>                           output    => \$output2,
>                           param     => [ $form, $datahash ]});
>
> with $form containing the reference to the form hash. The Embperl page
> starts with
>
> [- ($searchdata, $datahash) = @param; -]
>

TRy

@temp = @$searchdata ;
$seachdata = \@temp ;

You might do something similar before the Execute. I don't know if this
helps, it's just a try.
>
> One of the things I found odd about the gdb output were the non-ASCII
> characters in line 10:
>
> #10 0x42d53c3a in EMBPERL_EvalOnly (r=0x894a488, sArg=0x8951e80
> "¼A\232\b\230A\232\b_IMGDIR} || a", ppSV=0x89f23b4, flags=0,
> sName=0x89a4060 "ü¾\237\b") at epeval.c:574
>

This looks more a like problem of gdb. Sometime gdb cannot display the
correct values, because of compiler optimizations, because in line 9 the
correct value is displayed again.

Gerald

--------------------------------------------------------------
Gerald Richter     ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
--------------------------------------------------------------
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Segmentation fault

Posted by Marc Beyer <dj...@tirwhan.org>.
Hi Gerald,

thank you for your response.

Gerald Richter wrote:

>Perl itself has some trouble with your $$searchdata.
>
Hmm, is there any way I can find out which part of perl (short of 
recompiling perl with debugging turned on)?

> This maybe a result of
>using [* *], because [* *] is experimental in 1.3.x . Either replace the [*
>if ... *] whith [$ if  $]
>
I tried that and unfortunately it didn't change anything.

> or try to change the way $$searchdata is
>initialized/declared (I can#t say much about this, because I can't see what
>else you are doing in your code)
>  
>
The data is POSTed to a CGI which parses it, puts it into a hash, 
decides which Embperl page to call and then calls that with

 HTML::Embperl::Execute({inputfile => "$HTMPLDIR/searchresults.htmpl",
                          output    => \$output2,
                          param     => [ $form, $datahash ]});

with $form containing the reference to the form hash. The Embperl page 
starts with

[- ($searchdata, $datahash) = @param; -]

and that's how $searchdata gets initialized.

As far as I can tell the form parsing is fine, albeit manual. (At this 
point I should probably explain that this is not my code, I just need to 
fix it. I also don't have much experience with Embperl, so if any of 
this is no-no please feel free to shout at me).

One of the things I found odd about the gdb output were the non-ASCII 
characters in line 10:

#10 0x42d53c3a in EMBPERL_EvalOnly (r=0x894a488, sArg=0x8951e80 
"¼A\232\b\230A\232\b_IMGDIR} || a", ppSV=0x89f23b4, flags=0, 
sName=0x89a4060 "ü¾\237\b") at epeval.c:574

Could that have something to do with my problem?

Thanks for your help,

Marc


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Segmentation fault

Posted by Gerald Richter <ri...@ecos.de>.
Hi

>>
>> I'm getting segmentation faults on a Redhat 7.2 machine with Apache...

Perl itself has some trouble with your $$searchdata. This maybe a result of
using [* *], because [* *] is experimental in 1.3.x . Either replace the [*
if ... *] whith [$ if  $] or try to change the way $$searchdata is
initialized/declared (I can#t say much about this, because I can't see what
else you are doing in your code)

Gerald

--------------------------------------------------------------
Gerald Richter     ecos electronic communication services gmbh
IT-Securitylösungen * dynamische Webapplikationen * Consulting

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
--------------------------------------------------------------
|
|   ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
|
+-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org