You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Beau E. Cox" <be...@beaucox.com> on 2004/02/18 21:53:00 UTC

Re: [apreq2] proper support for ithreads

TO RECAP:
> > On Monday 16 February 2004 10:39 am, you wrote:
> >>Beau E. Cox wrote:
> >>[...]
> >>
> >>>Yep, the project I did - "HTML::Mason:::ApacheHandler2" -
> >>>on CPAN at
> >>><http://search.cpan.org/~beau/HTML-Mason-ApacheHandler2-0.01/>
> >>>is ALL mp2; that's where I had the
> >>>"attemping to free ... scalar ... " messages, and
> >>>why I moved to 5.8.3.
> >>
> >>Sorry for the delay, Beau.
> >>
> >>Please try with 5.8.2 and the current cvs of httpd-apreq-2, I've added a
> >>proper support for ithreads.
> >
> > Hi Stas:
> >
> > I'm having trouble building httpd-apreq-2 from cvs:
> >
> > 0. perl 5.8.2 reinstalled, apache2 (2.0.48) and mod_perl 2
> > (latest cvs) made and installed.
> > 1. CVS download OK.
> > 2. Checked that I have all dependencies - OK.
> > 3. ./buildconf - OK
> > 4. perl Makefile.PL --with-apache2-apxs=/usr/apache2/sbin/apxs - OK
> > 5. make - get the following (after it runs a while):
> >
> > [...]
> >
> >  cd  && /bin/sh ./config.status Makefile
> > ./config.status: ./config.status: No such file or directory
> > make: *** [Makefile] Error 127
> >
> > Looks like a 'cd' to nowhere, then ./config.status can't be found...?
> >

The make problem seems to be because $top_builddir is NOT defined.
Assuming you are building in the same directory as top_srcdir, as I
am, move the 'empty' top_builddir def to the top of the file as:

 srcdir = .
 top_srcdir = .
 top_builddir = .
 ^

and define it as '.'; the make then works (sorry, I'm weak in
the automake department being an ex-M$ weenie :) ),

Now the make works.

I intalled http-apreq2-cvs (as of 1 hour ago) and cranked up
my server with perl 5.8.2. Alas, I receive the same series of
errors I received before moving to perl 5.8.3, such as:

Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
[Wed Feb 18 10:12:34 2004] [notice] caught SIGTERM, shutting down

Stas asked me if I could make a 'test' case to display this
behaviour; I have not been able to reproduce this problem outside
if my apache2/mod_perl 2/mason/etc. server setup yet.

Anyway, I now have a test bed that I can fire up on my test server
whenever more patches are forthcoming (If you folks need it).

Aloha => Beau;


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [apreq2] proper support for ithreads

Posted by "Beau E. Cox" <be...@beaucox.com>.
On Wednesday 18 February 2004 11:54 am, Stas Bekman wrote:
> Beau E. Cox wrote:
> [...]
>
> > OK, but I also got:
> >
> > Attempt to free unreferenced scalar: SV 0x40601238
> > at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160.
> > Attempt to free unreferenced scalar: SV 0x40601238
> > at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 161.
>
> And these warnings go away with 5.8.3? Do you get them only when using DBI
> or with out as well? If Mason doesn't use XS, which modules that use XS
> does it load?

Yes, the warnings go away with 5.8.3.
I have not tried w/o DBI.
No, Mason does not use XS directly.
I don't know what 'XS' modules Mason loads, but
  will investigate.

Thanks for the tutorial. I'm busy getting subversion installed;
Will get back to you soon.

Aloha => Beau;


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [apreq2] proper support for ithreads

Posted by "Beau E. Cox" <be...@beaucox.com>.
On Wednesday 18 February 2004 11:54 am, Stas Bekman wrote:
> Beau E. Cox wrote:
> [...]
>
> > OK, but I also got:
> >
> > Attempt to free unreferenced scalar: SV 0x40601238
> > at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160.
> > Attempt to free unreferenced scalar: SV 0x40601238
> > at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 161.
>
> And these warnings go away with 5.8.3? Do you get them only when using DBI
> or with out as well? If Mason doesn't use XS, which modules that use XS
> does it load?

Yes, the warnings go away with 5.8.3.
I have not tried w/o DBI.
No, Mason does not use XS directly.
I don't know what 'XS' modules Mason loads, but
  will investigate.

Thanks for the tutorial. I'm busy getting subversion installed;
Will get back to you soon.

Aloha => Beau;


Re: [apreq2] proper support for ithreads

Posted by Stas Bekman <st...@stason.org>.
Beau E. Cox wrote:
[...]
> OK, but I also got:
> 
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 161.

And these warnings go away with 5.8.3? Do you get them only when using DBI or 
with out as well? If Mason doesn't use XS, which modules that use XS does it load?

> Anyway, sure, I should have time this week for DBI (and then maybe I
> can attack Mason), but I'll need some coaching to fix DBI.
> 
> So as a plan, I'll get DBI and try to make some headway; when I have
> a better feeling for how to fix the problem, I'll post questions
> here, OK?

