Leopard compiler problem

5 views
Skip to first unread message

genro

unread,
Jan 30, 2009, 8:28:39 AM1/30/09
to modwsgi
Hi all

I am using a macBookPro, so an intel core2 Mac.
I'm trying to compile mod_wsgi 2.3 using python 2.5.4
from python site so it says:
"This package will install MacPython 2.5.4 for Mac OS X
10.3 or later for the following
architecture(s): i386, ppc."

If I use standard ./configure and then make , I get this error:

mbook:mod_wsgi-2.3 gpo$ make
/usr/sbin/apxs -c -I/Library/Frameworks/Python.framework/Versions/2.5/
include/python2.5 -DNDEBUG -Wc,'-arch ppc7400' -Wc,'-arch ppc64' -
Wc,'-arch i386' -Wc,'-arch x86_64' mod_wsgi.c -arch ppc7400 -arch
ppc64 -arch i386 -arch x86_64 -Wl,-F/Library/Frameworks -framework
Python -u _PyMac_Error -ldl
/usr/share/apr-1/build-1/libtool --silent --mode=compile gcc -
DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -I/usr/include/
apache2 -I/usr/include/apr-1 -I/usr/include/apr-1 -arch ppc7400 -
arch ppc64 -arch i386 -arch x86_64 -I/Library/Frameworks/
Python.framework/Versions/2.5/include/python2.5 -DNDEBUG -c -o
mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
In file included from /Library/Frameworks/Python.framework/Versions/
2.5/include/python2.5/Python.h:57,
from mod_wsgi.c:113:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/
pyport.h:761:2: error: #error "LONG_BIT definition appears wrong for
platform (bad gcc/glibc config?)."
In file included from /Library/Frameworks/Python.framework/Versions/
2.5/include/python2.5/Python.h:57,
from mod_wsgi.c:113:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/
pyport.h:761:2: error: #error "LONG_BIT definition appears wrong for
platform (bad gcc/glibc config?)."
lipo: can't figure out the architecture type of: /var/folders/mv/
mvg1SVZ6EKmmYFUDuXpIaE+++TU/-Tmp-//ccHleuVv.out
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1

So I changed Makefile flags from:

CPPFLAGS = -I/Library/Frameworks/Python.framework/Versions/2.5/include/
python2.5 -DNDEBUG
CFLAGS = -Wc,'-arch ppc7400' -Wc,'-arch ppc64' -Wc,'-arch i386' -Wc,'-
arch x86_64'
LDFLAGS = -arch ppc7400 -arch ppc64 -arch i386 -arch x86_64 -Wl,-F/
Library/Frameworks -framework Python -u _PyMac_Error
LDLIBS = -ldl


to:

CPPFLAGS = -I/Library/Frameworks/Python.framework/Versions/2.5/include/
python2.5 -DNDEBUG
CFLAGS = -Wc,'-arch i386' -Wc,'-arch x86_64'
LDFLAGS = -arch i386 -arch x86_64 -Wl,-F/Library/Frameworks -
framework Python -u _PyMac_Error
LDLIBS = -ldl


and I get :

mbook:mod_wsgi-2.3 gpo$ make
/usr/sbin/apxs -c -I/Library/Frameworks/Python.framework/Versions/2.5/
include/python2.5 -DNDEBUG -Wc,'-arch i386' -Wc,'-arch x86_64'
mod_wsgi.c -arch i386 -arch x86_64 -Wl,-F/Library/Frameworks -
framework Python -u _PyMac_Error -ldl
/usr/share/apr-1/build-1/libtool --silent --mode=compile gcc -
DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -I/usr/include/
apache2 -I/usr/include/apr-1 -I/usr/include/apr-1 -arch i386 -arch
x86_64 -I/Library/Frameworks/Python.framework/Versions/2.5/include/
python2.5 -DNDEBUG -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
In file included from /Library/Frameworks/Python.framework/Versions/
2.5/include/python2.5/Python.h:57,
from mod_wsgi.c:113:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/
pyport.h:761:2: error: #error "LONG_BIT definition appears wrong for
platform (bad gcc/glibc config?)."
lipo: can't figure out the architecture type of: /var/folders/mv/
mvg1SVZ6EKmmYFUDuXpIaE+++TU/-Tmp-//ccnk1fcw.out
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1


