This project is archived and is in readonly mode.

#6113 ✓stale
Joe Rafaniello

[PATCH] Don't silently discard exceptions when getting/setting session via memcache

Reported by Joe Rafaniello | December 3rd, 2010 @ 07:33 PM

It's not clear to me why the code should 'rescue MemCache::MemCacheError, Errno::ECONNREFUSED' silently in the get_session and set_session methods returning {} and true respectively. Even if the higher level is to handle a false returned from set_session, how will it know what to do with no context?

In my case, I had a > 1 MB value being stored in memcache that was silently failing on the set_session in one location and then the get_session came back nil on retrieving it a few seconds later, leaving me thoroughly confused. I had turned up memcached -vv tracing and could see the "set" never occurring and finally found the following:

This was originally fixed back in 2007 in this commit:

commit d0df7f2b12b201edbef0d59360224e68f9a0a447
Author: Jeremy Kemper
Date: Sun Oct 14 20:46:06 2007 +0000

Memcached sessions: add session data on initialization; don't silently discard exceptions; add unit tests. Closes [#9823](/projects/8994/tickets/9823 "Ticket #9823").

and was broken in this commit:

commit ed708307137c811d14e5fd2cb4ea550add381a82
Author: Joshua Peek
Date: Mon Dec 15 16:33:31 2008 -0600

Switch to Rack based session stores.

Attached is a patch with test for the set_session > 1 MB.

Comments and changes to this ticket

  • Joe Rafaniello

    Joe Rafaniello December 3rd, 2010 @ 07:34 PM

    • Tag changed from 2.3.x 2.3.10 to 2.3.x 2.3.10, memcachestore
  • rails

    rails March 4th, 2011 @ 12:00 AM

    • Tag changed from 2.3.x 2.3.10, memcachestore to 23x 2310, memcachestore
    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails March 4th, 2011 @ 12:00 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket