You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Jarrod Stenberg <sl...@yahoo.com> on 2002/08/21 21:17:07 UTC

Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

I'm trying to get to the bottom of trouble with a web
application that runs out of control and crashes the
apache children (Apache/1.3.26 on 4.6.2-RELEASE with
perl 5.6.1 [ all of my perl modules have been rebuilt
with 5.6.1 which seems to be a good idea on FreeBSD
]).

Not everything crashes, but certain pages do.  These
pages involve a forum app.  I have a file called
DrawMessageSummary.htm which is called again and again
by a file called DrawList.htm.

My hunch is that this has to do with poor HTML. 
Should we Embperl programmers be moving towards XHTML?
 I know that's not exactly the issue, but it gets you
thinking about doing things like such:

&lt;form&gt;
&lt;input type=&#34;submit&#34; /&gt;
&lt;/form&gt;

which is the same as:
&lt;form&gt;
&lt;input type=&#34;submit&#34;&gt;&lt;/input&gt;
&lt;/form&gt;

instead of:
&lt;form&gt;
&lt;input type=&#34;submit&#34;&gt;
&lt;/form&gt;

Of course the latter has a tag that is not closed.  Of
course, those of us who learned a long time ago gained
the bad habit of doing stuff like this:
&lt;br&gt;&lt;br&gt;&lt;hr&gt;&lt;p&gt;

And these are also unclosed tags.

Of course XHTML also involves attribute quoting, as in
XML and XSLT:
&lt;form action=&#34;submit.htm&#34;&gt;&lt;/form&gt;

instead of:
&lt;form action=submit.htm&gt;&lt;/form&gt;

So, of course I should move to XHTML as a good
practice, but is the unclosed tag thing something that
could cause Embperl to go nuts in 2.0b8?

Thank you,
-Jarrod, Iowa City IA

P.S.  Gerald, this software just keeps getting better!
 Great work.

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Jarrod Stenberg <sl...@yahoo.com>.
> (you haven't said what DBD driver you're using)

DBD::mysql

I'll try tuning the database cleanup.

Thanks for the ideas.
-Jarrod

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Angus Lees <gu...@inodes.org>.
At Thu, 22 Aug 2002 07:03:40 -0700 (PDT), Jarrod Stenberg wrote:
> Does not have any problems.  This file uses this:
> [$ while ($h = $sth->fetchrow_hashref()) $]
> [$ endwhile $]
> 
> But call it from the browser, and it kills the httpd
> instance.

(you haven't said what DBD driver you're using)

just in case its relevant, i found that DBI/DBD::Pg has some ref
counting issues.

if you keep the statement handle after the database handle has been
undeffed, strange things happen. (it was definately the cause of some
"spinning requests" we saw, it might even have been the cause of those
@ISA corruption bugs we saw a long time ago). when we went through our
code and were extremely careful about how we cleaned up our database
caches, apache became much more stable. (standard DBI prepare_cached
seems to work fine)

looking (quickly) at the DBD::Pg code, it seemed to be using standard
DBI XS macros to manage the handles; so this problem might exist in
all DBD modules.

-- 
 - Gus

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Solved...Sorta

Posted by Gerald Richter <ri...@ecos.de>.
>
> Yes it does.  I'm certain it does.

If make test is ok, we need a stackbacktrace. Compile Embperl with debug
support

perl Makefile.PL debug
make install

then start gdb

gdb /path/to/httpd
set args -f /path/to/your/httpd.conf -X
r

-> Now request the page that segfaults, after gdb reports the segafult type
BT

and send me the output

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



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


Re: Embperl-2.0b8 httpd Segmentation Faults. Solved...Sorta

Posted by Jarrod Stenberg <sl...@yahoo.com>.
--- Gerald Richter <ri...@ecos.de> wrote:
> 
> 
> > EMBPERL_SESSION_MODE 2
> >
> > Was the killer argument.  With it commented out,
> all
> > works fine.  So the problem must lie with
> > Apache::SessionX
> 
> Does make test work correctly? If not we should
> solve this first, because
> make test should test all this things and show us
> what goes wrong...

Yes it does.  I'm certain it does.
-Jarrod

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Solved...Sorta

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

> EMBPERL_SESSION_MODE 2
>
> Was the killer argument.  With it commented out, all
> works fine.  So the problem must lie with
> Apache::SessionX
>

Does make test work correctly? If not we should solve this first, because
make test should test all this things and show us what goes wrong...

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


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


Re: Embperl-2.0b8 httpd Segmentation Faults. Solved...Sorta

Posted by Jarrod Stenberg <sl...@yahoo.com>.
EMBPERL_SESSION_MODE 2

Was the killer argument.  With it commented out, all
works fine.  So the problem must lie with
Apache::SessionX

Right?  I found that Apache::Session was compiled with
the dubious default FreeBSD perl.  I removed it and
reinstalled it under 5.6.1, in addition to doing the
same for Apache::SessionX and some components such as
Storable.

This did not help.