Next try :

CFLAGS = -Wc,'-arch i386'
LDFLAGS = -arch i386 -Wl,-F/Library/Frameworks -framework Python -u
_PyMac_Error
LDLIBS = -ldl


and now it compiled:
mbook:mod_wsgi-2.3 gpo$ make
/usr/sbin/apxs -c -I/Library/Frameworks/Python.framework/Versions/2.5/
include/python2.5 -DNDEBUG -Wc,'-arch i386' mod_wsgi.c -arch i386 -
Wl,-F/Library/Frameworks -framework Python -u _PyMac_Error -ldl
/usr/share/apr-1/build-1/libtool --silent --mode=compile gcc -
DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp -I/usr/include/
apache2 -I/usr/include/apr-1 -I/usr/include/apr-1 -arch i386 -I/
Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -
DNDEBUG -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
/usr/share/apr-1/build-1/libtool --silent --mode=link gcc -o
mod_wsgi.la -rpath /usr/libexec/apache2 -module -avoid-version
mod_wsgi.lo -arch i386 -Wl,-F/Library/Frameworks -framework Python -u
_PyMac_Error -ldl

next after sudo make install
I try to start apache2 but in error.log i have

Jan 30 11:49:05 mbook org.apache.httpd[12092]: httpd: Syntax error on
line 119 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/
apache2/mod_wsgi.so into server: dlopen(/usr/libexec/apache2/
mod_wsgi.so, 10): no suitable image found. Did find:\n\t/usr/libexec/
apache2/mod_wsgi.so: mach-o, but wrong architecture
Jan 30 11:49:05 mbook com.apple.launchd[1] (org.apache.httpd[12092]):
Exited with exit code: 1
Jan 30 11:49:05 mbook com.apple.launchd[1] (org.apache.httpd):
Throttling respawn: Will start in 10 seconds

So it seems that the compilation worked but the mod_wsgi.so don't work
on my mac.

Any hint for me ?


Thank you

Giovanni Porcari

Graham Dumpleton

unread,
Jan 30, 2009, 8:41:02 AM1/30/09
to mod...@googlegroups.com
Don't use the official MacPython installer from Python software
foundation, it has not been compiled as fully fat compatible and so
doesn't include 64 bit architectures. You would need to install it
from source code yourself with the appropriate options. This has been
covered before in:

http://groups.google.com/group/modwsgi/browse_frm/thread/6e77f28b3fa2b8d7

The configure command for Python you would want to use is:

./configure --prefix=/usr/local/python-2.5.4
--enable-framework=/usr/local/python-2.5.4/frameworks
--enable-universalsdk=/ MACOSX_DEPLOYMENT_TARGET=10.5
--with-universal-archs=all

Is there any specific reason why you can't use Python 2.5.2 that ships
with the operating system? At least to get going initially.

Also read:

http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX

It talks about other problems with MacOS X. Haven't covered the above
issue in there yet.

Based on stuff in there, another thing you can do is edit Makefile and
remove arch options for 64 bit and then build it. You will then at the
same time need to either strip Apache binary of 64 bit as described in
wiki, or edit plist file to force it to run as 32 bit instead of 64
bit. The plist modification is in comments, and also talked about in:

http://gidden.net/tom/2008/06/30/mysql-and-pdo-on-os-x-leopard-intel/

where they have better suggestion of copy plist file into /Library
location somewhere and editing that instead of modifying original.

Graham

2009/1/31 genro <giovanni...@gmail.com>:

genro

