views:

175

answers:

1

Hi,

I am using Django ORM in my python script in a decoupled fashion i.e. it's not running in context of a normal Django Project.

I am also using the multi processing module. And different process in turn are making queries.

The process ran successfully for an hr and exited with this message

"IOError: [Errno 32] Broken pipe"

Upon futhur diagnosis and debugging this error pops up when I call save() on the model instance.

I am wondering

Is Django ORM Process save ?

Why would this error arise else ?

Cheers Ankur

Found the Answer I was calling a return after starting the process. This error sneaked in as i did a small cut and paste of a function.

A: 

It's a little hard to say without more information, but the problem is probably caused by having an open database connection as you spawn new processes, and then trying to use that database connection in the separate processes. Don't re-use database connections from the parent process in multiprocessing workers you spawn; always recreate database connections.

Thomas Wouters