mercredi 13 août 2014

Django et SQL Server 2005 - État de Zombie ? -Débordement de pile


I'm using Django 1.2 and django-mssql.


While performing the following


for unicorn in Unicorn.objects.all():
print unicorn.color

I'm getting the following error at around the 100th iteration:



com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft SQL Server Nativ e Client 10.0', u'The object is in a zombie state. An object may enter a zombie state when either ITransaction::Commit or ITransaction::Abort is called, or when a storage object was created and not yet released.', None, 0, -2147418113), Non e)





Any idea? This is really bugging me... starting to hate the whole Windows Server world... :(




I had a similar problem and I resolved it by forcing the full QuerySet to be retrieved before using it in the for loop. So, try this:


for unicorn in list(Unicorn.objects.all()):
print unicorn.color



Another way is to set 'can_use_chunked_read = True' in base.DatabaseFeature:


sqlserver_ado/base.py: 16


class DatabaseFeatures(BaseDatabaseFeatures):
uses_custom_query_class = True
can_use_chunked_reads = False

I just set it and the error has gone away. Let me know if it solves your problem too.



I'm using Django 1.2 and django-mssql.


While performing the following


for unicorn in Unicorn.objects.all():
print unicorn.color

I'm getting the following error at around the 100th iteration:



com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft SQL Server Nativ e Client 10.0', u'The object is in a zombie state. An object may enter a zombie state when either ITransaction::Commit or ITransaction::Abort is called, or when a storage object was created and not yet released.', None, 0, -2147418113), Non e)





Any idea? This is really bugging me... starting to hate the whole Windows Server world... :(



I had a similar problem and I resolved it by forcing the full QuerySet to be retrieved before using it in the for loop. So, try this:


for unicorn in list(Unicorn.objects.all()):
print unicorn.color


Another way is to set 'can_use_chunked_read = True' in base.DatabaseFeature:


sqlserver_ado/base.py: 16


class DatabaseFeatures(BaseDatabaseFeatures):
uses_custom_query_class = True
can_use_chunked_reads = False

I just set it and the error has gone away. Let me know if it solves your problem too.


0 commentaires:

Enregistrer un commentaire