unread,
Feb 2, 2009, 3:18:07 PM2/2/09
to modwsgi
Hi Graham

instead of compiling a 64 bit version of python i preferred to
compile ad install another apache 2.2 server in usr/local/apache2
folder and then I installed mod_wsgi using:

./configure --with-apxs=/usr/local/apache2/bin/apxs

it worked and so i have my mod_wsgi almost working.

I still have a problem using file_wrapper.

This is my test:

in htt.conf i added:

<Directory /Users/gpo/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /test /Users/gpo/filetest.wsgi

and this is the filetest.wsgi:

def application(environ, start_response):
file = open('/Users/gpo/test.txt', 'rb')
file_wrapper = environ.get('wsgi.file_wrapper', None)
start_response('200 OK',[])
return file_wrapper(file, 4096*16)

Then i go to url http://localhost:8001/test/

and i should see my file.
It works if the file test.txt length is less 256
chars BUT if the length is greater than 256
i get a white page.

I have a Core 2 duo processor. The same test on
a core 2 with standard 32 bit apache and standard python
works fine.

Any suggestion to solve this problem ?

TIA

G.




Il giorno 30/gen/09, alle ore 14:41, Graham Dumpleton ha scritto:

Graham Dumpleton

unread,
Feb 3, 2009, 8:37:31 PM2/3/09
to mod...@googlegroups.com
2009/2/3 genro <giovanni...@gmail.com>:

Can you wrap your WSGI application object if first code recipe in:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response

And capture actual response headers returned from your WSGI application.

At the same time, use a browser like Firefox and live headers plugin
to capture response headers as seen by the browser.

Post both so can see what content length and other headers are set to
at each point.

Also try using just:

return file_wrapper(file)

That is, allow mod_wsgi to select block size when sending response content.

BTW, can you confirm whether using embedded mode or daemon mode. That
is, for latter would be using appropriate
WSGIDaemonProcess/WSGIProcessGroup directives to delegate application
to run in separate daemon process.

Thanks.

Graham

genro

unread,
Feb 4, 2009, 6:10:03 AM2/4/09
to modwsgi
Hi Graham
This is the new filetest.wsgi modified using your instructions:
------------------------------------
import pprint

class LoggingMiddleware:

def __init__(self, application):
self.__application = application

def __call__(self, environ, start_response):
errors = environ['wsgi.errors']
pprint.pprint(('REQUEST', environ), stream=errors)

def _start_response(status, headers):
pprint.pprint(('RESPONSE', status, headers),
stream=errors)
return start_response(status, headers)

return self.__application(environ, _start_response)


def application(environ, start_response):

size=environ.get('QUERY_STRING')
if size=='': size='255'
size=int(size)
file=open('tmp/wsgitest','wb')
for i in range(size):
file.write('*')
file.close()
file=open('tmp/wsgitest','rb')
file_wrapper = environ.get('wsgi.file_wrapper', None)
start_response('200 OK',[])
return file_wrapper(file, 4096*16)

application = LoggingMiddleware(application)
--------------------------------------------------------

So now we can add an argumet to the url to ask a specified file size.
For example:

http://localhost:8001/test/?1024 will result in a 1024 file size.

Using this url we tested many sizes and it seems that it's ok for
sizes
in range 1-255 then it stop to work for sizes in ranges
256-7766 and then it works again for sizes greater than 7766.

So i think that it could be an hint for you.

Now i paste here the log for a good call and for a wrong one.

