django/db/__init__.py contains
dispatcher.connect(connection.close, signal=signals.request_finished)

and that closes the connection and causes the exception below,
the only thing i dont know is why the main thread doesnt closes it
right away but instead lets the thread run a while and just the next incoming
request closes it ...
but i will also find that out :)

On 12/1/06, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> I think I found out that the connection is the same for both threads,
> I think that causes the problem. I will try some more but I am not
> sure if I am on the right path at all :-)
>
> On 11/30/06, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> > From the frontend I trigger via AJAX a view that again starts a thread
> > that does some import work, that might take quite a while. This
> > enables the user to keep going and have the import run without
> > interrupting him/her. Every once in a while an asynch call checks on
> > the state of the import.
> >
> > And here lies the problem: while the thread is running and busy like a
> > bee adding data in the DB the asynch call to check on the state also
> > tries to run a query and that causes the following exception:
> >
> > Traceback (most recent call last):
> >   File 
> > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/threading.py",
> > line 442, in __bootstrap
> >     self.run()
> >   File "/Users/cain/programming/pms/trunk/pm/../pm/core/views/pic.py",
> > line 204, in run
> >     self._save(kwargs, sizes, thumbnail_url)
> >   File "/Users/cain/programming/pms/trunk/pm/../pm/core/views/pic.py",
> > line 211, in _save
> >     picimport.save()
> >   File "/Users/cain/programming/django/trunk/django/db/models/base.py",
> > line 184, in save
> >     db_values + [pk_val])
> >   File "/Users/cain/programming/django/trunk/django/db/backends/util.py",
> > line 12, in execute
> >     return self.cursor.execute(sql, params)
> >   File 
> > "/Users/cain/programming/django/trunk/django/db/backends/mysql/base.py",
> > line 42, in execute
> >     return self.cursor.execute(sql, params)
> >   File 
> > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/MySQLdb/cursors.py",
> > line 137, in execute
> >     self.errorhandler(self, exc, value)
> >   File 
> > "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/MySQLdb/connections.py",
> > line 33, in defaulterrorhandler
> >     raise errorclass, errorvalue
> > ReferenceError: weakly-referenced object no longer exists
> >
> > I had found the ticket http://code.djangoproject.com/ticket/1442 which
> > looks like it did solve my problem. So where does my problem come
> > from?
> > Is the problem caused by using multiple cursors (as I would guess from
> > the traceback)? Any ideas?
> >
> > Thanks in advance
> >
> > --
> > cu
> >
> >
> > Wolfram
> >
>
>
> --
> cu
>
> Wolfram
>


-- 
cu

Wolfram

--~--~---------~--~----~------------~-------~--~----~
 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to