architekt1024 / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Apache gives "The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec()" #236

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have a Python web-server application, built with web.py, that uses librdf. 
All works well running directly under Python. However, attempting to run the 
application under OS/X 10.5.8 with Apache/2.2.17 with mod_wsgi/3.3 and 
Python/2.7.1 results in "The process has forked and you cannot use this 
CoreFoundation functionality safely. You MUST exec()." errors.

The following trivial mod_wsgi and web.py example works just fine until the 
"import RDF" line is enabled. Apache's log file then has three lines of the 
above error.

##############

import web
#import RDF ## Error if RDF imported

urls = ( '/.*', 'hello', )

class hello:
    def GET(self):
        return "Hello, world."

application = web.application(urls, globals()).wsgifunc()

##############

See notes at http://bugs.librdf.org/mantis/view.php?id=440 for attempts at 
identifying the cause.

Everything works using uWSGI/mod_uWSGI with Apache.

Original issue reported on code.google.com by d.bro...@auckland.ac.nz on 20 Apr 2011 at 12:28

GoogleCodeExporter commented 8 years ago
This is usually caused by mod_php being loaded into the same Apache and with 
the GD extension module being loaded. See:

http://groups.google.com/group/modwsgi/browse_thread/thread/fa1ce8c9a9e45db1?tvc
=2

If you have mod_php being loaded and don't need it, then don't load it into 
Apache. That or you will need to disable the GD extension if PHP extensions 
configuration.

If the GD extension isn't being loaded, then could be some other PHP extension 
causing the problem.

In short, one of the PHP extensions is linking with libraries which use MacOSX 
CoreFoundation library and that fact is then preventing forks from Apache child 
processes. It is not specifically a mod_wsgi problem.

Original comment by Graham.Dumpleton@gmail.com on 20 Apr 2011 at 6:42

GoogleCodeExporter commented 8 years ago
In this case mod_php is not loaded.

The trigger for these errors is a call to GNU libtool's "lt_dlopenext()". As 
you say, it is not specifically a mod_wsgi problem, and due to something using 
the Core Foundation library.

I've eventually gone with Cherokee and uWSGI...

Original comment by d.bro...@auckland.ac.nz on 20 Apr 2011 at 10:41

GoogleCodeExporter commented 8 years ago
Then it may be the actual RDF library you are using. Something somewhere is 
linking in CoreFoundation library when that is always a safe thing to do with 
anything but GUI based apps that don't do any forking.

Original comment by Graham.Dumpleton@gmail.com on 20 Apr 2011 at 10:46

GoogleCodeExporter commented 8 years ago
The puzzling thing is that the RDF library does not use nor link Core 
Foundation code.

Found it with "nm -go /usr/libexec/apache2/* | grep CF".

mod_bonjour.so is the culprit -- everything works with the "LoadModule 
bonjour_module" line commented out in httpd.conf.

And lo and behold, the sources in 
http://www.opensource.apple.com/tarballs/apache_mod_bonjour/apache_mod_bonjour-1
2.tar.gz use CoreFoundation functions...

Original comment by d.bro...@auckland.ac.nz on 21 Apr 2011 at 1:25

GoogleCodeExporter commented 8 years ago
That is odd, it is one of the default so I load up mod_bonjour and have no 
problem with it. What other non standard Apache modules are you using?

Original comment by Graham.Dumpleton@gmail.com on 21 Apr 2011 at 1:36

GoogleCodeExporter commented 8 years ago
None -- just the Apple defaults.

Original comment by d.bro...@auckland.ac.nz on 21 Apr 2011 at 1:51