One in two-three requests gearman's client doBackground method does not put request in queue

106 views
Skip to first unread message

Kamil K

unread,
May 16, 2018, 8:48:30 AM5/16/18
to Gearman

As title says, when requests come, some of them get lost. After debugging, I realized that


$gmclient = new GearmanClient();
$gmclient->addServer("x.x.x.x");
$result = $gmclient->doBackground($method, json_encode($res));


doBackground method returns good response, but new request isn't put in queue.

Why this is happening? What can be wrong?

Also tried to change to doNormal, without success.

Алексей Пастухов

unread,
May 16, 2018, 10:54:58 AM5/16/18
to Gearman
your description is too spare.

For purpose of troubleshooting:
1. set proper gearmand's log level
2. insure you could connect gearmand:  "nc -w 2 -v HOST-OR-IP-OF-GEARMAND 4730"

Kamil K

unread,
May 16, 2018, 11:52:29 AM5/16/18
to gea...@googlegroups.com
@Алексей, do you mind, if I write in Russian?

ср, 16 мая 2018 г., 17:55 Алексей Пастухов <alexei.p...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Gearman" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gearman+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Алексей Пастухов

unread,
May 16, 2018, 12:07:13 PM5/16/18
to Gearman
On Wednesday, 16 May 2018 17:52:29 UTC+2, Kamil K wrote:
@Алексей, do you mind, if I write in Russian?
 
It would be fine to me also.
 

Kamil K

unread,
May 17, 2018, 2:15:22 AM5/17/18
to gea...@googlegroups.com
"Поднял" один сервер gearman. Операционная система centos7. Установил через yum install, установил php-gearman. PHP 7.x.
Сервер очередей стартует сам после перезагрузки, и логи походу не пишет никуда. [Буду разбираться]

Далее написал скрипты на nodejs и php. 

Сразу возникли проблемы с воркерами, так хоть я стартовал несколько воркеров, при поступлении задания выполнялся один воркер. Проблема была в том что нужно не порождать отдельный поток, а порождать отдельный процесс. С nodejs решил проблему. С php долго думал и тоже решил путем вызовов через bash несколько раз одного и того же скрипта в фоновом режиме [через &] с логированием в файл [>>]. 

Проблема обнаружилась недавно, когда постановка в очередь методом doBackground хоть и возвращает ок [положительный результат] задание в очередь не ставится [отслеживал командой watch -n 0.1 'gearadmin --show-jobs']
Логирование смотрел, его нет, буду сейчас разбираться как включить.

Проблема решилась после перезапуска сервера, но думаю это не надолго

--
You received this message because you are subscribed to the Google Groups "Gearman" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gearman+unsubscribe@googlegroups.com.

Алексей Пастухов

unread,
May 17, 2018, 3:00:38 AM5/17/18
to Gearman
It would be highly recommended to use gearmand in current version

"gearmand --help" shows all available arguments.

For testing purpose:
1. start an other instance of gearmand with higher level of verbosity
gearmand --verbose DEBUG --port 4731 # if 4731 isn't occupied

2. client test
2.1 add background job
$  date | gearman -h localhost -p 4731 -b -f foo
(general) ✔ /opt/devel/workspace/MIP/pepcom-migration/gpon/olt [master|…5] 
2.2 insure job is in the queue
$ (echo "status";sleep .1) | nc -w 1 localhost 4731
foo 1 0 0

3. repeat 2 to insure second job is also in the queue

4 let worker complete two queued jobs and stop  
$ gearman -h localhost -p 4731 -w -c 2 -f foo

In error case see gearmand logging which on default is on stdout.
If no error occurred improve your application
To unsubscribe from this group and stop receiving emails from it, send an email to gearman+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages