As Johannes suggested (thx!) I made a gearman_worker sapi:

http://github.com/thkoch2001/php-
src/tree/857657ddce9aad9709cc39832fb716555021725c/sapi/gearman_worker

(or http://tinyurl.com/gearmanworkersapi )

and linked the old code against it:

http://github.com/thkoch2001/gearman-php-worker/

It starts now, waits for tasks, but segfaults as soon as a task is received. 
Need to debug it tomorrow.

If anybody wants to guide me... :-) It seems that something with opening the 
script files goes wrong:

#0  0x00007ffff6ffd620 in ?? () from /lib/libc.so.6
#1  0x00007ffff6fff838 in malloc () from /lib/libc.so.6
#2  0x00007ffff7838c58 in __zend_malloc (ht=0x896ab0, arKey=0x61dc40 
"finfo_open", nKeyLength=11, h=13873911580025231368, pData=0x61dc60, 
nDataSize=232,
    pDest=0x7ffff48b79b0, flag=1) at /var/checkouts/php/Zend/zend_alloc.h:81
#3  _zend_hash_quick_add_or_update (ht=0x896ab0, arKey=0x61dc40 "finfo_open", 
nKeyLength=11, h=13873911580025231368, pData=0x61dc60, nDataSize=232,
    pDest=0x7ffff48b79b0, flag=1) at /var/checkouts/php/Zend/zend_hash.c:319
#4  0x00007ffff783910a in zend_hash_copy (target=0x896ab0, source=0x604030, 
pCopyConstructor=0, tmp=<value optimized out>, size=232)
    at /var/checkouts/php/Zend/zend_hash.c:786
#5  0x00007ffff782b338 in compiler_globals_ctor (compiler_globals=0x896840, 
tsrm_ls=0x848650) at /var/checkouts/php/Zend/zend.c:494
#6  0x00007ffff77c9ba3 in allocate_new_resource 
(thread_resources_ptr=0x603138, thread_id=140737296173392) at 
/var/checkouts/php/TSRM/TSRM.c:294
#7  0x00007ffff77c9d1c in ts_resource_ex (id=0, th_id=<value optimized out>) 
at /var/checkouts/php/TSRM/TSRM.c:361
#8  0x0000000000401525 in runPHP (scriptName=0x849b45 "test.php") at 
worker.c:60
#9  0x000000000040163c in runJob (job=0x849a40, cb_arg=0x0, 
result_size=0x8492b0, ret_ptr=0x7ffff48b809c) at worker.c:96
#10 0x00007ffff72f40a4 in gearman_worker_work (worker=0x8492a0) at 
worker.c:593
#11 0x000000000040176e in workerThreadFunction (workerPointer=0x8492a0) at 
worker.c:135
#12 0x00007ffff6d74faa in start_thread () from /lib/libpthread.so.0
#13 0x00007ffff705729d in clone () from /lib/libc.so.6
#14 0x0000000000000000 in ?? ()

> For making development simple you might link such code against the embed
> sapi (and ignore php_embed.[ch]) at least the plumbing code should be
> moved into php-src/sapi/gearman or something and properly built without
> embed dependency.
>
> johannes
Thomas Koch, http://www.koch.ro

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to