I actually am very interested in cookie-less sessions.
:(
-Jarrod

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Jarrod Stenberg <sl...@yahoo.com>.
> PerlModule Embperl
> PerlModule DBI
> PerlModule DBD::whatever_you_use
> 
> Does this change anything? If not would be nice to
> get a stackbacktrace from
> Apache. Start Apache with -X option to debug.

I had to add:

PerModule DBD::mysql

Tried it, and it still faulted.  Starting apache with
-X, all I get is  fault message.  Is it supposed to
give me more?  I did compile Embperl with:

perl Makefile debug

As instructed in the documentation.  BUT, I apologize
for my ignorance on this, I can't find any extra data
in the logs.  I guess I don't know where to look for
it.

I have output from this argument in httpd.conf:
EMBPERL_DEBUG 2147475453

I'll email it to you privately.

-Jarrod  

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Gerald Richter - ecos gmbh <ri...@ecos.de>.

> embpexec.pl drawCompressed.htm "yr=2002&mo=08"
>
> Does not have any problems.  This file uses this:
> [$ while ($h = $sth->fetchrow_hashref()) $]
> [$ endwhile $]
>
> But call it from the browser, and it kills the httpd
> instance.
>

Please make sure you have loaded DBI & Embperl at the server startup, e.g.
in httpd.conf

PerlModule Embperl
PerlModule DBI
PerlModule DBD::whatever_you_use

Does this change anything? If not would be nice to get a stackbacktrace from
Apache. Start Apache with -X option to debug.

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Jarrod Stenberg <sl...@yahoo.com>.
embpexec.pl drawCompressed.htm "yr=2002&mo=08"

Does not have any problems.  This file uses this:
[$ while ($h = $sth->fetchrow_hashref()) $]
[$ endwhile $]

But call it from the browser, and it kills the httpd
instance.

FTR, both use the same perl.  I have check and
double-checked this.  So they should be using the same
modules.

Also, the above is true regardless of whether you run
embpexec.pl as a privileged user or not.
-Jarrod

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Jarrod Stenberg <sl...@yahoo.com>.
> 
> Mmmh, Embperl 2 should generate the same Perl code
> for both of these
> examples. Maybe it's related to the "do stuff" part?
> If you not already done
> so please make that part very simple, for example
> just a $i++ . Does it
> still crash?

It does not matter what I put in the block.  For
example, I have tried:

next;

Which still breaks it.  And, interestingly, this:

print OUT "got here"; exit;

does not crash within the while block.  So it does not
segfault on the first iteration, but the second.  This
does not work:

i++; exit if $i > 1;

I'll get a stacktraceback in a minute.
-Jarrod


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Gerald Richter <ri...@ecos.de>.
> So, of course I should move to XHTML as a good
> practice, but is the unclosed tag thing something that
> could cause Embperl to go nuts in 2.0b8?
>

Embperl doesn't care about if you close your tags or not. The only exception
are table tags that are used for build dynamic tables, but it will not crash
if you miss a </tr> or </table>, but tell you that there is a mismatch.

> I discovered that the segfaults are related to DBI.
> Given:
>
> # DBI is already loaded.
> $dbh = ...
> $sth = $dbh->prepare(...);
> $sth->execute();
>
> And the above is a successful query leaving me a
> handle with stuff to do.  If I do this:
>
>     while ($h = $sth->fetchrow_hashref()) {
>         #do stuff
>     }
>
> within the same block, it works fine.
>
> But, if I do this:
>
>     [$ while ($h = $sth->fetchrow_hashref()) $]
>        [# do stuff #]
>     [$ endwhile $]
>
> It segfaults the httpd instance.  I'm using namespaces
> as prescribed, I think.  What gives?  Any ideas?
>

Mmmh, Embperl 2 should generate the same Perl code for both of these
examples. Maybe it's related to the "do stuff" part? If you not already done
so please make that part very simple, for example just a $i++ . Does it
still crash?

If yes it would to very helpfull to get a stackbacktrace from gdb.

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags?

Posted by Jarrod Stenberg <sl...@yahoo.com>.
More info.

I discovered that the segfaults are related to DBI. 
Given:


If I do this:

    while ($h = $sth->fetchrow_hashref()) {
        #do stuff
    }

within the same block, it works fine.

But, if I do this:

    [$ while ($h = $sth->fetchrow_hashref()) $]


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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


Re: Embperl-2.0b8 httpd Segmentation Faults. Unclosed tags? Ignore previous.

Posted by Jarrod Stenberg <sl...@yahoo.com>.
More info.

I discovered that the segfaults are related to DBI. 
Given:

# DBI is already loaded.
$dbh = ...
$sth = $dbh->prepare(...);
$sth->execute();

And the above is a successful query leaving me a
handle with stuff to do.  If I do this:

    while ($h = $sth->fetchrow_hashref()) {
        #do stuff
    }

within the same block, it works fine.

But, if I do this:

    [$ while ($h = $sth->fetchrow_hashref()) $]
       [# do stuff #]
    [$ endwhile $]

It segfaults the httpd instance.  I'm using namespaces
as prescribed, I think.  What gives?  Any ideas?

-Jarrod
P.S.  Sorry about the double post.  My laptop went
whacky for a moment.

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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