> Hi All,
>
> Getting odd segfaults in mod_wsgi/3.2, python 2.6.4, apache 2.2.16 on
> Fedora 13
>
> Down to the point ... CodeA segfaults and CodeB doesn't whereas they
> should both be semantically the same. The segfault
> is the standard message "child pid 1234 exit signal Segmentation fault
> (11)"
>
> Everything ran fine until this one change
What one change?
> (tracked down through
> Eclipse's local history). There *was* an actual computed value
> where `True` resides ... but I took it out to make the issue as simple
> as possible.
>
> CodeA:
>
> ...
> if self.some_var:
> # do something
> else:
> if(True):
> raise SomeException("Some Message")
> ...
>
> CodeB:
>
> ...
> if self.some_var:
> # do something
> else:
> raise SomeException("Some Message")
> ...
>
> Thanks in advance!
> Aiden
> http://stackoverflow.com/users/104040/aiden-bell
>
> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
What one change?
On Sep 27, 2010, at 4:48 PM, aiden bell wrote:
> Hi All,
>
> Getting odd segfaults in mod_wsgi/3.2, python 2.6.4, apache 2.2.16 on
> Fedora 13
>
> Down to the point ... CodeA segfaults and CodeB doesn't whereas they
> should both be semantically the same. The segfault
> is the standard message "child pid 1234 exit signal Segmentation fault
> (11)"
>
> Everything ran fine until this one change
http://code.google.com/p/modwsgi/wiki/FrequentlyAskedQuestions
Section about crashes.
Also see:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues
http://code.google.com/p/modwsgi/wiki/DebuggingTechniques
In short, try using main interpreter. Ensure mod_python not being
loaded. Disable php if you can.
Otherwise use gdb as documented to get stack trace and investigate.
Graham
Are you really using all that stuff?
This sure would be easier to narrow down if you removed anything you weren't actually using...
S
If the uuid module on Python is an external C module, ie., has a .so,
or even if it uses some, then what are the library dependencies the
.so files have. ie., result from running:
ldd *.so
on the .so for or used by uuid.
Do the library versions, paths differe to what Apache httpd executable
uses, or which are used by and PHP modules if being used, or other
third party Pache modules.
Also ensure you post your mod_wsgi configuration snippet you are
using. Ie., WSGIDaemonProcess, WSGIProcessGroup, WSGIApplictionGroup,
WSGIScriptAlias etc.
I want to confirm you are actually running in main interpreter.
Can you also try it in embedded mode if you are using daemon mode and
verify if it occurs there as well.
You should really be able to capture it in gdb if reproducible.
Graham
import ctypes
in a wsgi script using just what comes with Fedora 13.
From what I can tell right off the bat, it looks like this may be an SELinux
permissions problem. I'm seeing httpd creating temporary files under
/tmp, /var/tmp, and /dev/shm and and then trying to execute them --
which SELinux is preventing. I don't know yet if this is due to ctypes.
By chance are you running with SLinux in enforcing mode? Use:
# sestatus
FYI about versions...
The mod_wsgi packaged with Fedora 13 is 3.1. Since you're using 3.2, I assume
you've compiled from source By the way, Fedora 14 which is due in a month
is set to ship with mod_wsgi 3.2 as well as Python 2.7.
The Python uuid module potentially has a lot of crazy external dependencies,
most of which are determined at run-time (import time). Under Fedora, it
will use the ctypes module to load in the shared library libuuid.so.1
(which is either under /lib64 or /lib depending on your cpu). So, importing
uuid will import and invoke ctypes.
--
Deron Meranda
http://deron.meranda.us/
For now, the best way to make this work is to change one of the
SELinux booleans (do not disable SELinux entirely). As root, do
# setsebool -P httpd_tmp_exec 1
Another more secure option, if all you need is to generate a uuid and you
don't need to use ctypes for anything else, is to generate an
RFC 4122-compliant random uuid as follows. This allows you to omit
importing the python uuid module, which in turn imports ctypes.
(This works because SELinux allows reading from /dev/urandom under
the default policy rules)
def make_random_uuid():
bytes = open('/dev/urandom','rb').read(16)
num = long(('%02x'*16) % tuple(map(ord, bytes)), 16)
# Set the variant to RFC 4122.
num &= ~(0xc000 << 48L)
num |= 0x8000 << 48L
# Set the version number (4 = random uuid).
num &= ~(0xf000 << 64L)
num |= 4 << 76L
# Convert to hex-string format
hex = '%032x' % num
return '%s-%s-%s-%s-%s' % (
hex[:8], hex[8:12], hex[12:16], hex[16:20], hex[20:])