psycopg2 pickling error

47 views
Skip to first unread message

tom

unread,
Sep 26, 2011, 6:21:51 PM9/26/11
to Django users
Hello,

since a while I see very often those errors:
Traceback (most recent call last):

File "/opt/agileamp/lib/python/django/core/handlers/base.py", line
89, in get_response
response = middleware_method(request)

File "/usr/local/lib/python2.6/dist-packages/newrelic-0.5.15.41-
py2.6.egg/newrelic/api/function_trace.py", line 137, in __call__
return self._nr_next_object(*args, **kwargs)

File "/usr/local/lib/python2.6/dist-packages/newrelic-0.5.15.41-
py2.6.egg/newrelic/api/name_transaction.py", line 58, in __call__
return self._nr_next_object(*args, **kwargs)

File "/opt/agileamp/scrumtool/utils/middleware/customer.py", line 19,
in process_request
customer = Company.objects.get(account__subdomain =
request.subdomain)

File "/opt/agileamp/lib/python/django/db/models/manager.py", line
132, in get
return self.get_query_set().get(*args, **kwargs)

File "/opt/agileamp/scrumtool/agile_cache/managers.py", line 117, in
get
return super(CachingQuerySet, self).get(*args, **kwargs)

File "/opt/agileamp/lib/python/django/db/models/query.py", line 344,
in get
num = len(clone)

File "/opt/agileamp/lib/python/django/db/models/query.py", line 82,
in __len__
self._result_cache = list(self.iterator())

File "/opt/agileamp/scrumtool/agile_cache/managers.py", line 87, in
iterator
cache.add(obj.cache_key, obj, 60 * 60 * 24)

File "/opt/agileamp/lib/python/django/core/cache/backends/
memcached.py", line 54, in add
return self._cache.add(key, value,
self._get_memcache_timeout(timeout))

File "/usr/local/lib/python2.6/dist-packages/newrelic-0.5.15.41-
py2.6.egg/newrelic/api/memcache_trace.py", line 113, in __call__
return self._nr_next_object(*args, **kwargs)

File "/usr/lib/pymodules/python2.6/memcache.py", line 456, in add
return self._set("add", key, val, time, min_compress_len)

File "/usr/lib/pymodules/python2.6/memcache.py", line 725, in _set
store_info = self._val_to_store_info(val, min_compress_len)

File "/usr/lib/pymodules/python2.6/memcache.py", line 697, in
_val_to_store_info
pickler.dump(val)

PicklingError: Can't pickle <class 'psycopg2.tz.FixedOffsetTimezone'>:
it's not the same object as psycopg2.tz.FixedOffsetTimezone

I have upgraded psycopg2 to version 2.4.2 (the FixedOffsetTimezone
should contain a fix for pickling errors - http://initd.org/psycopg/docs/tz.html),
but I still see the error. I have contacted newrelic about the issue,
but they see this issue not related to newrelic.

Has someone a hint how I can nail that issue down?

Many thanks, tom

tom

unread,
Sep 28, 2011, 3:51:03 AM9/28/11
to django...@googlegroups.com
Hello,

I have solved the problem with the support from newrelic, the issue was related to the configuration of wsgi. I have 3 VHosts for the application. I switched from wsgi embedded mode to daemon mode. Additionally I have added these two lines for each VHost:

WSGIDaemonProcess www.agileamp.com user=user group=group processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup www.agileamp.com

Best regards, Tom

Andre Terra

unread,
Sep 28, 2011, 9:08:57 AM9/28/11
to django...@googlegroups.com
Thanks for providing this feedback, Tom. I read your original question but I wasn't sure of the answer, so it's good to know how you worked it out!

Best regards,
AT

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Q6WENc5zBYMJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply all
Reply to author
Forward
0 new messages