# Marshal data too short - when user id = 51

**URL:** <https://www.ruby-forum.com/t/marshal-data-too-short-when-user-id-51/109961>\
**Category:** Rails\
**Created:** [July 20, 2007, 6:10pm UTC](https://www.ruby-forum.com/t/marshal-data-too-short-when-user-id-51/109961 "2007-07-20T18:10:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5fc32e/32.png) [@leei](https://www.ruby-forum.com/u/leei)\
**Post date:** [July 20, 2007, 6:10pm UTC](https://www.ruby-forum.com/t/marshal-data-too-short-when-user-id-51/109961/1 "2007-07-20T18:10:41Z")

</div>

When a session is created ( disk based not active record ) and the id  
of the user record is 21 I get marshal data too short. I am not the  
only one by the looks of this  
[http://wiki.rubyonrails.org/rails/pages/MarshalDataTooShort](http://wiki.rubyonrails.org/rails/pages/MarshalDataTooShort).

The application is running on Windows with a SQL Server backend.

The suggested workaround is to use ActiveRecord based sessions and the  
WIKI does have a patch but it is dated 2004.

Any ideas ? Anyone else seen this ?

Regards

Lee

---

<div class="post-metadata">

**Author:** ![leei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5fc32e/32.png) [@leei](https://www.ruby-forum.com/u/leei)\
**Post date:** [July 20, 2007, 6:19pm UTC](https://www.ruby-forum.com/t/marshal-data-too-short-when-user-id-51/109961/2 "2007-07-20T18:19:42Z")

</div>

Just noticed my subject was wrong but I can confirm it is user 21.

---

<div class="post-metadata">

**Author:** ![leei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5fc32e/32.png) [@leei](https://www.ruby-forum.com/u/leei)\
**Post date:** [July 20, 2007, 6:24pm UTC](https://www.ruby-forum.com/t/marshal-data-too-short-when-user-id-51/109961/3 "2007-07-20T18:24:43Z")

</div>

On Jul 20, 2007, at 10:09 AM, MagpieUK wrote:

> When a session is created ( disk based not active record ) and the id  
> of the user record is 21 I get marshal data too short. I am not the  
> only one by the looks of this [http://wiki.rubyonrails.org/rails/](http://wiki.rubyonrails.org/rails/)  
> pages/MarshalDataTooShort.

I get that under certain circumstances. For certain requests I create  
an array of objects that needs to persist for several subsequent  
requests. I put it in the session like this:

session[:mappable\_items] =  
AccountApplication.make\_mappable\_items\_array(@account\_applications)

If that array is large enough I get the marshal data too short error,  
and subsequently the error 500 message.  
I had assumed that the session would actually hold only a pointer to  
the array, but the fact that the size of the array changes the  
behavior implies that that’s not the case. My Ruby skills and Rails  
skills are poor, so I’ve assumed it’s my problem, not Rails or Ruby.