The good one:
Wed Feb 04 11:58:54 2009] [error] [client ::1] ('REQUEST',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] {'DOCUMENT_ROOT': '/
usr/local/apache2/htdocs',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'GATEWAY_INTERFACE':
'CGI/1.1',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'HTTP_ACCEPT': 'text/
html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'HTTP_ACCEPT_ENCODING': 'gzip,deflate',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'HTTP_ACCEPT_LANGUAGE': 'it-it,it;q=0.8,en-us;q=0.5,en;q=0.3',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'HTTP_CONNECTION':
'keep-alive',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'HTTP_HOST':
'localhost:8001',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'HTTP_KEEP_ALIVE':
'300',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'HTTP_USER_AGENT':
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:1.9.0.5) Gecko/
2008120121 Firefox/3.0.5',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'PATH': '/bin:/sbin:/
usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'PATH_INFO': '/',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'PATH_TRANSLATED': '/
usr/local/apache2/htdocs/index.html',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'QUERY_STRING':
'255',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'REMOTE_ADDR': '::
1',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'REMOTE_PORT':
'55956',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'REQUEST_METHOD':
'GET',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'REQUEST_URI': '/
test/?255',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SCRIPT_FILENAME': '/
Users/gpo/filetest.wsgi',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SCRIPT_NAME': '/
test',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SERVER_ADDR': '::
1',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SERVER_ADMIN':
'giovanni...@softwell.it',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SERVER_NAME':
'localhost',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SERVER_PORT':
'8001',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SERVER_PROTOCOL':
'HTTP/1.1',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SERVER_SIGNATURE':
'',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'SERVER_SOFTWARE':
'Apache/2.2.11 (Unix) mod_python/3.3.1 Python/2.5.4 mod_wsgi/2.3',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'mod_wsgi.application_group': 'localhost:8001|/test',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'mod_wsgi.callable_object': 'application',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'mod_wsgi.listener_host': '',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'mod_wsgi.listener_port': '8001',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'mod_wsgi.process_group': '',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'mod_wsgi.reload_mechanism': '0',
[Wed Feb 04 11:58:54 2009] [error] [client ::1]
'mod_wsgi.script_reloading': '1',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.errors':
<mod_wsgi.Log object at 0x129d188>,
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.file_wrapper':
<built-in method file_wrapper of mod_wsgi.Adapter object at
0x134b458>,
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.input':
<mod_wsgi.Input object at 0x1369a70>,
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.multiprocess':
True,
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.multithread':
False,
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.run_once':
False,
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.url_scheme':
'http',
[Wed Feb 04 11:58:54 2009] [error] [client ::1] 'wsgi.version': (1,
0)})
[Wed Feb 04 11:58:54 2009] [error] [client ::1] ('RESPONSE', '200 OK',
[])


And now the wrong one:
[Wed Feb 04 12:00:02 2009] [error] [client ::1] ('REQUEST',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] {'DOCUMENT_ROOT': '/
usr/local/apache2/htdocs',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'GATEWAY_INTERFACE':
'CGI/1.1',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'HTTP_ACCEPT': 'text/
html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'HTTP_ACCEPT_ENCODING': 'gzip,deflate',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'HTTP_ACCEPT_LANGUAGE': 'it-it,it;q=0.8,en-us;q=0.5,en;q=0.3',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'HTTP_CONNECTION':
'keep-alive',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'HTTP_HOST':
'localhost:8001',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'HTTP_KEEP_ALIVE':
'300',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'HTTP_USER_AGENT':
'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:1.9.0.5) Gecko/
2008120121 Firefox/3.0.5',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'PATH': '/bin:/sbin:/
usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'PATH_INFO': '/',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'PATH_TRANSLATED': '/
usr/local/apache2/htdocs/index.html',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'QUERY_STRING':
'257',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'REMOTE_ADDR': '::
1',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'REMOTE_PORT':
'55963',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'REQUEST_METHOD':
'GET',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'REQUEST_URI': '/
test/?257',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SCRIPT_FILENAME': '/
Users/gpo/filetest.wsgi',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SCRIPT_NAME': '/
test',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SERVER_ADDR': '::
1',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SERVER_ADMIN':
'giovanni...@softwell.it',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SERVER_NAME':
'localhost',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SERVER_PORT':
'8001',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SERVER_PROTOCOL':
'HTTP/1.1',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SERVER_SIGNATURE':
'',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'SERVER_SOFTWARE':
'Apache/2.2.11 (Unix) mod_python/3.3.1 Python/2.5.4 mod_wsgi/2.3',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'mod_wsgi.application_group': 'localhost:8001|/test',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'mod_wsgi.callable_object': 'application',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'mod_wsgi.listener_host': '',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'mod_wsgi.listener_port': '8001',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'mod_wsgi.process_group': '',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'mod_wsgi.reload_mechanism': '0',
[Wed Feb 04 12:00:02 2009] [error] [client ::1]
'mod_wsgi.script_reloading': '1',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.errors':
<mod_wsgi.Log object at 0x129d188>,
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.file_wrapper':
<built-in method file_wrapper of mod_wsgi.Adapter object at
0x134b458>,
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.input':
<mod_wsgi.Input object at 0x1369a48>,
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.multiprocess':
True,
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.multithread':
False,
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.run_once':
False,
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.url_scheme':
'http',
[Wed Feb 04 12:00:02 2009] [error] [client ::1] 'wsgi.version': (1,
0)})
[Wed Feb 04 12:00:02 2009] [error] [client ::1] ('RESPONSE', '200 OK',
[])


And now http headers:

the good one :
http://localhost:8001/test/?255

GET /test/?255 HTTP/1.1
Host: localhost:8001
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:
1.9.0.5) Gecko/2008120121 Firefox/3.0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cache-Control: max-age=0

HTTP/1.x 200 OK
Date: Wed, 04 Feb 2009 11:03:42 GMT
Server: Apache/2.2.11 (Unix) mod_python/3.3.1 Python/2.5.4 mod_wsgi/
2.3
Content-Length: 255
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain

And the wrong one:
http://localhost:8001/test/?257

GET /test/?257 HTTP/1.1
Host: localhost:8001
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:
1.9.0.5) Gecko/2008120121 Firefox/3.0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 200 OK


I hope that these info can help to understand the problem.
We are using the embedded mode.

Thank you

G.




On Feb 4, 2:37 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> 2009/2/3 genro <giovanni.porc...@gmail.com>:

> Can you wrap your WSGI application object if first code recipe in:
>
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Re...

Graham Dumpleton

unread,
Feb 4, 2009, 8:01:57 AM2/4/09
to mod...@googlegroups.com
2009/2/4 genro <giovanni...@gmail.com>:

> And the wrong one:
> http://localhost:8001/test/?257
>
> GET /test/?257 HTTP/1.1
> Host: localhost:8001
> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:
> 1.9.0.5) Gecko/2008120121 Firefox/3.0.5
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
> *;q=0.8
> Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
>
> HTTP/1.x 200 OK
>
>
> I hope that these info can help to understand the problem.
> We are using the embedded mode.

The lack of any response headers after the OK status line seems to
suggest that Apache worker process crashed. If this is the case, the
Apache error logs should record a message about 'Segmentation fault'.
Can you look for that.

If a segmentation fault is occurring, could you run Apache is single
process debug mode as explained in:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

and use gdb to capture a stack trace. In short:

sudo apachectl stop

sudo gdb /usr/sbin/httpd

run -X

Perform request, and then in gdb:

thread apply all bt

Post the stack traces so can see where in code crash occurred.

Thanks.

Graham

genro

unread,
Feb 4, 2009, 6:48:04 PM2/4/09
to modwsgi
Hi Graham

i have no errors in error_log so I don't know if the procedure you
suggest can apply.
Moreover after the page arrives empty no http process died.

I have an SSD disk on my Mac. Can we have a problem on it ?

Thank you

G.

On Feb 4, 2:01 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> 2009/2/4 genro <giovanni.porc...@gmail.com>:
>
>
>
> > And the wrong one:
> >http://localhost:8001/test/?257
>
> > GET /test/?257 HTTP/1.1
> > Host: localhost:8001
> > User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; it; rv:
> > 1.9.0.5) Gecko/2008120121 Firefox/3.0.5
> > Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
> > *;q=0.8
> > Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
> > Accept-Encoding: gzip,deflate
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive: 300
> > Connection: keep-alive
>
> > HTTP/1.x 200 OK
>
> > I hope that these info can help to understand the problem.
> > We are using the embedded mode.
>
> The lack of any response headers after the OK status line seems to
> suggest that Apache worker process crashed. If this is the case, the
> Apache error logs should record a message about 'Segmentation fault'.
> Can you look for that.
>
> If a segmentation fault is occurring, could you run Apache is single
> process debug mode as explained in:
>
>  http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_C...

Graham Dumpleton

unread,
Feb 5, 2009, 6:47:14 AM2/5/09
to mod...@googlegroups.com
2009/2/5 genro <giovanni...@gmail.com>:
>
> Hi Graham
>
> i have no errors in error_log so I don't know if the procedure you
> suggest can apply.
> Moreover after the page arrives empty no http process died.
>
> I have an SSD disk on my Mac. Can we have a problem on it ?

I doubt it is the disk.

A crash of the Apache child worker process handling the request is the
only explanation I have. Note that any messages will not be in virtual
host specific log file if you have one, but main Apache error log.

To make things a bit clearer, override default value of LogLevel
directive in Apache configuration files so that it is:

LogLevel debug

Do this in virtual host context if also set there.

The mod_wsgi module logs at info level various messages when doing
initialisation when process starting. That this occurs would be more
obvious than a segmentation fault message.

Can you still do the gdb check anyway. If there is a crash, it will
most definitely detect it.

Thanks.

Graham

genro

unread,
Feb 6, 2009, 3:53:26 AM2/6/09
to modwsgi
Hi Graham

I tried with gdb but it seems that there is no crash.
Setting LogLevel debug now I have this info:

Fri Feb 06 09:28:09 2009] [info] [client ::1] mod_wsgi (pid=573,
process='', application='localhost:8001|/test'): Loading WSGI script '/
Users/gpo/filetest.wsgi'.
[Fri Feb 06 09:28:09 2009] [info] [client ::1] (9)Bad file descriptor:
core_output_filter: writing data to the network

So it seems that "(9)Bad file descriptor: core_output_filter: writing
data to the network" is
our only hint.
Remember of course that it happens only for files in size 257 : 7766
and that
for sizes greater than 7766 there is no problem.

BTW i have the same behaviour on another MacBook Pro with same
processor
and same disk.

G
..

-----------
On Feb 5, 12:47 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> 2009/2/5 genro <giovanni.porc...@gmail.com>:

Graham Dumpleton

unread,
Feb 6, 2009, 8:44:45 AM2/6/09
to mod...@googlegroups.com
Modify mod_wsgi.c and change all instances of 'temp_pool' to 'pool'.

This is magic fairy dust which has proved to fix a number of odd problems.

http://code.google.com/p/modwsgi/issues/detail?id=78

Graham

2009/2/6 genro <giovanni...@gmail.com>:

genro

unread,
Feb 6, 2009, 9:17:37 AM2/6/09
to modwsgi
i changed all 'temp_pool' to 'pool'

then :
make clean
make
sudo make install

Then I restarted apache

Still the same problem...


G


On Feb 6, 2:44 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> Modify mod_wsgi.c and change all instances of 'temp_pool' to 'pool'.
>
> This is magic fairy dust which has proved to fix a number of odd problems.
>
>  http://code.google.com/p/modwsgi/issues/detail?id=78
>
> Graham
>
> 2009/2/6 genro <giovanni.porc...@gmail.com>:

Graham Dumpleton

unread,
Feb 8, 2009, 7:07:06 PM2/8/09
to modwsgi
See:

http://groups.google.com/group/modwsgi/browse_frm/thread/e7111816e70d236a

Want to try and merge these two discussions, as possibly the same
issue.

Graham
Reply all
Reply to author
Forward
0 new messages