[ZODB-Dev] [ zodb-Bugs-650465 ] Pickling error with Python 2.2.2

noreply@sourceforge.net noreply@sourceforge.net
Mon, 09 Dec 2002 09:49:11 -0800


Bugs item #650465, was opened at 2002-12-08 17:13
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=115628&aid=650465&group_id=15628

Category: None
Group: None
Status: Open
Resolution: None
>Priority: 5
Submitted By: Andreas Jung (ajung)
Assigned to: Nobody/Anonymous (nobody)
Summary: Pickling error with Python 2.2.2

Initial Comment:
The following traceback is caused by a fresh
Zope/CMF checkout using Python 2.2.2 and
CMFCollectorNG:

Traceback (innermost last):
  Module ZPublisher.Publish, line 102, in publish
  Module Zope.App.startup, line 200, in commit
  Module ZODB.Transaction, line 234, in commit
  Module ZODB.Transaction, line 350, in 
_commit_objects
  Module ZODB.Connection, line 381, in commit
   - __traceback_info__: 
(('Products.CMFCollectorNG.CollectorNGIssue', 
'CollectorNGIssue'), '\x00\x00\x00\x00\x00\x00\x18
\xf6', '')
  Module copy_reg, line 57, in _reduce
TypeError: can't pickle function objects

This error occurs when a new ticket is added
a collector instance. This error does not
occur using Python 2.1.3.

How to reproduce:

- create a fresh sandbox using Zope/CMF/DCWorkflow
  from HEAD with Python 2.2.2 (under Linux)

- Install CMFCollectorNG from  
http://sourceforge.net/project/showfiles.php?
group_id=68417 (just extract the tar.gz file)

- install the attached Data.fs

- restart Zope

- go to http://yetix:20080/trackers/login_form
  and login as admin/pnmaster

- goto 
http://yetix:20080/trackers/test/collector_add_issue_for
m

- fill out all fields with the red background (required fields)

- click on "Ticket anlegen" (Submit ticket)

- now you should see an error screen:


Ein Fehler ist aufgetreten:

Fehler-Typ: TypeError
Fehler-Grund: can't pickle function objects
Zurück
Zeige Eintrag im Error-Logfile

- check the error_log inside Zope to get the full 
tracebrack


Andreas





----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-12-09 17:49

Message:
Logged In: YES 
user_id=31392

In the dump you attached, there is an "__str__" key and its
value is a bound method (of a record object).  The only way
__str__ would appear is a key is if it was explicitly added.
 This can't be a ZODB problem, but it could be a problem
with Zope, CMF, or the specific app.  Since I'm not
familiari with the code, it really can't guess which.

__str__ <bound method record.__str__ of {'assignees': [''],
'classification': 'Fehler', 'deadline':
DateTime('2002/12/23'), 'description': 'ouioyoiuy',
'hours_needed': 0.0, 'hours_required': 0.0, 'importance': 1,
'operating_system': ['Alle Plattformen'], 'progress': 0,
'security_related': 0, 'solution': 'uoyouiyo',
'submitter_address': '', 'submitter_city': '',
'submitter_company': '', 'submitter_email': 'yet@gmx.de',
'submitter_fax': '', 'submitter_id': 'admin',
'submitter_name': 'werwer', 'submitter_phone': '',
'submitter_position': '', 'subtopic': 'k6', 'title':
'yuyoiuyu', 'topic': 'Komponente2', 'version_info': ''}>
<type 'instance method'>

----------------------------------------------------------------------

Comment By: Andreas Jung (ajung)
Date: 2002-12-09 17:43

Message:
Logged In: YES 
user_id=11084

The instance that is pickled (CMFCollectorIssue) has no
__str__ defined. But the instance has two attributes which
are instances of a ReferencesManager class and a Transcript
class.
Both are derived from Persistent. The ReferencesManager class
defines __str__(self): return str(self._references) where
self._references
is a list of Reference instances (also derived from
Persitent). Their
__str__ implementation just return plain strings.



----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-12-09 17:32

Message:
Logged In: YES 
user_id=31392

It looks like the problem is with the __str__ attribute of
the object: It is a bound method, which can't be pickled. 
Can you tell who is assigning the __str__?

----------------------------------------------------------------------

Comment By: Andreas Jung (ajung)
Date: 2002-12-09 17:20

Message:
Logged In: YES 
user_id=11084

I see two invocations when I repeat the action that causes
the problem. In both cases, 'state' is a dictionary. I
attach a dump 
of the key-value pairs.

----------------------------------------------------------------------

Comment By: Andreas Jung (ajung)
Date: 2002-12-09 17:18

Message:
Logged In: YES 
user_id=11084

Hm....i added a "print state, type(state)". I see two
invocations.
Everytime state is a dictionary. I upload a dump of the
key-value
pairs. Looking through the output I can not see anything
strange.

----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-12-09 17:00

Message:
Logged In: YES 
user_id=31392

Two possibilities:

Print out state so that we can see what's in it.
Run dumps(state) inside pdb.


----------------------------------------------------------------------

Comment By: Andreas Jung (ajung)
Date: 2002-12-09 16:56

Message:
Logged In: YES 
user_id=11084

What is the recommended way to find the function object?

Line 381 of Connection.py is "dump(state)".
I added some debug before the last action inside the application
before the commit. There I iterated over all items returned
by dir(obj). "print obj.__reduce__" raises a "TypeError,
Can't pickle objects in acquisition wrappers." I am sure if
this is related to the problem.



----------------------------------------------------------------------

Comment By: Jeremy Hylton (jhylton)
Date: 2002-12-09 16:49

Message:
Logged In: YES 
user_id=31392

Can you get into a debugger and figure out what function
object is getting pickled?  I don't know if there's any easy
way to do this from Zope.


----------------------------------------------------------------------

Comment By: Andreas Jung (ajung)
Date: 2002-12-08 17:22

Message:
Logged In: YES 
user_id=11084

The Data.fs seems to be to big for Sourceforge.
You can download it from 
http://www.zopyx.com/tmp/Data.fs.bz2

----------------------------------------------------------------------

Comment By: Andreas Jung (ajung)
Date: 2002-12-08 17:20

Message:
Logged In: YES 
user_id=11084

Attaching Data.fs again. SF sux sometimes ;)

----------------------------------------------------------------------

Comment By: Andreas Jung (ajung)
Date: 2002-12-08 17:16

Message:
Logged In: YES 
user_id=11084

Attaching Data.fs

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=115628&aid=650465&group_id=15628