Upgrade application from rails 2.2.2 to 2.3.2


#1

Hi,

We are upgrading our application to 2.3.2 recently and got a strange
problem with session id.

We uses ActiveRecord to store sessions and the session id column type
was VARCHAR(255). After I started the server, I had problem with
inserting into session table. It turns out that the session id value is
really long and after I changed the column type to text, the application
works. I also tried to switch to store sessions in cookies and it works.
You’ll notice the session id is longer than 255 too though. Any
comments?

Here are session_id and data I copied from my sessions table

session_id:
BAh7FCIodmFsaWRhdGlvbl90cmFja2VyX2Zvcl9TaGlwcGluZ0luZm9vOixJcnJlc29sdXRlVmFsaWRhdGlvbjo6VmFsaWRhdGlvblRyYWNrZXIGOhpAYXR0cmlidXRlc192YWxpZGF0ZWR7BjoVc2hpcHBpbmdfYWRkcmVzc286PklycmVzb2x1dGVWYWxpZGF0aW9uOjpWYWxpZGF0aW9uVHJhY2tlcjo6QXR0cmlidXRlVHJhY2tlcgY6C0B0aW1lc2kAOg5yZXR1cm5fdG8iBi86D2V4cGlyZXNfYXRJdToJVGltZQ20ShuAlVjTQQY6H0BtYXJzaGFsX3dpdGhfdXRjX2NvZXJjaW9uRjoLbG9jYWxlIgpFTl9VUzoPc2Vzc2lvbl9pZCIlMGMxYjU0NzJiY2Y1MTc3NDlmZGVjYzJiMTBhNjYxMjg6GHN1YnNjcmliZV90eXBlX25hbWUiC0RpcmVjdDoec2hvd19idXNpbmVzc19wbGFuc19vbmx5P0Y6EF9jc3JmX3Rva2VuIjFvWVNpT2c1cDZCbXE0emZrM1FTaXlXZ1V5cWhhOUF3L1BmNDdDWkV2UC9BPSIndmFsaWRhdGlvbl90cmFja2VyX2Zvcl9CaWxsaW5nSW5mb287AAY7BnsJOhhiaWxsaW5nX3Bvc3RhbF9jb2RlbzsIBjsJaQA6F2JpbGxpbmdfZmlyc3RfbmFtZW87CAY7CWkAOhFwYXltZW50X3R5cGVvOwgGOwlpADoWYmlsbGluZ19sYXN0X25hbWVvOwgGOwlpADoObmF2aWdhdG9ybzoOTmF2aWdhdG9yCjoTQHByb3RldXNfc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tYmVyX3N1Y2Nlc3NfdXJsOxNvOxkKOxpAETseOh1zZWxlY3Rf
ZGV2aWNlX2JyZWFkY3J1bWI7IEY7ITsdOyI7EzoZc2hpcHBpbmdfc3VnZ2Vz
dGlvbnNvOxkKOxpAETsnOys7IEY7ITscOyI7NDsqbzsZCjsaQBE7HjoVcGxh
bnNfYnJlYWRjcnVtYjsgRjshOx07IjsqOhhwb3J0X251bWJlcl9zdWNjZXNz
bzsZCjsaQBE7JzsVOyBGOyE7HDsiOzY6DGFjY291bnRvOxkKOxpAETseOhxh
Y2NvdW50X2luZm9fYnJlYWRjcnVtYjsgRjshOxw7Ijs3OyhvOxkKOxpAETse
OiFlbWVyZ2VuY3lfYWRkcmVzc19icmVhZGNydW1iOyBGOyE7HDsiOyg6D0Bh
bGxfcGFnZXNbDUAgQB5AGUAiQCNAF0AQQBo6E0Bwcm90ZXVzX3BhZ2VzWw1A
IEAeQBlAIkAjQBdAEEAaIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpG
bGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA

Thank you.
Cao


#2

On Mar 24, 1:40 pm, Guoliang C. removed_email_address@domain.invalid
wrote:

You’ll notice the session id is longer than 255 too though. Any
comments?

That looks like it’s taking cookie store type session_ids (where the
session_id is the the entire session) and trying to insert it into the
database. Not sure how that would happen unless you were switching
back and forth between session store types (because then you would get
a session cookie with that long session id).

Fred


#3

Frederick C. wrote:

On Mar 24, 1:40�pm, Guoliang C. removed_email_address@domain.invalid
wrote:

You’ll notice the session id is longer than 255 too though. Any
comments?

That looks like it’s taking cookie store type session_ids (where the
session_id is the the entire session) and trying to insert it into the
database. Not sure how that would happen unless you were switching
back and forth between session store types (because then you would get
a session cookie with that long session id).

Fred

Thank you.

That sounds a reasonable guess. We do use cookies in a few places, it
might trigger rails to generate session id differently. I’ll try to dig
through rails code and see if I can find anything interesting.


#4

I reset my databases and the application works great now. Not sure what
caused the original problem, maybe just some random thing related to
session database.


#5

The reason is well explained by differences between how session id is
calculated for different session stores.

You need to clear the cookies in the client web browser’s cache before
they
start using session ids compatible with your new session store.

You don’t really need to reset any database.

I believe you would have faced the same problem in previous rails
releases
as well.

-erekyus

Perry S.-5 wrote:

comments?


View this message in context:
http://www.nabble.com/Upgrade-application-from-rails-2.2.2-to-2.3.2-tp22680659p23230162.html
Sent from the RubyOnRails Users mailing list archive at Nabble.com.