You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Nicolas Lehuen <ni...@lehuen.com> on 2006/02/15 07:29:57 UTC

Testing mod_python SVN trunk with Apache 2.2 on Win32

Hi,

I've built Apache 2.2 and tested mod_python SVN trunk with it.

The two register_cleanup tests fail. Apparently it's because the test
code registers a cleanup function giving the current request as
parameter. Of course when the cleanup function is called, the request
object is no longer valid, and Apache segfaults.

Fixing this is only a matter of fixing the test code, yet I wonder how
this code could properly run on Apache 2.0.55. Maybe the request
object was not properly destroyed and this has been fixed in Apache
2.2 ?

This also shows that we should document the fact that the current
request object should not be passed directly or indirectly to the
*.register_cleanup functions. Maybe we could implement  a little test
in those function to make sure it is not passed directly ?

Those two failures aside, the rest of the tests are OK.

Regards,
Nicolas

Re: Testing mod_python SVN trunk with Apache 2.2 on Win32

Posted by Graham Dumpleton <gr...@dscpl.com.au>.
I have already noted that apache.register_cleanup() and
req.server.register_cleanup() are prone to failure. The problem
is that they are run in the context of a signal handler. See:

   http://issues.apache.org/jira/browse/MODPYTHON-109

I suggested in the JIRA issue that these functions may need to
be removed unless an equivalent can be found that is safe.

Graham

On 16/02/2006, at 6:55 AM, Nicolas Lehuen wrote:

> 2006/2/15, Jim Gallacher <jp...@jgassociates.ca>:
>> Nicolas Lehuen wrote:
>>> 2006/2/15, Jim Gallacher <jp...@jgassociates.ca>:
>>>
>>>> Nicolas Lehuen wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I've built Apache 2.2 and tested mod_python SVN trunk with it.
>>>>>
>>>>> The two register_cleanup tests fail. Apparently it's because  
>>>>> the test
>>>>> code registers a cleanup function giving the current request as
>>>>> parameter. Of course when the cleanup function is called, the  
>>>>> request
>>>>> object is no longer valid, and Apache segfaults.
>>>>>
>>>>> Fixing this is only a matter of fixing the test code, yet I  
>>>>> wonder how
>>>>> this code could properly run on Apache 2.0.55. Maybe the request
>>>>> object was not properly destroyed and this has been fixed in  
>>>>> Apache
>>>>> 2.2 ?
>>>>
>>>> The tests pass as-is on Debian linux, so this seems to be Win32  
>>>> specific.
>>>>
>>>> Jim
>>>>
>>>
>>>  Yet there is no way it should pass anywhere : the test is de facto
>>> using an old request object during the shutdown of the server.  
>>> Either
>>> this old request object is still valid, and we have to ask ourselves
>>> why it hasn't be properly destroyed, or the old request object isn't
>>> valid and we are just lucky under Linux and unlucky under Win32.
>>>
>>> BTW, I've launched the debugger and Apache segfaults when
>>> dereferencing the request object to get its server object, during an
>>> ap_log_rerror() call.
>>
>> Just to make sure I didn't introduce any regressions with the code
>> cleanup I recently checked in, could you retest with revision 376545?
>> The only diffence between that rev and 3.2.7 is the Apache 2.2  
>> support
>> and bash 3.1 configure problem.
>>
>> svn co -r 376545 https://svn.apache.org/repos/asf/httpd/mod_python/ 
>> trunk
>> mp.3765545
>>
>> Jim
>>
>
> I've corrected the tests and the documentation, which were both wrong
> about the usage of apache.register_cleanup and
> server.register_cleanup.
>
> I still wonder how those two test could possibly have passed before.
> The usage of apache.register_cleanup was plain wrong, it should never
> have passed. This is not particularly reassuring about the legitimity
> of our test suite. I've double checked the code, and I don't see
> what's wrong here, so if anyone want to give a try...
>
> Anyway, FWIW, now the whole unit test suite passes with Apache 2.2
> under Windows XP SP2.
>
> Regards,
> Nicolas


