Resque Runtime Error at /workers: wrong number of arguments for 'exists' command
I'm having a runtime errror when i'm looking at the "workers" tab on resque-web (localhost). Everything else works.
Edit: when this error occurs, i also have some (3 or 4) unknown workers 'not working'. I think they are responsible for the error but i don't understand how they got here. It only happens when i start the workers from God
Can you help me on this ? Did i do something wrong ?
Config: Resque 1.8.5 as a gem in a rails 2.3.8 app on Snow Leopard redis 1.0.7 / rack 1.1 / sinatra 1.0 / vegas 0.1.7
- file: client.rb
- location: format_error_reply
- line: 558
BACKTRACE:
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in format_error_reply
*
551. when DOLLAR then format_bulk_reply(line)
552. when ASTERISK then format_multi_bulk_reply(line)
553. else raise ProtocolError.new(reply_type)
554. end
555. end
556.
557. def format_error_reply(line)
558. raise "-" + line.strip
559. end
560.
561. def format_status_reply(line)
562. line.strip
563. end
564.
565. def format_integer_reply(line)
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in format_reply
*
541.
542. def reconnect
543. disconnect && connect_to_server
544. end
545.
546. def format_reply(reply_type, line)
547. case reply_type
548. when MINUS then format_error_reply(line)
549. when PLUS then format_status_reply(line)
550. when COLON then format_integer_reply(line)
551. when DOLLAR then format_bulk_reply(line)
552. when ASTERISK then format_multi_bulk_reply(line)
553. else raise ProtocolError.new(reply_type)
554. end
555. end
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in read_reply
*
478. disconnect
479.
480. raise Errno::EAGAIN, "Timeout reading from the socket"
481. end
482.
483. raise Errno::ECONNRESET, "Connection lost" unless reply_type
484.
485. format_reply(reply_type, @sock.gets)
486. end
487.
488.
489. if "".respond_to?(:bytesize)
490. def get_size(string)
491. string.bytesize
492. end
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in process_command
*
448. return pipeline ? results : results[0]
449. end
450.
451. def process_command(command, argvv)
452. @sock.write(command)
453. argvv.map do |argv|
454. processor = REPLY_PROCESSOR[argv[0].to_s]
455. processor ? processor.call(read_reply) : read_reply
456. end
457. end
458.
459. def maybe_lock(&block)
460. if @thread_safe
461. @mutex.synchronize(&block)
462. else
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in map
*
446. end
447.
448. return pipeline ? results : results[0]
449. end
450.
451. def process_command(command, argvv)
452. @sock.write(command)
453. argvv.map do |argv|
454. processor = REPLY_PROCESSOR[argv[0].to_s]
455. processor ? processor.call(read_reply) : read_reply
456. end
457. end
458.
459. def maybe_lock(&block)
460. if @thread_safe
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in process_command
*
446. end
447.
448. return pipeline ? results : results[0]
449. end
450.
451. def process_command(command, argvv)
452. @sock.write(command)
453. argvv.map do |argv|
454. processor = REPLY_PROCESSOR[argv[0].to_s]
455. processor ? processor.call(read_reply) : read_reply
456. end
457. end
458.
459. def maybe_lock(&block)
460. if @thread_safe
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in raw_call_command
*
435. @sock.write(command)
436. return true
437. end
438. # The normal command execution is reading and processing the reply.
439. results = maybe_lock do
440. begin
441. set_socket_timeout!(0) if requi开发者_开发知识库res_timeout_reset?(argvv[0][0].to_s)
442. process_command(command, argvv)
443. ensure
444. set_socket_timeout!(@timeout) if requires_timeout_reset?(argvv[0][0].to_s)
445. end
446. end
447.
448. return pipeline ? results : results[0]
449. end
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in synchronize
*
454. processor = REPLY_PROCESSOR[argv[0].to_s]
455. processor ? processor.call(read_reply) : read_reply
456. end
457. end
458.
459. def maybe_lock(&block)
460. if @thread_safe
461. @mutex.synchronize(&block)
462. else
463. block.call
464. end
465. end
466.
467. def read_reply
468.
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in maybe_lock
*
454. processor = REPLY_PROCESSOR[argv[0].to_s]
455. processor ? processor.call(read_reply) : read_reply
456. end
457. end
458.
459. def maybe_lock(&block)
460. if @thread_safe
461. @mutex.synchronize(&block)
462. else
463. block.call
464. end
465. end
466.
467. def read_reply
468.
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in raw_call_command
*
432. end
433. # When in Pub/Sub mode we don't read replies synchronously.
434. if @pubsub
435. @sock.write(command)
436. return true
437. end
438. # The normal command execution is reading and processing the reply.
439. results = maybe_lock do
440. begin
441. set_socket_timeout!(0) if requires_timeout_reset?(argvv[0][0].to_s)
442. process_command(command, argvv)
443. ensure
444. set_socket_timeout!(@timeout) if requires_timeout_reset?(argvv[0][0].to_s)
445. end
446. end
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in call_command
*
336. # try to reconnect just one time, otherwise let the error araise.
337. def call_command(argv)
338. log(argv.inspect, :debug)
339.
340. connect_to_server unless connected?
341.
342. begin
343. raw_call_command(argv.dup)
344. rescue Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED
345. if reconnect
346. raw_call_command(argv.dup)
347. else
348. raise Errno::ECONNRESET
349. end
350. end
* /Library/Ruby/Gems/1.8/gems/redis-1.0.7/lib/redis/client.rb in method_missing
*
385. connect_to(@host, @port)
386. call_command([:auth, @password]) if @password
387. call_command([:select, @db]) if @db != 0
388. @sock
389. end
390.
391. def method_missing(*argv)
392. call_command(argv)
393. end
394.
395. def raw_call_command(argvp)
396. if argvp[0].is_a?(Array)
397. argvv = argvp
398. pipeline = true
399. else
* /Library/Ruby/Gems/1.8/gems/redis-namespace-0.4.4/lib/redis/namespace.rb in send
*
159. args = add_namespace(args)
160. args.push(last) if last
161. when :alternate
162. args = [ add_namespace(Hash[*args]) ]
163. end
164.
165. # Dispatch the command to Redis and store the result.
166. result = @redis.send(command, *args, &block)
167.
168. # Remove the namespace from results that are keys.
169. result = rem_namespace(result) if after == :all
170.
171. result
172. end
173.
* /Library/Ruby/Gems/1.8/gems/redis-namespace-0.4.4/lib/redis/namespace.rb in method_missing
*
159. args = add_namespace(args)
160. args.push(last) if last
161. when :alternate
162. args = [ add_namespace(Hash[*args]) ]
163. end
164.
165. # Dispatch the command to Redis and store the result.
166. result = @redis.send(command, *args, &block)
167.
168. # Remove the namespace from results that are keys.
169. result = rem_namespace(result) if after == :all
170.
171. result
172. end
173.
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/lib/resque/worker.rb in state
*
416. def idle?
417. state == :idle
418. end
419.
420. # Returns a symbol representing the current worker state,
421. # which can be either :working or :idle
422. def state
423. redis.exists("worker:#{self}") ? :working : :idle
424. end
425.
426. # Is this worker the same as another worker?
427. def ==(other)
428. to_s == other.to_s
429. end
430.
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/lib/resque/server/views/workers.erb in __tilt_a2112543c5200dbe0635da5124b47311
*
46. <tr>
47. <th> </th>
48. <th>Where</th>
49. <th>Queues</th>
50. <th>Processing</th>
51. </tr>
52. <% for worker in (workers = resque.workers.sort_by { |w| w.to_s }) %>
53. <tr class="<%=state = worker.state%>">
54. <td class='icon'><img src="<%=u state %>.png" alt="<%= state %>" title="<%= state %>"></td>
55.
56. <% host, pid, queues = worker.to_s.split(':') %>
57. <td class='where'><a href="<%=u "workers/#{worker}"%>"><%= host %>:<%= pid %></a></td>
58. <td class='queues'><%= queues.split(',').map { |q| '<a class="queue-tag" href="' + u("/queues/#{q}") + '">' + q + '</a>'}.join('') %></td>
59.
60. <td class='process'>
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/lib/resque/server/views/workers.erb in each
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/lib/resque/server/views/workers.erb in __tilt_a2112543c5200dbe0635da5124b47311
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/tilt.rb in send
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/tilt.rb in evaluate
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/tilt.rb in render
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in render
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in erb
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/lib/resque/server.rb in show
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/lib/resque/server.rb in GET /workers
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in call
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in route
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in instance_eval
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in route_eval
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in route!
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in catch
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in route!
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in each
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in route!
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in dispatch!
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in call!
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in instance_eval
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in invoke
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in catch
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in invoke
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in call!
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in call
* /Volumes/Donnees/Users/**/.gem/ruby/1.8/gems/rack-1.1.0/lib/rack/showexceptions.rb in call
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in call
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in synchronize
* /Library/Ruby/Gems/1.8/gems/sinatra-1.0/lib/sinatra/base.rb in call
* /Volumes/Donnees/Users/**/.gem/ruby/1.8/gems/rack-1.1.0/lib/rack/content_length.rb in call
* /Volumes/Donnees/Users/**/.gem/ruby/1.8/gems/rack-1.1.0/lib/rack/chunked.rb in call
* /Volumes/Donnees/Users/**/.gem/ruby/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb in process
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in process_client
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in each
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in process_client
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in run
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in initialize
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in new
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in run
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in initialize
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in new
* /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb in run
* /Volumes/Donnees/Users/**/.gem/ruby/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb in run
* /Library/Ruby/Gems/1.8/gems/vegas-0.1.7/lib/vegas/runner.rb in run!
* /Library/Ruby/Gems/1.8/gems/vegas-0.1.7/lib/vegas/runner.rb in start
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/bin/resque-web in new
* /Library/Ruby/Gems/1.8/gems/resque-1.8.5/bin/resque-web in nil
* /usr/bin/resque-web in load
I found the problem :
in god config file, i had (with spaces after the comma in QUEUE):
num_workers.times do |num|
God.watch do |w|
w.name = "resque-#{num}"
w.group = 'resque'
w.interval = 30.seconds
w.env = {"QUEUE"=>"critical, high, low", "RAILS_ENV"=>rails_env}
instead of (without spaces after comma):
num_workers.times do |num|
God.watch do |w|
w.name = "resque-#{num}"
w.group = 'resque'
w.interval = 30.seconds
w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env}
Now it works !!
精彩评论