Description
Describe the bug...
Steps to reproduce
Run MoinMoin normally on a Mac running Snow Leopard (10.6.0+) with the Apache worker mpm and mod_wsgi.
Try to open a MoinMoin page in your brower.
- Fail. The Apache thread crashes.
Example
Component selection
- general
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:
- moin 1.9 depends on werkzeug, so patching filesys.py doesn't seem helpful if werkzeug causes the same problem anyway
I know that patching filesys.py does not fix the problem, but I wanted to attach the file anyway. It looks like Python 3 (I know moin isn't going to be ported for a long time, but eventually it will) has removed the Carbon libraries. It is unclear whether they will be added back in. In the case that they are not added back in, I wanted to include my replacement for moin for when you finally do port moin to Python 3. I probably should have included the files in the MoinMoinBugs/MacHfsPlusCaseInsensitive page since that is where they would be used.
- platform specific C modules that need compilation on target platform are rather unwanted
- I can imagine that. Especially platform specific C modules. But as I stated above, I wanted to post them here so they are available when moin is eventually ported (though I imagine they will need to be fixed to work in the future, at least the groundwork and research can be used).
Plan
- Priority:
- Assigned to:
- Status: