I''m hoping someone can help nail down a problem I''ve been
having with
session data getting corrupted very shortly after login. I''m using
ActiveRecordStore for sessions, ActiveRBAC for user auth. Changing the
store type has not helped. I have the same problem both using
Mysql/Windows and Postgresql/freebsd. Development mode under WEBrick or
lighttpd. Rails 0.13.1.
After each step I selected the data from the sessions table and found
that 2-3 clicks after the User object is stored in the session [step 4],
the session.data column becomes corrupted -- I can''t make heads or
tails
of what happened just by reloading the page... I found
http://dev.rubyonrails.org/ticket/2234 but I am not storing much data,
and as seen below, there is no problem storing the data initially.
1. Open [URL]/login/login
2. select sessid, decode(data, ''base64'') from sessions;
2587d4d9df02de17b6a71665f839b776 |
\004\010{\006"\012flashIC:''ActionController::Flash::FlashHash{\000\006:\012@used{\000
3. Enter username/password, submit
4. select sessid, decode(data, ''base64'') from sessions;
2587d4d9df02de17b6a71665f839b776 |
\004\010{\007:\016rbac_usero:\011User\011:\027@user_registration0:\020@attributes{\017"\027password_hash_type"\010md5"\017updated_at"\0302005-09-28
23:03:52"\007id"\0061"\026last_logged_in_at"\0302005-09-28
23:03:52"\030login_failure_count"\0060"\015password"%5f4dcc3b5aa765d61d8327deb882cf99"\012login"\012Admin"\012state"\0062"\012email"\023root@localhost"\017created_at"\0302005-09-28
23:03:52:\013@roles0:\014@groups0"\012flashIC:''ActionController::Flash::FlashHash{\000\006:\012@used{\000
5. Load main page of app, which comes up OK. Sometimes it takes 2-3
page refreshes for the data to become corrupted.
6. select sessid, decode(data, ''base64'') from sessions; [NOTE
the
decoded data is no longer serialized object data]
2587d4d9df02de17b6a71665f839b776 |
\004\010"\002\021\002BAh7BzoOcmJhY191c2VybzoJVXNlcgk6F0B1c2VyX3JlZ2lzdHJhdGlvbjA6\012EEBhdHRyaWJ1dGVzew8iF3Bhc3N3b3JkX2hhc2hfdHlwZSIIbWQ1Ig91cGRh\012dGVkX2F0IhgyMDA1LTA5LTI4IDIzOjAzOjUyIgdpZCIGMSIWbGFzdF9sb2dn\012ZWRfaW5fYXQiGDIwMDUtMDktMjggMjM6MDM6NTIiGGxvZ2luX2ZhaWx1cmVf\012Y291bnQiBjAiDXBhc3N3b3JkIiU1ZjRkY2MzYjVhYTc2NWQ2MWQ4MzI3ZGVi\012ODgyY2Y5OSIKbG9naW4iCkFkbWluIgpzdGF0ZSIGMiIKZW1haWwiE3Jvb3RA\012bG9jYWxob3N0Ig9jcmVhdGVkX2F0IhgyMDA1LTA5LTI4IDIzOjAzOjUyOgtA\012cm9sZXMwOgxAZ3JvdXBzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6\012Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==\012
And now, upon the next page load...
7. Reload page, error displayed:
string not matched
Framework trace
/usr/local/lib/ruby/1.8/cgi/session/pstore.rb:25:in `[]=''
/usr/local/lib/ruby/1.8/cgi/session/pstore.rb:25:in `[]=''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/flash.rb:133:in
`flash''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/flash.rb:146:in
`fire_flash''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:317:in
`send''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:317:in
`call_filters''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:313:in
`each''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:313:in
`call_filters''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:302:in
`before_action''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:294:in
`perform_action_without_benchmark''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in
`perform_action_without_rescue''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in
`measure''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in
`perform_action_without_rescue''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in
`perform_action''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in
`send''
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in
`process''
/usr/local/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in
`dispatch''
/usr/local/lib/ruby/gems/1.8/gems/cmdparse-2.0.0/lib/cmdparse.rb:195:in
`execute''
/usr/local/lib/ruby/gems/1.8/gems/cmdparse-2.0.0/lib/cmdparse.rb:412:in
`parse''
For reference, here''s an example of the session.data field that causes
the "string not matched" error. Certainly not base-64 encoded as it
was
previously...
BAgiAi4CQkFoN0NEb09jbUpoWTE5MWMyVnliem9KVlhObGNnazZFRUJoZEhS
eWFXSjFkR1Z6ZXc4aUYzQmhjM04zCmIzSmtYMmhoYzJoZmRIbHdaU0lJYldR
MUlnOTFjR1JoZEdWa1gyRjBJaGd5TURBMUxUQTVMVEk0SURJegpPakF6T2pV
eUlnZHBaQ0lHTVNJV2JHRnpkRjlzYjJkblpXUmZhVzVmWVhRaUdESXdNRFV0
TURrdE1qZ2cKTWpNNk1ETTZOVElpR0d4dloybHVYMlpoYVd4MWNtVmZZMjkx
Ym5RaUJqQWlEWEJoYzNOM2IzSmtJaVUxClpqUmtZMk16WWpWaFlUYzJOV1Ey
TVdRNE16STNaR1ZpT0RneVkyWTVPU0lLYkc5bmFXNGlDa0ZrYldsdQpJZ3B6
ZEdGMFpTSUdNaUlLWlcxaGFXd2lFM0p2YjNSQWJHOWpZV3hvYjNOMElnOWpj
bVZoZEdWa1gyRjAKSWhneU1EQTFMVEE1TFRJNElESXpPakF6T2pVeU9oZEFk
WE5sY2w5eVpXZHBjM1J5WVhScGIyNHdPZ3RBCmNtOXNaWE13T2d4QVozSnZk
WEJ6TURvT2NtVjBkWEp1WDNSdklnNHZhWFJsYlM5dVpYY2lDbVpzWVhObwpT
VU02SjBGamRHbHZia052Ym5SeWIyeHNaWEk2T2tac1lYTm9PanBHYkdGemFF
aGhjMmg3QUFZNkNrQjEKYzJWa2V3QT0K
Hope there''s enough info here for someone to make a stab at a
resolution.
Kevin E. Hunt
i am now having this same problem with rails 1.14.1. my session is not large at all and i am at a loss as to what the problem is. does anyone else know? -felix Kevin E. Hunt wrote:> I''m hoping someone can help nail down a problem I''ve been having with > session data getting corrupted very shortly after login. I''m using > ActiveRecordStore for sessions, ActiveRBAC for user auth. Changing the > store type has not helped. I have the same problem both using > Mysql/Windows and Postgresql/freebsd. Development mode under WEBrick or > lighttpd. Rails 0.13.1. > > After each step I selected the data from the sessions table and found > that 2-3 clicks after the User object is stored in the session [step 4], > the session.data column becomes corrupted -- I can''t make heads or tails > of what happened just by reloading the page... I found > http://dev.rubyonrails.org/ticket/2234 but I am not storing much data, > and as seen below, there is no problem storing the data initially. > > 1. Open [URL]/login/login > 2. select sessid, decode(data, ''base64'') from sessions; > 2587d4d9df02de17b6a71665f839b776 | > \004\010{\006"\012flashIC:''ActionController::Flash::FlashHash{\000\006:\012@used{\000 > > > 3. Enter username/password, submit > 4. select sessid, decode(data, ''base64'') from sessions; > 2587d4d9df02de17b6a71665f839b776 | > \004\010{\007:\016rbac_usero:\011User\011:\027@user_registration0:\020@attributes{\017"\027password_hash_type"\010md5"\017updated_at"\0302005-09-28 > 23:03:52"\007id"\0061"\026last_logged_in_at"\0302005-09-28 > 23:03:52"\030login_failure_count"\0060"\015password"%5f4dcc3b5aa765d61d8327deb882cf99"\012login"\012Admin"\012state"\0062"\012email"\023root@localhost"\017created_at"\0302005-09-28 > 23:03:52:\013@roles0:\014@groups0"\012flashIC:''ActionController::Flash::FlashHash{\000\006:\012@used{\000 > > > 5. Load main page of app, which comes up OK. Sometimes it takes 2-3 > page refreshes for the data to become corrupted. > 6. select sessid, decode(data, ''base64'') from sessions; [NOTE the > decoded data is no longer serialized object data] > 2587d4d9df02de17b6a71665f839b776 | > \004\010"\002\021\002BAh7BzoOcmJhY191c2VybzoJVXNlcgk6F0B1c2VyX3JlZ2lzdHJhdGlvbjA6\012EEBhdHRyaWJ1dGVzew8iF3Bhc3N3b3JkX2hhc2hfdHlwZSIIbWQ1Ig91cGRh\012dGVkX2F0IhgyMDA1LTA5LTI4IDIzOjAzOjUyIgdpZCIGMSIWbGFzdF9sb2dn\012ZWRfaW5fYXQiGDIwMDUtMDktMjggMjM6MDM6NTIiGGxvZ2luX2ZhaWx1cmVf\012Y291bnQiBjAiDXBhc3N3b3JkIiU1ZjRkY2MzYjVhYTc2NWQ2MWQ4MzI3ZGVi\012ODgyY2Y5OSIKbG9naW4iCkFkbWluIgpzdGF0ZSIGMiIKZW1haWwiE3Jvb3RA\012bG9jYWxob3N0Ig9jcmVhdGVkX2F0IhgyMDA1LTA5LTI4IDIzOjAzOjUyOgtA\012cm9sZXMwOgxAZ3JvdXBzMCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6\012Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==\012 > > > And now, upon the next page load... > 7. Reload page, error displayed: > string not matched > > Framework trace > /usr/local/lib/ruby/1.8/cgi/session/pstore.rb:25:in `[]='' > /usr/local/lib/ruby/1.8/cgi/session/pstore.rb:25:in `[]='' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/flash.rb:133:in > `flash'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/flash.rb:146:in > `fire_flash'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:317:in > `send'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:317:in > `call_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:313:in > `each'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:313:in > `call_filters'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:302:in > `before_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:294:in > `perform_action_without_benchmark'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in > `measure'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in > `perform_action_without_rescue'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in > `perform_action'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in > `send'' > /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in > `process'' > /usr/local/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in > `dispatch'' > /usr/local/lib/ruby/gems/1.8/gems/cmdparse-2.0.0/lib/cmdparse.rb:195:in > `execute'' > /usr/local/lib/ruby/gems/1.8/gems/cmdparse-2.0.0/lib/cmdparse.rb:412:in > `parse'' > > For reference, here''s an example of the session.data field that causes > the "string not matched" error. Certainly not base-64 encoded as it was > previously... > BAgiAi4CQkFoN0NEb09jbUpoWTE5MWMyVnliem9KVlhObGNnazZFRUJoZEhS > eWFXSjFkR1Z6ZXc4aUYzQmhjM04zCmIzSmtYMmhoYzJoZmRIbHdaU0lJYldR > MUlnOTFjR1JoZEdWa1gyRjBJaGd5TURBMUxUQTVMVEk0SURJegpPakF6T2pV > eUlnZHBaQ0lHTVNJV2JHRnpkRjlzYjJkblpXUmZhVzVmWVhRaUdESXdNRFV0 > TURrdE1qZ2cKTWpNNk1ETTZOVElpR0d4dloybHVYMlpoYVd4MWNtVmZZMjkx > Ym5RaUJqQWlEWEJoYzNOM2IzSmtJaVUxClpqUmtZMk16WWpWaFlUYzJOV1Ey > TVdRNE16STNaR1ZpT0RneVkyWTVPU0lLYkc5bmFXNGlDa0ZrYldsdQpJZ3B6 > ZEdGMFpTSUdNaUlLWlcxaGFXd2lFM0p2YjNSQWJHOWpZV3hvYjNOMElnOWpj > bVZoZEdWa1gyRjAKSWhneU1EQTFMVEE1TFRJNElESXpPakF6T2pVeU9oZEFk > WE5sY2w5eVpXZHBjM1J5WVhScGIyNHdPZ3RBCmNtOXNaWE13T2d4QVozSnZk > WEJ6TURvT2NtVjBkWEp1WDNSdklnNHZhWFJsYlM5dVpYY2lDbVpzWVhObwpT > VU02SjBGamRHbHZia052Ym5SeWIyeHNaWEk2T2tac1lYTm9PanBHYkdGemFF > aGhjMmg3QUFZNkNrQjEKYzJWa2V3QT0K > > Hope there''s enough info here for someone to make a stab at a resolution. > > Kevin E. Hunt
Nicholas Van Weerdenburg
2005-Oct-27 03:43 UTC
Re: Re: "string not matched" and session corruption
On 10/26/05, Felix McCoey <felix.mccoey-8PZlF8N9LqR+XZJcv9eMoEEOCMrvLtNR@public.gmane.org> wrote:> i am now having this same problem with rails 1.14.1. my session is not > large at all and i am at a loss as to what the problem is. > > does anyone else know? > > -felix >I had an issue where calling render_component_as_string in a before_filter for the page where I login caused the session to not keep the user data. session[:user] was fine after login, but not when returning to the originating page. Nick