Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44978 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 447 invoked from network); 15 Jul 2009 17:48:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2009 17:48:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=thomas@koch.ro; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=thomas@koch.ro; sender-id=unknown Received-SPF: error (pb1.pair.com: domain koch.ro from 93.90.184.107 cause and error) X-PHP-List-Original-Sender: thomas@koch.ro X-Host-Fingerprint: 93.90.184.107 koch.ro Linux 2.6 Received: from [93.90.184.107] ([93.90.184.107:54910] helo=ve825703057.providerbox.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/73-18024-B761E5A4 for ; Wed, 15 Jul 2009 13:48:44 -0400 Received: from 84-72-56-244.dclient.hispeed.ch ([84.72.56.244] helo=jona.localnet) by ve825703057.providerbox.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1MR8as-0005EK-4X; Wed, 15 Jul 2009 19:48:38 +0200 Reply-To: thomas@koch.ro To: internals@lists.php.net Date: Wed, 15 Jul 2009 19:48:35 +0200 User-Agent: KMail/1.11.4 (Linux/2.6.29-1-amd64; KDE/4.2.4; x86_64; ; ) Cc: Johannes =?iso-8859-1?q?Schl=FCter?= , gearman References: <200907141928.20591.thomas@koch.ro> <1247597559.31771.24.camel@goldfinger.johannes.nop> In-Reply-To: <1247597559.31771.24.camel@goldfinger.johannes.nop> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200907151948.35958.thomas@koch.ro> Subject: Re: [PHP-DEV] Multithreaded C Gearman worker to run PHP scripts From: thomas@koch.ro (Thomas Koch) 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=, 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=) 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