httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

Exception for store_cookie

Open vnazarenko opened this issue 10 years ago • 1 comments

Hi, I've got this exception:

undefined method `chomp!' for nil:NilClass;
bundle/ruby/2.2.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:128:in `parse_record'
bundle/ruby/2.2.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:103:in `block in load'
bundle/ruby/2.2.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:102:in `each_line'
bundle/ruby/2.2.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:102:in `load'
bundle/ruby/2.2.0/gems/http-cookie-1.0.2/lib/http/cookie_jar.rb:325:in `block in load'
bundle/ruby/2.2.0/gems/http-cookie-1.0.2/lib/http/cookie_jar.rb:324:in `open'
bundle/ruby/2.2.0/gems/http-cookie-1.0.2/lib/http/cookie_jar.rb:324:in `load'
bundle/ruby/2.2.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:22:in `load_cookies'
bundle/ruby/2.2.0/gems/httpclient-2.6.0.1/lib/httpclient.rb:573:in `set_cookie_store'

I't a pitty, byt it's from log file, so i have no input data (

vnazarenko avatar Nov 17 '15 13:11 vnazarenko

According to the error, at that time cookie file contained wrong record(s) in it. It should not happen but I found that saving/loading cookie file is not thread-safe so one Thread can load broken cookie file when other thread is saving it. Do you think it's the case you found? Are you saving cookie file to file for each request and you're using multiple Threads?

nahi avatar Dec 20 '15 07:12 nahi