Malcolm Tredinnick pisze:
> On Tue, 2009-08-11 at 11:06 +0200, Spajderix wrote:
>   
>> Hi!
>>
>> I've written a standalone script, which looks throught a table in db for 
>> tasks to perform. It then starts subprocesses for each task it founds 
>> using multiprocessing.Process class from python. Everything's fine when 
>> there is one task, but when i try to start more subprocesses at once i get:
>>
>> OperationalError: (2013, 'Lost connection to MySQL server during query')
>>     raise errorclass, errorvalue
>> OperationalError: (2006, 'MySQL server has gone away')
>>
>> I guess that this happens because all subprocesses share one connection, 
>> and when one of them closes this connection, rest of subprocesses raises 
>> an error. 
>>     
>
> That certainly sounds believable. We call close() explicitly, too, so
> that is why ongoing operations are interrupted in the middle.
>
>   
>> Do you know a way to go round this problem?
>>     
>
> If you close the database connection, Django will open a new one the
> next time it needs it. So I suspect you can work around this by
> explicitly closing the connection immediately after you start a new
> process (in the new process). Then the process will get its own
> connection when you try to do something.
>
> Regards,
> Malcolm
>
>   
Thank you! That solved the problem:)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to