I am trying to build up a distributed processing environment using German, but I am failing on a very first step. My setup:
PHP 5.6.4-1~dotdeb.1
gearman support => enabled
libgearman version => 1.1.12
gearman-server-0.6.2.jar
sample worker
<?php
$worker= new GearmanWorker();
echo "worker options: " . $worker->options() . PHP_EOL;
$worker->setOptions(1);
echo "worker options: " . $worker->options() . PHP_EOL;
$worker->addServer("192.168.130.16");
$worker->addFunction("reverse", "my_reverse_function");
while ($worker->work());
function my_reverse_function($job)
{
return strrev($job->workload());
}
?>
when trying to run the worker I get the error:
vagrant@planq:~$ php worker.php
PHP Fatal error: Uncaught exception 'GearmanException' with message 'Failed to set exception option' in /home/vagrant/worker.php:3
Stack trace:
#0 /home/vagrant/worker.php(3): GearmanWorker->addServer('192.168.130.16', 4730)
#1 {main}
thrown in /home/vagrant/worker.php on line 3
and server reports
10:15:02.762 - [nioEventLoopGroup-3-2] DEBUG n.j.gearman.server.net.PacketHandler - Creating new handler!
10:15:02.762 - [nioEventLoopGroup-3-2] ERROR n.j.g.common.packets.PacketFactory - Unhandled type:
10:15:02.763 - [nioEventLoopGroup-3-2] WARN n.j.gearman.server.net.PacketHandler - Unexpected exception from downstream.
io.netty.handler.codec.DecoderException: java.lang.NullPointerException
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:415) ~[gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:131) ~[gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:334) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:497) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:465) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:359) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Caused by: java.lang.NullPointerException: null
at net.johnewart.gearman.server.net.Decoder.decode(Decoder.java:60) ~[gearman-server-0.8.9-20141210.162656-1.jar:0.4]
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:360) ~[gearman-server-0.8.9-20141210.162656-1.jar:0.4]
... 10 common frames omitted
10:15:02.764 - [nioEventLoopGroup-3-2] DEBUG n.j.gearman.server.net.PacketHandler - Client closed channel: [id: 0x89bba760, /192.168.130.16:59106 :> 0.0.0.0/0.0.0.0:4730]
10:15:03.637 - [pool-2-thread-1] DEBUG n.j.g.s.u.SnapshottingJobQueueMonitor - Snapshotting job queues.
10:15:03.638 - [pool-2-thread-1] DEBUG n.j.g.s.u.SnapshottingJobQueueMonitor - Condensing data points
I would be helpful for any clues on resolving the issue...
It turned out that this was a bug in the server. After filing the bug report John fixed the server. Version 0.8.10-SNAPSHOT
fixes the issue, and works like a charm.