Sure. This is relevant to any XS module. You start by including:

#define PERL_NO_GET_CONTEXT

before these loads:

#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>

So in case of DBI, that would be:

--- DBIXS.h.orig        2004-02-18 13:46:24.000000000 -0800
+++ DBIXS.h     2004-02-18 13:46:53.000000000 -0800
@@ -14,6 +14,7 @@
  #endif

  /* first pull in the standard Perl header files for extensions */
+#define PERL_NO_GET_CONTEXT /* we want efficiency */
  #define PERL_POLLUTE
  #include <EXTERN.h>
  #include <perl.h>

then, when you build things. You will start getting errors like these:

In file included from Perl.c:40:
Driver_xst.h: In function `dbixst_bounce_method':
Driver_xst.h:14: error: `my_perl' undeclared (first use in this function)
Driver_xst.h:14: error: (Each undeclared identifier is reported only once
Driver_xst.h:14: error: for each function it appears in.)
Driver_xst.h: In function `dbdxst_bind_params':
Driver_xst.h:54: error: `my_perl' undeclared (first use in this function)
Driver_xst.h: In function `dbdxst_fetchall_arrayref':
Driver_xst.h:75: error: `my_perl' undeclared (first use in this function)

So you need to add pTHX/pTHX_ as the first argument in function declarations 
and aTHX/aTHX_ in the function calls. And eventually these errors will go 
away. Do not use dTHX, since it reverts things to the way they were before. 
And as you go eliminate any dTHX calls that you use. For more information 
please refer to the perlguts manpage, when it talks about:

    The third, even more efficient way is to ape how it is done within
    the Perl guts:
    ...

now any follow ups to this specific issue of DBI should probably go to the 
dbi-dev mailing list, since it's off topic to this list.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [apreq2] proper support for ithreads

Posted by Stas Bekman <st...@stason.org>.
Beau E. Cox wrote:
[...]
> OK, but I also got:
> 
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 161.

And these warnings go away with 5.8.3? Do you get them only when using DBI or 
with out as well? If Mason doesn't use XS, which modules that use XS does it load?

> Anyway, sure, I should have time this week for DBI (and then maybe I
> can attack Mason), but I'll need some coaching to fix DBI.
> 
> So as a plan, I'll get DBI and try to make some headway; when I have
> a better feeling for how to fix the problem, I'll post questions
> here, OK?

Sure. This is relevant to any XS module. You start by including:

#define PERL_NO_GET_CONTEXT

before these loads:

#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>

So in case of DBI, that would be:

--- DBIXS.h.orig        2004-02-18 13:46:24.000000000 -0800
+++ DBIXS.h     2004-02-18 13:46:53.000000000 -0800
@@ -14,6 +14,7 @@
  #endif

  /* first pull in the standard Perl header files for extensions */
+#define PERL_NO_GET_CONTEXT /* we want efficiency */
  #define PERL_POLLUTE
  #include <EXTERN.h>
  #include <perl.h>

then, when you build things. You will start getting errors like these:

In file included from Perl.c:40:
Driver_xst.h: In function `dbixst_bounce_method':
Driver_xst.h:14: error: `my_perl' undeclared (first use in this function)
Driver_xst.h:14: error: (Each undeclared identifier is reported only once
Driver_xst.h:14: error: for each function it appears in.)
Driver_xst.h: In function `dbdxst_bind_params':
Driver_xst.h:54: error: `my_perl' undeclared (first use in this function)
Driver_xst.h: In function `dbdxst_fetchall_arrayref':
Driver_xst.h:75: error: `my_perl' undeclared (first use in this function)

So you need to add pTHX/pTHX_ as the first argument in function declarations 
and aTHX/aTHX_ in the function calls. And eventually these errors will go 
away. Do not use dTHX, since it reverts things to the way they were before. 
And as you go eliminate any dTHX calls that you use. For more information 
please refer to the perlguts manpage, when it talks about:

    The third, even more efficient way is to ape how it is done within
    the Perl guts:
    ...

now any follow ups to this specific issue of DBI should probably go to the 
dbi-dev mailing list, since it's off topic to this list.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [apreq2] proper support for ithreads

Posted by "Beau E. Cox" <be...@beaucox.com>.
On Wednesday 18 February 2004 11:23 am, Stas Bekman wrote:
> Beau E. Cox wrote:
> [...]
>
> > Attempt to free unreferenced scalar: SV 0x40601238 at
> > /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> >
> [...]
>
> OK, I thought DBI has resolved this issue, but apparently it's still on the
> TODO list:
>
> /home/stas/.cpan/build/DBI-1.40> grep -Ir PERL_NO_GET_CONTEXT .
> ./ToDo:Add PERL_NO_GET_CONTEXT for multiplicity/threads?
>
> But it's not longer an apreq problem (either 1 or 2).
>
> [...]

> Now someone needs to patch DBI and send it to Tim. It's a good exercise to
> learn about the contexts if anybody is willing to learn. Once this is
> added, DBI won't have this problem under 5.8.2 any longer. If you decide to
> do it and need help, let me know.
>
> BTW, the latest DBI dev is available via svn:
> http://aspn.activestate.com/ASPN/Mail/Message/perl-DBI-dev/1987815

