ShowBase crashes after forking inside Django's test framewor

I’m having a really strange issue with ShowBase crashing with exit code 10, but only from within a child process after forking, and only from within Django’s test runner. I posted some example code here:
stackoverflow.com/questions/1045 … -framework

Anyone have any idea what might be causing this?

I did some more testing, and it works fine on Linux. I get the error on Mac. I also tried switching from os.fork() to multiprocessing.Process, and instead of crashing, the ShowBase() call hangs. Again, only on mac. Any idea what might cause this on mac?

I don’t know offhand, but OSX does have some funny rules about subprocesses and window permissions. Perhaps it’s forbidding the child process to open a window?

David

Yes, I think you might be right. I found this thread which seems to be the same error: groups.google.com/group/wxpython … 574c?pli=1

I wonder of there’s any way around this. I really need the window to be created in the child process.

To make the Panda3D browser plugin work on OSX, I had to render to an offscreen buffer in the child process, then copy the resulting pixels to RAM where the parent process could copy them out again and copy them to the screen. I used the SubprocessWindow and SubprocessWindowBuffer classes for this purpose.

I’m not necessarily recommending this approach, but it does prove that there’s at least one way around this problem, as heinous as it is. There might be a better solution available.

David

Actually, since it works when running tests.py directly (not through manage.py), I don’t think it’s specifically an OS/X problem. It must be something that manage.py is doing that breaks Panda3D (but only on mac!).

I managed to get a stack trace from the ShowBase() crash:
pastebin.com/m0gdVcFE

Does that help shed any light on what’s going on?

Hi,

I run into the exactly same problem. As this is an old topic: Has there been any simpler solution discovered than the proposed one?

Cheers
Timo

timo, I was never able to fix the problem, but I was never able to get anyone else to reproduce it either, so I have no idea what causes it. It still happens on one laptop I have.