Were you ever able to reproduce this with mod_wsgi 3.4?

On 15 July 2012 10:32, Jason Garber <[email protected]> wrote:
> Great. Will try to reproduce first.  Thanks!
>
> On Jul 14, 2012 8:30 PM, "Graham Dumpleton" <[email protected]>
> wrote:
>>
>> Can you try 3.4 from the source code repo.
>>
>> http://code.google.com/p/modwsgi/wiki/ChangesInVersion0304
>>
>> I recollect finding some issues with Python 3.X support which may have
>> silently fixed, but don't recollect what they were.
>>
>> Graham
>>
>> On 14 July 2012 17:15, Jason Garber <[email protected]> wrote:
>> > Hi Graham,
>> >
>> > I see you are using python 2.  I neglected to mention we are on Python
>> > 3.1.4.
>> >
>> > I will test with your test script and see if I can reproduce.
>> >
>> > Thanks!
>> > Jason
>> >
>> > On Jul 14, 2012 8:06 PM, "Graham Dumpleton" <[email protected]>
>> > wrote:
>> >>
>> >> On 12 July 2012 16:45, Jason Garber <[email protected]> wrote:
>> >> > Hello,
>> >> >
>> >> > I have a very odd situation.
>> >> >
>> >> > mod_wsgi 3.3 on RHEL 5 x86_64
>> >> >
>> >> >
>> >> > If I raise an exception in an html-generating function, it is caught
>> >> > just
>> >> > fine by my WSGI framework with a try/except block.
>> >> >
>> >> > If I raise the exact same exception within a plain function called
>> >> > from
>> >> > the
>> >> > same place, it causes a 500 internal server error:  mod_wsgi
>> >> > (pid=17007):
>> >> > Exception occurred processing WSGI script
>> >> >
>> >> > '/home/jason/Code/WhiteBoot4/DevLevel.2/TMTManage/WSGI/Dashboard.wsgi'
>> >> >
>> >> > I can place an explicit try/except around that exact spot, and it is
>> >> > completely skipped.  It's really bizarre.  Any ideas?
>> >> >
>> >> > Here is a simple example.  Note that I have actually reproduced it
>> >> > with
>> >> > this
>> >> > level of simplicity.
>> >> >
>> >> > def FunctionCalledByWSGIFile():
>> >> >   try:
>> >> >      RenderHTML()
>> >> >   except Exception as e:
>> >> >      # output error here
>> >> >   ...
>> >> >
>> >> > def RenderHTML():
>> >> >    ...
>> >> >    # This way works fine
>> >> >    raise Exception("foo")
>> >> >    ...
>> >> >    # This way causes 500 internal server error
>> >> >    data = Select()
>> >> >
>> >> > def Select():
>> >> >    raise Exception("foo")
>> >>
>> >> I have no problem with the following constructed based on what you
>> >> give.
>> >>
>> >> In both cases will print 'EXCEPTION foo' to log file.
>> >>
>> >> There is no 500 error as the exception is not reraised in that example.
>> >>
>> >> Try using a blind 'except' with type and then use:
>> >>
>> >>   except Exception as e:
>> >>      print 'EXCEPTION', e
>> >>
>> >>   except:
>> >>      import traceback, sys
>> >>      traceback.print_exception(*sys.exc_info())
>> >>
>> >> to see what happens.
>> >>
>> >> Original full test script I used is:
>> >>
>> >> def FunctionCalledByWSGIFile():
>> >>   try:
>> >>      RenderHTML()
>> >>   except Exception as e:
>> >>      print 'EXCEPTION', e
>> >>
>> >> def RenderHTML():
>> >>    # This way works fine
>> >>    #raise Exception("foo")
>> >>
>> >>    # This way causes 500 internal server error
>> >>    data = Select()
>> >>
>> >> def Select():
>> >>    raise Exception("foo")
>> >>
>> >> def application(environ, start_response):
>> >>     status = '200 OK'
>> >>     output = 'Hello World!'
>> >>
>> >>     response_headers = [('Content-type', 'text/plain'),
>> >>                         ('Content-Length', str(len(output)))]
>> >>     start_response(status, response_headers)
>> >>
>> >>     FunctionCalledByWSGIFile()
>> >>
>> >>     return [output]
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "modwsgi" group.
>> >> To post to this group, send email to [email protected].
>> >> To unsubscribe from this group, send email to
>> >> [email protected].
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/modwsgi?hl=en.
>> >>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "modwsgi" group.
>> > To post to this group, send email to [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "modwsgi" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/modwsgi?hl=en.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to