OK, but I also got:

Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 161.

Anyway, sure, I should have time this week for DBI (and then maybe I
can attack Mason), but I'll need some coaching to fix DBI.

So as a plan, I'll get DBI and try to make some headway; when I have
a better feeling for how to fix the problem, I'll post questions
here, OK?

Aloha => Beau;


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [apreq2] proper support for ithreads

Posted by "Beau E. Cox" <be...@beaucox.com>.
On Wednesday 18 February 2004 11:23 am, Stas Bekman wrote:
> Beau E. Cox wrote:
> [...]
>
> > Attempt to free unreferenced scalar: SV 0x40601238 at
> > /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> >
> [...]
>
> OK, I thought DBI has resolved this issue, but apparently it's still on the
> TODO list:
>
> /home/stas/.cpan/build/DBI-1.40> grep -Ir PERL_NO_GET_CONTEXT .
> ./ToDo:Add PERL_NO_GET_CONTEXT for multiplicity/threads?
>
> But it's not longer an apreq problem (either 1 or 2).
>
> [...]

> Now someone needs to patch DBI and send it to Tim. It's a good exercise to
> learn about the contexts if anybody is willing to learn. Once this is
> added, DBI won't have this problem under 5.8.2 any longer. If you decide to
> do it and need help, let me know.
>
> BTW, the latest DBI dev is available via svn:
> http://aspn.activestate.com/ASPN/Mail/Message/perl-DBI-dev/1987815

OK, but I also got:

Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160.
Attempt to free unreferenced scalar: SV 0x40601238 
at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 161.

Anyway, sure, I should have time this week for DBI (and then maybe I
can attack Mason), but I'll need some coaching to fix DBI.

So as a plan, I'll get DBI and try to make some headway; when I have
a better feeling for how to fix the problem, I'll post questions
here, OK?

Aloha => Beau;


Re: [apreq2] proper support for ithreads

Posted by Stas Bekman <st...@stason.org>.
Beau E. Cox wrote:
[...]
> Now the make works.
> 
> I intalled http-apreq2-cvs (as of 1 hour ago) and cranked up
> my server with perl 5.8.2. Alas, I receive the same series of
> errors I received before moving to perl 5.8.3, such as:
> 
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> [Wed Feb 18 10:12:34 2004] [notice] caught SIGTERM, shutting down
> 
> Stas asked me if I could make a 'test' case to display this
> behaviour; I have not been able to reproduce this problem outside
> if my apache2/mod_perl 2/mason/etc. server setup yet.

OK, I thought DBI has resolved this issue, but apparently it's still on the 
TODO list:

/home/stas/.cpan/build/DBI-1.40> grep -Ir PERL_NO_GET_CONTEXT .
./ToDo:Add PERL_NO_GET_CONTEXT for multiplicity/threads?

But it's not longer an apreq problem (either 1 or 2).

> Anyway, I now have a test bed that I can fire up on my test server
> whenever more patches are forthcoming (If you folks need it).

Now someone needs to patch DBI and send it to Tim. It's a good exercise to 
learn about the contexts if anybody is willing to learn. Once this is added, 
DBI won't have this problem under 5.8.2 any longer. If you decide to do it and 
need help, let me know.

BTW, the latest DBI dev is available via svn:
http://aspn.activestate.com/ASPN/Mail/Message/perl-DBI-dev/1987815
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [apreq2] proper support for ithreads

Posted by Stas Bekman <st...@stason.org>.
Beau E. Cox wrote:
[...]
> Now the make works.
> 
> I intalled http-apreq2-cvs (as of 1 hour ago) and cranked up
> my server with perl 5.8.2. Alas, I receive the same series of
> errors I received before moving to perl 5.8.3, such as:
> 
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/i686-linux-thread-multi/DBI.pm line 633.
> [Wed Feb 18 10:12:34 2004] [notice] caught SIGTERM, shutting down
> 
> Stas asked me if I could make a 'test' case to display this
> behaviour; I have not been able to reproduce this problem outside
> if my apache2/mod_perl 2/mason/etc. server setup yet.

OK, I thought DBI has resolved this issue, but apparently it's still on the 
TODO list:

/home/stas/.cpan/build/DBI-1.40> grep -Ir PERL_NO_GET_CONTEXT .
./ToDo:Add PERL_NO_GET_CONTEXT for multiplicity/threads?

But it's not longer an apreq problem (either 1 or 2).

> Anyway, I now have a test bed that I can fire up on my test server
> whenever more patches are forthcoming (If you folks need it).

Now someone needs to patch DBI and send it to Tim. It's a good exercise to 
learn about the contexts if anybody is willing to learn. Once this is added, 
DBI won't have this problem under 5.8.2 any longer. If you decide to do it and 
need help, let me know.

BTW, the latest DBI dev is available via svn:
http://aspn.activestate.com/ASPN/Mail/Message/perl-DBI-dev/1987815
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html