You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=======================client.rb===========================
client = Gearman::Client.new(servers)
client.option_request("exceptions")
taskset = Gearman::TaskSet.new(client)
task = Gearman::Task.new('test', "test string")
task.retry_count = 3
task.on_exception {|ex| puts "This should never be called" }
taskset.add_task(task)
}
taskset.wait(100)
=======================worker.rb===========================
w = Gearman::Worker.new(servers)
w.add_ability('test') do |data,job|
puts data
data.reverseaaa
end
loop { w.work }
=======================error info===========================
/gems/gearman-ruby-3.0.7/lib/gearman/taskset.rb:287:in `tasks_in_progress': Got unexpected work_data with handle H:xxx:2775 from localhost:4730 (no task by that name) (Gearman::ProtocolError)
login into tasks_in_progress method:
def tasks_in_progress(hostport, handle, remove_task = false)
js_handle = Util.handle_to_str(hostport, handle)
tasks = remove_task ? @tasks_in_progress.delete(js_handle) : @tasks_in_progress[js_handle]
if not tasks
raise ProtocolError, "Got unexpected work_data with handle #{handle} from #{hostport} (no task by that name)"
end
tasks
end
==========================bug==============================
The parameter handle end with \u0000, so @tasks_in_progress.delete(js_handle) is nil. In @tasks_in_progress the record is "localhost:4730//H:localhost:2803", but handle is "localhost:4730//H:localhost:2803\u0000"。
==========================solution===========================
Resolve this like:
add line : handle = handle.chop if handle[-1,1].to_i == 0x00
The text was updated successfully, but these errors were encountered:
I'm not good at english, just check POC:
=======================client.rb===========================
client = Gearman::Client.new(servers)
client.option_request("exceptions")
taskset = Gearman::TaskSet.new(client)
task = Gearman::Task.new('test', "test string")
task.retry_count = 3
task.on_exception {|ex| puts "This should never be called" }
taskset.add_task(task)
}
taskset.wait(100)
=======================worker.rb===========================
w = Gearman::Worker.new(servers)
w.add_ability('test') do |data,job|
puts data
data.reverseaaa
end
loop { w.work }
=======================error info===========================
/gems/gearman-ruby-3.0.7/lib/gearman/taskset.rb:287:in `tasks_in_progress': Got unexpected work_data with handle H:xxx:2775 from localhost:4730 (no task by that name) (Gearman::ProtocolError)
login into tasks_in_progress method:
==========================bug==============================
The parameter handle end with \u0000, so @tasks_in_progress.delete(js_handle) is nil. In @tasks_in_progress the record is "localhost:4730//H:localhost:2803", but handle is "localhost:4730//H:localhost:2803\u0000"。
==========================solution===========================
Resolve this like:
add line : handle = handle.chop if handle[-1,1].to_i == 0x00
The text was updated successfully, but these errors were encountered: