Description

Describe the bug...

Steps to reproduce

  1. Run MoinMoin normally on a Mac running Snow Leopard (10.6.0+) with the Apache worker mpm and mod_wsgi.

  2. Try to open a MoinMoin page in your brower.

  3. Fail. The Apache thread crashes.

Example

Component selection

Details

Here is the link to the bug report I opened on MacPorts (the link is to the workaround comment): http://trac.macports.org/ticket/22518#comment:18

Quoting from that bug report: So, I have done some more research into this. Here is what I have found. The problem should only exist on Snow Leopard, as it seems CFRuntime.c changed between 10.5 and 10.6. Looking at void __CFInitialize(void) in CFRuntime.c shows that "CoreFoundation must be initialized on the main thread." To work around this problem while continuing to use the worker mpm with mod_wsgi, you can include the following in your wsgi config file:

WSGIImportScript <your-wsgi-script> process-group=<your-process-group> application-group=%{GLOBAL}

I think this will only work for one script though, but I'm not sure.

MoinMoin seems to use Carbon in a couple of places on the Mac. One is: !MoinMoin/util/filesys.py. In this file the realPathCase method imports Carbon.File on darwin. It is possible to rewrite this method to not use Carbon.File. See: filecase.c, setup.py, and filesys.py.patch. The patch assumes that the compiled library is in the base directory.

!MoinMoin/support/werkzeug also uses Carbon and hence CoreFoundation all over the place.

MoinMoin Version

All?

OS and Version

Mac OS 10.6.0+

Python Version

2.6

Server Setup

Apache with the worker mpm and mod_wsgi OR Apache with mod_wsgi in daemon mode

Server Details

A threaded apache server

Language you are using the wiki in (set in the browser/UserPreferences)

English

Workaround

Add the following to your moin.wsgi configuration:

WSGIImportScript <your-moin-script> process-group=<your-moin-process-group> application-group=%{GLOBAL}

Discussion

Isn't this rather a apache / mod_wsgi (on OS X platform) bug than a moin bug?

I'm not even sure it is a bug, but it does require a workaround. I don't think anything needs to be changed in the moin code, but there should be a not in the configuration instructions for Apache + worker mpm + mod_wsgi that explains the workaround and why it is needed. The most logical place for the problem to be fixed is in Python, but because the Carbon libraries have been removed in Python 3, I doubt they are going to fix it. That or Apple would need to fix their libraries. It certainly isn't a moin bug, but I would like to be able to use moin on my Mac, and I think moin should have instructions for others who want to do the same thing.

The files I attached are separate. See below.

About the patches:

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/MacCoreFoundationMustBeLoadedOnMainThread (last edited 2010-01-08 19:29:48 by AndrewRyan)