Re: Testing mod_python SVN trunk with Apache 2.2 on Win32

Posted by Nicolas Lehuen <ni...@lehuen.com>.
2006/2/15, Jim Gallacher <jp...@jgassociates.ca>:
> Nicolas Lehuen wrote:
> > 2006/2/15, Jim Gallacher <jp...@jgassociates.ca>:
> >
> >>Nicolas Lehuen wrote:
> >>
> >>>Hi,
> >>>
> >>>I've built Apache 2.2 and tested mod_python SVN trunk with it.
> >>>
> >>>The two register_cleanup tests fail. Apparently it's because the test
> >>>code registers a cleanup function giving the current request as
> >>>parameter. Of course when the cleanup function is called, the request
> >>>object is no longer valid, and Apache segfaults.
> >>>
> >>>Fixing this is only a matter of fixing the test code, yet I wonder how
> >>>this code could properly run on Apache 2.0.55. Maybe the request
> >>>object was not properly destroyed and this has been fixed in Apache
> >>>2.2 ?
> >>
> >>The tests pass as-is on Debian linux, so this seems to be Win32 specific.
> >>
> >>Jim
> >>
> >
> >  Yet there is no way it should pass anywhere : the test is de facto
> > using an old request object during the shutdown of the server. Either
> > this old request object is still valid, and we have to ask ourselves
> > why it hasn't be properly destroyed, or the old request object isn't
> > valid and we are just lucky under Linux and unlucky under Win32.
> >
> > BTW, I've launched the debugger and Apache segfaults when
> > dereferencing the request object to get its server object, during an
> > ap_log_rerror() call.
>
> Just to make sure I didn't introduce any regressions with the code
> cleanup I recently checked in, could you retest with revision 376545?
> The only diffence between that rev and 3.2.7 is the Apache 2.2 support
> and bash 3.1 configure problem.
>
> svn co -r 376545 https://svn.apache.org/repos/asf/httpd/mod_python/trunk
> mp.3765545
>
> Jim
>

I've corrected the tests and the documentation, which were both wrong
about the usage of apache.register_cleanup and
server.register_cleanup.

I still wonder how those two test could possibly have passed before.
The usage of apache.register_cleanup was plain wrong, it should never
have passed. This is not particularly reassuring about the legitimity
of our test suite. I've double checked the code, and I don't see
what's wrong here, so if anyone want to give a try...

Anyway, FWIW, now the whole unit test suite passes with Apache 2.2
under Windows XP SP2.

Regards,
Nicolas

Re: Testing mod_python SVN trunk with Apache 2.2 on Win32

Posted by Jim Gallacher <jp...@jgassociates.ca>.
Nicolas Lehuen wrote:
> 2006/2/15, Jim Gallacher <jp...@jgassociates.ca>:
> 
>>Nicolas Lehuen wrote:
>>
>>>Hi,
>>>
>>>I've built Apache 2.2 and tested mod_python SVN trunk with it.
>>>
>>>The two register_cleanup tests fail. Apparently it's because the test
>>>code registers a cleanup function giving the current request as
>>>parameter. Of course when the cleanup function is called, the request
>>>object is no longer valid, and Apache segfaults.
>>>
>>>Fixing this is only a matter of fixing the test code, yet I wonder how
>>>this code could properly run on Apache 2.0.55. Maybe the request
>>>object was not properly destroyed and this has been fixed in Apache
>>>2.2 ?
>>
>>The tests pass as-is on Debian linux, so this seems to be Win32 specific.
>>
>>Jim
>>
> 
>  Yet there is no way it should pass anywhere : the test is de facto
> using an old request object during the shutdown of the server. Either
> this old request object is still valid, and we have to ask ourselves
> why it hasn't be properly destroyed, or the old request object isn't
> valid and we are just lucky under Linux and unlucky under Win32.
> 
> BTW, I've launched the debugger and Apache segfaults when
> dereferencing the request object to get its server object, during an
> ap_log_rerror() call.

