Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

singleton can't be dumped #2

Open
newbray opened this issue Apr 12, 2011 · 4 comments
Open

singleton can't be dumped #2

newbray opened this issue Apr 12, 2011 · 4 comments

Comments

@newbray
Copy link

newbray commented Apr 12, 2011

I am getting the following issue:

Started GET "/" for 127.0.0.1 at 2011-04-12 15:38:32 +0100
Processing by ApplicationController#index as HTML
Guessed service url: "http://localhost:3002/"
Generated login url: http://localhost:3000/login?service=http%3A%2F%2Flocalhost%3A3002%2F
Redirecting to "http://localhost:3000/login?service=http%3A%2F%2Flocalhost%3A3002%2F"
Redirected to http://localhost:3000/login?service=http%3A%2F%2Flocalhost%3A3002%2F
Completed 302 Found in 1ms

Started GET "/?ticket=ST-1302619113r5FBE2774BCA3684F53" for 127.0.0.1 at 2011-04-12 15:38:33 +0100
Processing by ApplicationController#index as HTML
Parameters: {"ticket"=>"ST-1302619113r5FBE2774BCA3684F53"}
Request contains ticket "ST-1302619113r5FBE2774BCA3684F53".
Guessed service url: "http://localhost:3002/"
Requesting CAS response for URI http://localhost:3000/proxyValidate?service=http%3A%2F%2Flocalhost%3A3002%2F&ticket=ST-1302619113r5FBE2774BCA3684F53
CAS server responded with #<Net::HTTPOK 200 OK readbody=true>:

<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
cas:authenticationSuccess
cas:[email protected]/cas:user
cas:firstnamedsfgg/cas:firstname
cas:surnamedsf/cas:surname
/cas:authenticationSuccess
/cas:serviceResponse
Ticket "ST-1302619113r5FBE2774BCA3684F53" for service "http://localhost:3002/" belonging to user "[email protected]" is VALID.
Extra user attributes provided along with ticket "ST-1302619113r5FBE2774BCA3684F53": {}.
Rendered application/index.html.erb within layouts/application (1.5ms)
Completed 200 OK in 121ms (Views: 4.3ms | ActiveRecord: 0.0ms)

TypeError (singleton can't be dumped):

Rendered /Users/newbray/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.6/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
Rendered /Users/newbray/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (3.9ms)
Rendered /Users/newbray/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (9.0ms)

Any ideas? i'm at a loss as to how to solve this.

Thanks

@craigmonson
Copy link

I get this problem as well. I believe this is happening because there's a singleton in the sessions hash, and it's trying to get marshalled. The offending key is ':cas_last_valid_ticket' If I do: sessions[:cas_last_valid_ticket] = nil, that error is cleared (but I do not know other side affects.)

@AnuragMishra
Copy link

Having the same issue. Digging deeper into the object that can't be dumped, it seems it is cas_last_valid_ticket.response.xml. All other objects are getting dumped using Mashal.dump(..). The xml attribute is of type REXML::Element. The actual singleton could be either this object, or one of its child attributes.

@AnuragMishra
Copy link

It seems to be related to this issue when trying to dump REXML::Document.

@newbray
Copy link
Author

newbray commented Aug 25, 2011

Here's a 'patch' that solved it for me
file: lib/casclient/responses.rb

def check_and_parse_xml(raw_xml)
# Horrible patch to stop the REXML parser triggering a 'singleton could not be dumped'
# error when source document starts with a declaration.
raw_xml.sub!(/<?xml[^\?]?>\s/, '')
... rest of method

hrenfroe pushed a commit to hrenfroe/rubycas-client-rails that referenced this issue Sep 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants