
Unable to Marshal.dump DM objects (0.9.7)
Reported by Ken Robertson | December 3rd, 2008 @ 10:07 AM
Attempting to cache some frequently run queries, though marshaling fails on all DM objects on the latest gems (0.9.7).
For a test script, see: http://gist.github.com/31593
If you try to marshal a freshly created DM object, it will work, but if you retrieve that object from the DB, then it fails:
TypeError: no marshal_dump is defined for class Thread from
(irb):22:in dump' from (irb):22
By inspecting the object some, it appears there is a @transactions instance variable in the repository which contains a thread. My guess is it tracts which threads a transaction is on, though it likely needs to close those out before marshaling.
Comments and changes to this ticket
-
curtisabbott December 5th, 2008 @ 12:46 PM
A related problem: even a freshly created DM object cannot be marshaled if its model uses associations (ie 'has'). This means that no such object can be stored in sessions, which for me at least is a serious problem. I also posted about this at google groups, http://groups.google.com/group/m...
-
Dan Kubb (dkubb) December 5th, 2008 @ 06:44 PM
- State changed from unconfirmed to confirmed
I'm actually thinking this is caused by DM::Collection having a Proc inside itself that is used to lazy-load the results from the repository.
Is there a hook method that could be added that Mashal will used to dump the object so we can remove the reference to any associations?
-
Felix Sun December 17th, 2008 @ 12:02 AM
although #470 says resolved, but I can not put the DataMapper object to memcached because of the error.
-
Dan Kubb (dkubb) January 4th, 2009 @ 02:52 AM
- Tag set to bug, marshal
- State changed from confirmed to resolved
- Assigned user set to Dan Kubb (dkubb)
This should be fixed in the following commit in sam/dm-core:
http://github.com/sam/dm-core/co...
Marking this as resolved for now. Please install this version of dm-core, and respond if it doesn't resolve the issue for you, and I will reopen the ticket.
-
Ken Robertson January 6th, 2009 @ 12:23 AM
I can confirm that it worked just fine with the 0.9.9 gems! Thanks a ton, very grateful!
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Referenced by
-
470 Memcaching: can't marshal DM objects I had posted this as #691 as well and had a quick script ...
-
470 Memcaching: can't marshal DM objects Ken, thanks for the pointer to #691, and especially the s...