Just to make sure I didn't introduce any regressions with the code 
cleanup I recently checked in, could you retest with revision 376545? 
The only diffence between that rev and 3.2.7 is the Apache 2.2 support 
and bash 3.1 configure problem.

svn co -r 376545 https://svn.apache.org/repos/asf/httpd/mod_python/trunk 
mp.3765545

Jim

Re: Testing mod_python SVN trunk with Apache 2.2 on Win32

Posted by Nicolas Lehuen <ni...@lehuen.com>.
2006/2/15, Jim Gallacher <jp...@jgassociates.ca>:
> Nicolas Lehuen wrote:
> > Hi,
> >
> > I've built Apache 2.2 and tested mod_python SVN trunk with it.
> >
> > The two register_cleanup tests fail. Apparently it's because the test
> > code registers a cleanup function giving the current request as
> > parameter. Of course when the cleanup function is called, the request
> > object is no longer valid, and Apache segfaults.
> >
> > Fixing this is only a matter of fixing the test code, yet I wonder how
> > this code could properly run on Apache 2.0.55. Maybe the request
> > object was not properly destroyed and this has been fixed in Apache
> > 2.2 ?
>
> The tests pass as-is on Debian linux, so this seems to be Win32 specific.
>
> Jim
>
 Yet there is no way it should pass anywhere : the test is de facto
using an old request object during the shutdown of the server. Either
this old request object is still valid, and we have to ask ourselves
why it hasn't be properly destroyed, or the old request object isn't
valid and we are just lucky under Linux and unlucky under Win32.

BTW, I've launched the debugger and Apache segfaults when
dereferencing the request object to get its server object, during an
ap_log_rerror() call.

Regards,
Nicolas

Re: Testing mod_python SVN trunk with Apache 2.2 on Win32

Posted by Jim Gallacher <jp...@jgassociates.ca>.
Nicolas Lehuen wrote:
> Hi,
> 
> I've built Apache 2.2 and tested mod_python SVN trunk with it.
> 
> The two register_cleanup tests fail. Apparently it's because the test
> code registers a cleanup function giving the current request as
> parameter. Of course when the cleanup function is called, the request
> object is no longer valid, and Apache segfaults.
> 
> Fixing this is only a matter of fixing the test code, yet I wonder how
> this code could properly run on Apache 2.0.55. Maybe the request
> object was not properly destroyed and this has been fixed in Apache
> 2.2 ?

The tests pass as-is on Debian linux, so this seems to be Win32 specific.

Jim

Re: Testing mod_python SVN trunk with Apache 2.2 on Win32

Posted by Graham Dumpleton <gr...@dscpl.com.au>.
On 15/02/2006, at 5:29 PM, Nicolas Lehuen wrote:

> Hi,
>
> I've built Apache 2.2 and tested mod_python SVN trunk with it.
>
> The two register_cleanup tests fail. Apparently it's because the test
> code registers a cleanup function giving the current request as
> parameter. Of course when the cleanup function is called, the request
> object is no longer valid, and Apache segfaults.
>
> Fixing this is only a matter of fixing the test code, yet I wonder how
> this code could properly run on Apache 2.0.55. Maybe the request
> object was not properly destroyed and this has been fixed in Apache
> 2.2 ?
>
> This also shows that we should document the fact that the current
> request object should not be passed directly or indirectly to the
> *.register_cleanup functions. Maybe we could implement  a little test
> in those function to make sure it is not passed directly ?
>
> Those two failures aside, the rest of the tests are OK.

I have had a quick go on Mac OS X with Apache 2.2 and SVN trunk and
I get test_global_lock failing. Will have to wait until tomorrow for  
me to
look at it further.

Graham