I think I had this problem, at least it feels very familiar, and I do  
some process forking.

I think that the problem is using the same connection more than once.  
I think that the cursor is being closed and then being used again.

I took the habit of creating a new cursor and specifically closing  
it, and then creating a new one for each query, assuming you are  
doing some custom querying.

I wish I could be of more help...

Corey

On Aug 17, 2006, at 7:23 AM, tomass wrote:

>
> Hi Folks,
>
> I know this topic has been brought up a few times, but I have a
> slightly different issue here (I think).
>
> I have a backend process that runs a number of commands. It  
> connects to
> the database (via the ORM) to check it's queue and then executes jobs.
> All fine and dandy.
>
> My problem is that I have now got to the stage where I need to run  
> more
> than one of these jobs at a time as there are so many scheduled and if
> they run one after another it takes too long.
>
> I approached this by using this recipe to spawn a new process and then
> run the backend processing function:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012
>
> Problem is, I'm getting database connection errors and I can't quite
> see why. I pass an object to my backend processing function and have
> verified that I can access the properties of that object in the
> function. However, I get the following errors:
>
> Traceback (most recent call last):
>   File "/automator/utils/backend.py", line 503, in ?
>     run_backend(LOGLEVEL)
>   File "/automator/utils/backend.py", line 471, in run_backend
>     asyncRemoteCommand(c, l)
>   File "/automator/utils/backend.py", line 429, in asyncRemoteCommand
>     RemoteCommand(c, l)
>   File "/automator/utils/backend.py", line 193, in RemoteCommand
>     c.save()
>   File "/home/mthaddon/django/magic-removal/django/db/models/base.py",
> line 150, in save
>     cursor = connection.cursor()
>   File
> "/home/mthaddon/django/magic-removal/django/db/backends/postgresql/ 
> base.py",
> line 42, in cursor
>     cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
> psycopg.OperationalError: server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
>
> When I look at the postgresql logs I see:
>
> LOG:  could not receive data from client: Connection reset by peer
> LOG:  unexpected EOF on client connection
>
> Seems like Python is blaming PostgreSQL and vice versa!
>
> Any help appreciated.
>
> Thanks, Tom
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to