resque-status icon indicating copy to clipboard operation
resque-status copied to clipboard

The initialize in hash.rb sometimes for some reason do produce broken content

Open renemadsen opened this issue 12 years ago • 4 comments

'{"name":"ElementWorker({ "id" => "123"})","uuid":"9af80260af01012f35f700163e4df9e3","time":'
Resque::Helpers::DecodeException at /statuses
lexical error: invalid char in json text. 012f35f700163e4df9e3","time": (right here) ------^

renemadsen avatar Jul 13 '12 11:07 renemadsen

Resque::Helpers::DecodeException: lexical error: invalid char in json text.
          012f35f800163e4df9e3","time":x �181267,"total":100,"num":18
                     (right here) ------^

This is actually what it says in the console if you look at the server response.

Seems to occur with resque 1.17.1 (related to https://github.com/defunkt/resque/issues/507), but testing with resque 1.21.0 to make sure this problem has gone away before closing the issue.

renemadsen avatar Jul 13 '12 12:07 renemadsen

After 100 runs with resque 1.21.0 without any problem I consider my issue for being related to 1.17.0 and therefore not affecting resque-status alone.

renemadsen avatar Jul 13 '12 12:07 renemadsen

705: unexpected token at '{"uuid":"c85e7820af19012f35fa00163e4df9e3","time":???'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/json-1.4.6/lib/json/common.rb:146:in `parse'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/json-1.4.6/lib/json/common.rb:146:in `parse'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/multi_json-1.0.4/lib/multi_json/engines/json_common.rb:9:in `decode'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/multi_json-1.0.4/lib/multi_json.rb:76:in `decode'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/resque-1.21.0/lib/resque/helpers.rb:40:in `decode'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/resque-status-0.3.3/lib/resque/plugins/status/hash.rb:24:in `get'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/resque-status-0.3.3/lib/resque/plugins/status.rb:163:in `status'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/resque-status-0.3.3/lib/resque/plugins/status.rb:220:in `set_status'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/resque-status-0.3.3/lib/resque/plugins/status.rb:198:in `failed'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/resque-status-0.3.3/lib/resque/plugins/status.rb:142:in `safe_perform!'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/resque-status-0.3.3/lib/resque/plugins/status.rb:104:in `perform'

The error still persists with resque 1.21.0 it just taks way longer for it to occur.

ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

gem list: aaronh-chronic (0.3.9) abstract (1.0.0) actionmailer (2.3.11) actionpack (2.3.11) activemodel (3.0.6) activerecord (2.3.11) activeresource (2.3.11) activesupport (2.3.11) airbrake (3.0.9) Ascii85 (1.0.0) awesome_print (1.0.2) bcrypt-ruby (3.0.0) builder (3.0.0, 2.1.2) bundle (0.0.1) bundler (1.0.18, 1.0.13) capistrano (2.5.21) capistrano-ext (1.2.1) configatron (2.7.2) cucumber (0.10.2) cucumber-rails (0.4.1) daemon_controller (0.2.6) database_cleaner (0.6.6) diff-lcs (1.1.3, 1.1.2) erubis (2.7.0, 2.6.6) expectations (2.0.0) fastthread (1.0.7) gherkin (2.4.18, 2.3.7, 2.3.5) haml (3.0.25) highline (1.6.2, 1.6.1) hike (1.2.1) hpricot (0.8.4) htmlentities (4.3.0) i18n (0.6.0) json (1.4.6) leftright (0.9.1) macaddr (1.6.1) metaclass (0.0.1) mocha (0.10.0, 0.9.12) multi_json (1.0.4) mysql (2.8.1) net-scp (1.0.4) net-sftp (2.0.5) net-ssh (2.2.1, 2.1.4) net-ssh-gateway (1.1.0, 1.0.1) nokogiri (1.5.0) passenger (3.0.7) pdf-reader (0.9.1) prawn (0.11.1) rack (1.4.1, 1.2.3, 1.2.2, 1.1.2) rack-cache (1.0.3) rack-mount (0.8.3, 0.6.14) rack-protection (1.2.0, 1.1.4) rack-ssl (1.3.2) rack-test (0.6.1, 0.5.7) rails (2.3.11) rake (0.9.2.2, 0.8.7) rcov (0.9.9) rdoc (3.9.4) recaptcha (0.3.1) redis (2.2.2) redis-namespace (1.0.3) redisk (0.2.2) resource_controller (0.6.6) resque (1.21.0) resque-retry (0.1.0) resque-scheduler (1.9.9) resque-status (0.3.3) rspec (2.5.0) rspec-core (2.5.2) rspec-expectations (2.5.0) rspec-mocks (2.5.0) ruby-ole (1.2.11.1) rubygems-update (1.6.2) rufus-scheduler (2.0.10, 2.0.9) sinatra (1.2.6, 1.2.3) spreadsheet (0.6.5.3) sprockets (2.0.0) systemu (2.5.1) term-ansicolor (1.0.6, 1.0.5) thor (0.14.6) thoughtbot-shoulda (2.11.1) tilt (1.3.3, 1.3.1, 1.2.2) ttfunk (1.0.2, 1.0.1) tzinfo (0.3.29, 0.3.27, 0.3.26) uuid (2.3.5) vegas (0.1.8) webrat (0.7.3) whenever (0.6.7) yajl-ruby (0.8.3) yamler (0.1.0) ZenTest (4.5.0) zipruby (0.3.6)

Anything above that could tricker it to do this?

renemadsen avatar Jul 13 '12 13:07 renemadsen

It looks like something that is writing a time attribute to your json. Resque::Status writes this, but as a plain integer:

https://github.com/quirkey/resque-status/blob/master/lib/resque/plugins/status/hash.rb#L206

Time.now.to_i.to_json should produce consistent results. I don't know if this is a problem with Resque::Status itself.

quirkey avatar Aug 13 '12 07:08 quirkey