Git Product home page Git Product logo

Comments (84)

hjr3 avatar hjr3 commented on August 27, 2024 6

@wcgallego Sorry, I don't think I got the message. Happy to add you as a contributor.

@till thanks for helping 😄

I can create a PR right from master...wcgallego:2.0.1 if that sounds good to people too.

from pecl-gearman.

acasademont avatar acasademont commented on August 27, 2024 4

I think it's even more convenient without git at all. This is my script for debian jessie

wget https://github.com/wcgallego/pecl-gearman/archive/master.zip
unzip master.zip
cd pecl-gearman-master
phpize
./configure
make install
echo "extension=gearman.so" > /etc/php/mods-available/gearman.ini
phpenmod -v ALL -s ALL gearman
service php7.0-fpm restart

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024 1

@oligriffiths The do method name is a reserved word in PHP. Before I released 1.0.0, I deprecated those method names. In master, those method names were removed: 2a20dcf

Per http://php.net/manual/en/gearmanclient.do.php the new method was moved to http://php.net/manual/en/gearmanclient.donormal.php

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024 1

The only reports I've heard of lasting exceptions are for Symfony users. I'm not one of them! So digging into that code (while not doing the work stuff I'm normally doing!) has been an effort into simplifying an example case.

We've been successful at Etsy using the Gearman pecl lib in production for PHP 7 with no lingering issues, but of course I'd like to clean this up for others. If you're not a Symfony user, this should be stable enough to put into production.

That said, as always, if you see an issue please let me know! Still working on this so I can cut a tag

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024 1

We're still actively using it over here and I hate making you middle man for these changes :\ And it seems lame that you've fallen into the "not it!" situation of being last to touch.

I'm happy to keep up maintenance of the extension for the time being

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024 1

Maybe @pierrejoye and folks would allow us to move this into https://github.com/FriendsOfPHP ?

I also received an email today to get a new version into pecl too.

from pecl-gearman.

hotrush avatar hotrush commented on August 27, 2024

+1 let us know, wait or migrate to something other

from pecl-gearman.

vojta avatar vojta commented on August 27, 2024

Maybe this could help you: https://github.com/wcgallego/pecl-gearman/

from pecl-gearman.

IvixLabs avatar IvixLabs commented on August 27, 2024

I got Segmentation fault: 11 with https://github.com/wcgallego/pecl-gearman/.
Project works fine on php 5.6 with gearman on Debian and Mac OS X.
Waiting support php 7.0.
+1

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

I am not sure if that branch is completely up to date. Please see https://twitter.com/wcgallego/status/672248988163248128

cc @wcgallego

from pecl-gearman.

jacobalberty avatar jacobalberty commented on August 27, 2024

@IvixLabs are you using an anonymous function or a named function in the code you're getting a Segmentation fault in?

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

Hi @IvixLabs , can you give some details on the failure here? Code examples would great, and a core dump even better if you have one.

from pecl-gearman.

asterixcapri avatar asterixcapri commented on August 27, 2024

@wcgallego seems that the segmentation fault is caused by anonymous function with inherited variables:

<?php
$worker = new \GearmanWorker();
$worker->addServer("127.0.0.1", 4730);

$function_name = "Foo";

$worker->addFunction($function_name, function(\GearmanJob $job) use ($function_name) {
    echo $function_name."\n";
    return true;
});

while ($worker->work()) {
}
<?php

$client = new \GearmanClient();
$client->addServer("127.0.0.1", 4730);
$client->doBackground("Foo", "workload");

Removing use ($function_name) everything is fine.

from pecl-gearman.

jacobalberty avatar jacobalberty commented on August 27, 2024

@asterixcapri just to stir the pot a little more anonymous functions in general with the php 7 gearman are having issues even the demo for sending mail from http://gearman.org/examples/send-emails/ crashes on the json_decode line, using (un)serialize produces similar albeit not exactly the same, the workaround im using is to use named functions for now.

Edit: just to give credit where its due the information is from wcgallego

from pecl-gearman.

IvixLabs avatar IvixLabs commented on August 27, 2024

I use https://github.com/mmoreram/GearmanBundle for working with gearman i am not sure how implemented callback inside.

When will be time i try learn more.

from pecl-gearman.

IvixLabs avatar IvixLabs commented on August 27, 2024

I found follow code

    /**
     * Wrapper function handler for all registered functions
     * This allows us to do some nice logging when jobs are started/finished
     *
     * @see https://github.com/brianlmoon/GearmanManager/blob/ffc828dac2547aff76cb4962bb3fcc4f454ec8a2/GearmanPeclManager.php#L95-206
     *
     * @param \GearmanJob $job
     * @param mixed $context
     *
     * @return mixed
     */
    public function handleJob(\GearmanJob $job, $context)
    {
        var_dump('Step 1');
        var_dump(array_keys($context));
        $mehod = $context['job_method'];
        var_dump('Step 2');
        var_dump($context['job_method']);
        var_dump('Step 3');
        if (
            !is_array($context)
            || !array_key_exists('job_object_instance', $context)
            || !array_key_exists('job_method', $context)
        ) {
            throw new \InvalidArgumentException('$context shall be an array with job_object_instance and job_method key.');
        }

        $event = new GearmanWorkStartingEvent($context['jobs']);
        $this->eventDispatcher->dispatch(GearmanEvents::GEARMAN_WORK_STARTING, $event);


        $result = call_user_func_array(
            array($context['job_object_instance'], $context['job_method']),
            array($job, $context)
        );

        /**
         * Workaround for PECL bug #17114
         * http://pecl.php.net/bugs/bug.php?id=17114
         */
        $type = gettype($result);
        settype($result, $type);

        return $result;
    }

in output:

array(3) {
  [0] =>
  string(19) "job_object_instance"
  [1] =>
  string(10) "job_method"
  [2] =>
  string(4) "jobs"
}
Segmentation fault: 11

It means Segmentation fault: 11 on $mehod = $context['job_method'];

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

Hey All,

I just pushed a change out which should in theory fix this. Looks like I wasn't copying over some zvals correctly. They weren't out of scope yet, so they weren't being cleaned up, except I think the Closure was probably doing some clean up assuming there wasn't an added reference to it.

If you could run your own code against this to test and confirm, It'd be much appreciated. Code should be in my github repo here: https://github.com/wcgallego/pecl-gearman/

from pecl-gearman.

jacobalberty avatar jacobalberty commented on August 27, 2024

Fixed the issues I was having.

from pecl-gearman.

asterixcapri avatar asterixcapri commented on August 27, 2024

The fix works for me! Good job! :)

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

Thanks for the eyes and for the patience everyone! Happy to tackle more issues as they come in

from pecl-gearman.

vincentdesmares avatar vincentdesmares commented on August 27, 2024

Good work! I can't wait to move to 7.0.

from pecl-gearman.

IvixLabs avatar IvixLabs commented on August 27, 2024

I have same error is what i wrote above.
I develop on Mac OS X using brew maybe for me problem in other place there is my installation steps:
Maybe problem in make step have some warnings.

bash-3.2$ git clone https://github.com/wcgallego/pecl-gearman.git
Cloning into 'pecl-gearman'...
remote: Counting objects: 520, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 520 (delta 1), reused 0 (delta 0), pack-reused 514
Receiving objects: 100% (520/520), 395.85 KiB | 75.00 KiB/s, done.
Resolving deltas: 100% (323/323), done.
Checking connectivity... done.
bash-3.2$ cd ./pecl-gearman/
bash-3.2$ php -v
PHP 7.0.0 (cli) (built: Dec  2 2015 13:06:23) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.4.0RC2, Copyright (c) 2002-2015, by Derick Rethans
bash-3.2$ phpize 
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
bash-3.2$ ./configure 
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin15.0.0
checking host system type... x86_64-apple-darwin15.0.0
checking target system type... x86_64-apple-darwin15.0.0
checking for PHP prefix... /usr/local/Cellar/php70/7.0.0
checking for PHP includes... -I/usr/local/Cellar/php70/7.0.0/include/php -I/usr/local/Cellar/php70/7.0.0/include/php/main -I/usr/local/Cellar/php70/7.0.0/include/php/TSRM -I/usr/local/Cellar/php70/7.0.0/include/php/Zend -I/usr/local/Cellar/php70/7.0.0/include/php/ext -I/usr/local/Cellar/php70/7.0.0/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/Cellar/php70/7.0.0/lib/php/extensions/no-debug-non-zts-20151012
checking for PHP installed headers prefix... /usr/local/Cellar/php70/7.0.0/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable gearman support... yes, shared
found in /usr/local
checking for gearman_client_set_context in -lgearman... yes
checking for gearman_worker_set_server_option in -lgearman... yes
checking for gearman_job_error in -lgearman... yes
checking for gearman_client_unique_status in -lgearman... yes
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin15.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
bash-3.2$ make
/bin/sh /Users/ivix/app/pecl-gearman/libtool --mode=compile cc  -I. -I/Users/ivix/app/pecl-gearman -DPHP_ATOM_INC -I/Users/ivix/app/pecl-gearman/include -I/Users/ivix/app/pecl-gearman/main -I/Users/ivix/app/pecl-gearman -I/usr/local/Cellar/php70/7.0.0/include/php -I/usr/local/Cellar/php70/7.0.0/include/php/main -I/usr/local/Cellar/php70/7.0.0/include/php/TSRM -I/usr/local/Cellar/php70/7.0.0/include/php/Zend -I/usr/local/Cellar/php70/7.0.0/include/php/ext -I/usr/local/Cellar/php70/7.0.0/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2 -Wall   -c /Users/ivix/app/pecl-gearman/php_gearman.c -o php_gearman.lo 
mkdir .libs
 cc -I. -I/Users/ivix/app/pecl-gearman -DPHP_ATOM_INC -I/Users/ivix/app/pecl-gearman/include -I/Users/ivix/app/pecl-gearman/main -I/Users/ivix/app/pecl-gearman -I/usr/local/Cellar/php70/7.0.0/include/php -I/usr/local/Cellar/php70/7.0.0/include/php/main -I/usr/local/Cellar/php70/7.0.0/include/php/TSRM -I/usr/local/Cellar/php70/7.0.0/include/php/Zend -I/usr/local/Cellar/php70/7.0.0/include/php/ext -I/usr/local/Cellar/php70/7.0.0/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -Wall -c /Users/ivix/app/pecl-gearman/php_gearman.c  -fno-common -DPIC -o .libs/php_gearman.o
/Users/ivix/app/pecl-gearman/php_gearman.c:75:24: warning: unused variable 'arginfo_gearman_task_context' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_task_context, 0, 0, 1)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:307:24: warning: unused variable 'arginfo_oo_gearman_client_options' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_options, 0, 0, 0)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:315:24: warning: unused variable 'arginfo_oo_gearman_client_set_options' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_set_options, 0, 0, 1)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:324:24: warning: unused variable 'arginfo_oo_gearman_client_add_options' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_options, 0, 0, 1)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:333:24: warning: unused variable 'arginfo_oo_gearman_client_remove_options' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_remove_options, 0, 0, 1)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:537:24: warning: unused variable 'arginfo_oo_gearman_client_add_task_low' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_task_low, 0, 0, 2)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:552:24: warning: unused variable 'arginfo_oo_gearman_client_add_task_background' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_task_background, 0, 0, 2)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:567:24: warning: unused variable 'arginfo_oo_gearman_client_add_task_high_background' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_task_high_background, 0, 0, 2)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:582:24: warning: unused variable 'arginfo_oo_gearman_client_add_task_low_background' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_task_low_background, 0, 0, 2)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
/Users/ivix/app/pecl-gearman/php_gearman.c:589:24: warning: unused variable 'arginfo_gearman_client_add_task_status' [-Wunused-const-variable]
ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_add_task_status, 0, 0, 2)
                       ^
/usr/local/Cellar/php70/7.0.0/include/php/Zend/zend_API.h:118:38: note: expanded from macro 'ZEND_BEGIN_ARG_INFO_EX'
        static const zend_internal_arg_info name[] = { \
                                            ^
10 warnings generated.
/bin/sh /Users/ivix/app/pecl-gearman/libtool --mode=link cc -DPHP_ATOM_INC -I/Users/ivix/app/pecl-gearman/include -I/Users/ivix/app/pecl-gearman/main -I/Users/ivix/app/pecl-gearman -I/usr/local/Cellar/php70/7.0.0/include/php -I/usr/local/Cellar/php70/7.0.0/include/php/main -I/usr/local/Cellar/php70/7.0.0/include/php/TSRM -I/usr/local/Cellar/php70/7.0.0/include/php/Zend -I/usr/local/Cellar/php70/7.0.0/include/php/ext -I/usr/local/Cellar/php70/7.0.0/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2 -Wall   -o gearman.la -export-dynamic -avoid-version -prefer-pic -module -rpath /Users/ivix/app/pecl-gearman/modules  php_gearman.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lgearman -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lgearman -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lgearman -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lgearman
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/gearman.so -bundle  .libs/php_gearman.o  -L/usr/local/lib -lgearman  -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib
dsymutil .libs/gearman.so || :
creating gearman.la
(cd .libs && rm -f gearman.la && ln -s ../gearman.la gearman.la)
/bin/sh /Users/ivix/app/pecl-gearman/libtool --mode=install cp ./gearman.la /Users/ivix/app/pecl-gearman/modules
cp ./.libs/gearman.so /Users/ivix/app/pecl-gearman/modules/gearman.so
cp ./.libs/gearman.lai /Users/ivix/app/pecl-gearman/modules/gearman.la
----------------------------------------------------------------------
Libraries have been installed in:
   /Users/ivix/app/pecl-gearman/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

bash-3.2$ cp ./modules/gearman.so /usr/local/gearman/gearman.so 
bash-3.2$ php -i | grep gearman
/usr/local/etc/php/7.0/conf.d/ext-gearman.ini,
gearman
gearman support => enabled
libgearman version => 1.1.12
PWD => /Users/ivix/app/pecl-gearman
$_SERVER['PWD'] => /Users/ivix/app/pecl-gearman
bash-3.2$ cat /usr/local/etc/php/7.0/conf.d/ext-gearman.ini 
[gearman]
extension="/usr/local/php70-gearman/gearman.so"

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

Hi @IvixLabs,

I need to do some more clean up to get rid of those warnings, but they shouldn't be contributing to the segfault. Just to confirm, you're using the latest version from my repo from a few days ago, correct?

If you could distill down the code outside of the GearmanManager code, that would be helpful in speeding up finding where the problem lies. I'll keep looking at it from my end. Thanks!

from pecl-gearman.

IvixLabs avatar IvixLabs commented on August 27, 2024

I try reproduce seg fault with more simple code seem it works ok except one case and maybe it related to my problem.

test_worker.php

<?php

class JobHandler
{

    public function handleJob(GearmanJob $job)
    {
        $data = $job->workload();
        $this->logInfo($data);
        return 'success';
    }

    private function logInfo($message)
    {
        var_dump($message);
    }

}

class GearmanManager
{

    private $worker;

    /**
     * GearmanManager constructor.
     */
    public function __construct()
    {
        $this->worker = new GearmanWorker();
        $this->worker->addServer('127.0.0.1', 4730);
    }

    public function addJob($instance, $methodName)
    {
        $context = [
            'job_method' => $methodName,
            //'job_object_instance' => $instance
        ];

        $this->worker->addFunction("test_fun", array($this, 'handleJob'), $context);

        $this->worker->work();
    }

    public function handleJob(\GearmanJob $job, $context)
    {
        if (
            !is_array($context)
            || !array_key_exists('job_object_instance', $context)
            || !array_key_exists('job_method', $context)
        ) {
            var_dump('step2');
            throw new \InvalidArgumentException('$context shall be an array with job_object_instance and job_method key.');
        }

        $result = call_user_func_array(
            array($context['job_object_instance'], $context['job_method']),
            array($job, $context)
        );

        return $result;
    }
}


$jobHandler = new JobHandler();

$manager = new GearmanManager();
$manager->addJob($jobHandler, 'handleJob');

test_client.php

<?php

$client = new GearmanClient();
$client->addServer('127.0.0.1', 4730);

$result = $client->doNormal('test_fun', 'Hello');
var_dump($result);

output:

string(5) "step2"
Illegal instruction: 4

It means on place where it throws exception i have "Illegal instruction: 4".

But in my base code no exception.

Maybe problem in mac os x.
I will try learn more.

from pecl-gearman.

acasademont avatar acasademont commented on August 27, 2024

would be nice to have this 7.0 branch on the Pecl repos too!

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@acasademont there is no actual release yet. when @wcgallego tags a release, we can put it up on PECL

from pecl-gearman.

acasademont avatar acasademont commented on August 27, 2024

@hjr3 what about a "beta" release on PECL? That would make it easier for people to test

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@acasademont good idea. i will make one tonight

from pecl-gearman.

acasademont avatar acasademont commented on August 27, 2024

nice! btw, so far no problems at all with PHP7 and the extension :)

from pecl-gearman.

vojta avatar vojta commented on August 27, 2024

I've found an issue with GearmanJob::setCompleteCallback() - could you please try to reproduce it? wcgallego/pecl-gearman#3

I'm running Centos6, PHP 7.0.2

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

thanks, vojta, can you give some details about it?

from pecl-gearman.

vojta avatar vojta commented on August 27, 2024

Details are here: wcgallego/pecl-gearman#3

failCallback() is triggered instead of jobCallback()

from pecl-gearman.

acasademont avatar acasademont commented on August 27, 2024

someone with enough PHP extensions knowledge maybe can help @wcgallego? We're seeing lots of segfaults with the latest master, the one I fetched on January was working much better :(

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

hey @acasademont, just to confirm, have you grabbed recent versions from my repo?

I was trying to sort out the seg fault about a week ago or so but wasn't able to reproduce. @vojta did comment on it I think a day or two ago, but I don't immediately have the bandwidth to look right now. If you have a test case you can paste, that would go a long way! Thanks.

from pecl-gearman.

acasademont avatar acasademont commented on August 27, 2024

Yes, In my machine I had a version from January 24th, working fine, from yesterday's master it's not. It's a really big app, will be difficult to provide a simple test case...I will try though

from pecl-gearman.

oligriffiths avatar oligriffiths commented on August 27, 2024

Hey @acasademont. Just built your branch and tried to run the examples. It appears GearmanClient::do does not exist. Any ideas?

Fatal error: Uncaught Error: Call to undefined method GearmanClient::do() in /home/oli/pecl-gearman/examples/reverse_client.php:30

from pecl-gearman.

oligriffiths avatar oligriffiths commented on August 27, 2024

Gotcha.

Yeah I found if I updated the examples it all works as expected :)

Thanks

On 16 Mar 2016, at 12:18, Herman J. Radtke III [email protected] wrote:

@oligriffiths The do method name is a reserved word in PHP. Before I released 1.0.0, I deprecated those method names. In master, those method names were removed: 2a20dcf

Per http://php.net/manual/en/gearmanclient.do.php the new method was moved to http://php.net/manual/en/gearmanclient.donormal.php


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@oligriffiths I totally missed that the Examples are using the deprecated methods. I will fix.

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

I updated the basic example to use doNormal instead of do.

from pecl-gearman.

oligriffiths avatar oligriffiths commented on August 27, 2024

Amazing, thanks Herman!

On 16 Mar 2016, at 18:55, Herman J. Radtke III [email protected] wrote:

I updated the basic example to use doNormal instead of do.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

from pecl-gearman.

sebastien-fauvel avatar sebastien-fauvel commented on August 27, 2024

@wcgallego is it correct that your master branch on https://github.com/wcgallego/pecl-gearman is where most work is being done regarding this php7 upgrade? Have you already contacted the pecl team to make a beta release there? Is it kind of working already? Any updates are very appreciated!

from pecl-gearman.

acasademont avatar acasademont commented on August 27, 2024

yes @sebastien-fauvel right now master seems to be working quite well, already using it in production with php7

from pecl-gearman.

sebastien-fauvel avatar sebastien-fauvel commented on August 27, 2024

Thanks for the timely reply :) How do you install it in production without pecl? Just like this:

git clone https://github.com/wcgallego/pecl-gearman.git
cd pecl-gearman
${ROOT_DIR}/php7/bin/phpize -clean
./configure --with-php-config=${ROOT_DIR}/php7/bin/php-config
make install

then create ${ROOT_DIR}/etc/php7/conf.d/gearman.ini and restart php7? Or is there one more step beforehand to prepare things after cloning the repo?

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

hey all,

I can cut a branch next week. I'd like to give it a few more days as we've only just had some annoying seg faults that were lingering squashed and I'd like to give a little more burn in time.

I'll be AFK on PTO until next week as well, so apologies but I won't be in communication range.

from pecl-gearman.

tomahock avatar tomahock commented on August 27, 2024

Hi @wcgallego i'm having seg faults also:

PHP 7.0.4
Debian 7.8

kernel: [13843159.704321] php[25604]: segfault at 0 ip 00007f9a5c714f28 sp 00007fff9ad95c00 error 6 in gearman.so[7f9a5c708000+16000]

thanks!

from pecl-gearman.

sebastien-fauvel avatar sebastien-fauvel commented on August 27, 2024

Hi guys, when you talk about segfaults, do you mean in the client or in the worker, or both?

from pecl-gearman.

oerdnj avatar oerdnj commented on August 27, 2024

@hjr3 @wcgallego folks, how is it looking (Debian PHP maintainer here). I would really appreciate if you could tag a version and upload it to PECL, so I can check yet another extension on my PHP5->PHP7 list.

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

I'd love to as well, @oerdnj! There's a handful of issues I'm trying to close out in my fork of the repo, the biggest one being the Gearman Worker exception. I've just gotten back into work after PTO, so as you know it's always trying to play catch up :)

I'm poking at this now and once that is ironed out I think we'd be in a position to cut a tag.

from pecl-gearman.

oligriffiths avatar oligriffiths commented on August 27, 2024

@wcgallego Hows it looking on the worker exception?

from pecl-gearman.

oligriffiths avatar oligriffiths commented on August 27, 2024

Awesome, thanks so much, great work!

from pecl-gearman.

sebastien-fauvel avatar sebastien-fauvel commented on August 27, 2024

Glad to hear that, we'll give it a try at Darwin Pricing, too! In the meanwhile, we had even fallen back to the CLI tools to queue background jobs with exec('gearman -b -u uuid -f foo')... Works fine, too :)

from pecl-gearman.

oerdnj avatar oerdnj commented on August 27, 2024

I also already gave it a spin and uploaded the current git to Debian unstable.

from pecl-gearman.

punkeel avatar punkeel commented on August 27, 2024

👍 please

from pecl-gearman.

dmitriivoitovich avatar dmitriivoitovich commented on August 27, 2024

@wcgallego Hello! Can you please clarify why the interface of your GearmanClient is so different from the one described in official documentation? For example there are a bunch of methods that now require a client_object as the first argument (http://php.net/manual/en/gearmanclient.setoptions.php):

options
setOptions
addOptions
removeOptions
addTaskLow
addTaskBackground
addTaskHighBackground
addTaskLowBackground
setWarningCallback

Parameter #0 [ <required> $client_object ]

That's rather weird I think, and also generates a lot of troubles with already existing code.

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

@dmitriivoitovich This would be a better question set up as an issue on my branch of the code, so as to clarify threads and not pollute them with several problems.

The documentation hasn't always been the best on php.net for Gearman. Can you confirm the difference between PHP 5.x and PHP 7? Could've simply been a porting mistake.

from pecl-gearman.

dmitriivoitovich avatar dmitriivoitovich commented on August 27, 2024

@wcgallego Thanks for your feedback! I've opened a new issue wcgallego/pecl-gearman#22
Please correct me if I did something wrong

from pecl-gearman.

relaxnow avatar relaxnow commented on August 27, 2024

Hi @wcgallego there still is no version on Pecl that supports PHP7, could you add it? Anything we users can do?

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

Hey All,

As said in previous thread, sorry, life got in the way of code!

I've tagged 2.0.1 branch on github.com/wcgallego/pecl-gearman but I've never gotten any versions on Pecl proper, so the tango to do so is unknown to me. Happy to help get this up there! Also, thanks again for massive patience on this, it's really appreciated.

from pecl-gearman.

sebastien-fauvel avatar sebastien-fauvel commented on August 27, 2024

Maybe contact the maintainers? According to pecl, the project leads are:

James Luedke [email protected]
Herman Radtke [email protected]

from pecl-gearman.

till avatar till commented on August 27, 2024

@wcgallego did you send a PR somewhere?

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

I think this repo is about as official as it gets. Happy to merge in but I did contact hjr off thread

from pecl-gearman.

till avatar till commented on August 27, 2024

@wcgallego yeah, sorry. That was my the point. Can you send one to this repo so we can merge it? I can help with the pecl stuff if required. I can help track down @hjr3. :)


Sorted of related, maybe @hjr3 wants to add you as a contributor? ;)

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

Sure, I can do the contributor thing if it's easiest. Thanks!

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

There is an open segfault issue that has a PHP 7 report. #15 (comment)

Has anyone else seen this?

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

I have not, but it looks like the thread has closed. They also were not using the latest version, 2.0.1

@hjr3 - Were you planning on contributing more to the extension? We can certainly collaborate here, but most of the work has been on my branch and seems like has been the focus of PHP 7 dev

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@wcgallego they closed it as I mentioned it here. Good call about not using the latest version.

I was supporting this extension through work, but we are not actively using gearman anymore. I have no problems if you want to make your repo this official pecl/gearman one going forward. I can update the README and other things if that helps as well.

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@wcgallego Ya, the PHP core team never setup official pecl repos 😒

from pecl-gearman.

till avatar till commented on August 27, 2024

@wcgallego @hjr3 maybe create a pecl-gearman org and put it there? That way it's not tied to anyone's account and you can add contributors, etc..

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@wcgallego picking up from gearman/gearmand#62 (comment) I have reached out to @Tyrael about getting a pecl-gearman repo at github.com/php

from pecl-gearman.

Tyrael avatar Tyrael commented on August 27, 2024

hi, should I create an empty repo on git.php.net(which will be mirrored to github.com/php) and you push whatever you want, or should I mirror this repository there?
is there anybody who will be a maintainer for this new repo and needs a php.net or pecl.php.net account or additional karma to be able to push to this new repository?
let me know and I will set up the repo there with the appropriate access/karma for you guys.

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@wcgallego any preference? How do you want to handle bug reports, issues, patches, etc?

from pecl-gearman.

Tyrael avatar Tyrael commented on August 27, 2024

I've just created the empty repo in the meantime, you can either tell me what to mirror there or you can do it for yourself.

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

hey all, sorry for delay. Being on call and a lack of sleep leaves little time for fun open source projects. Thanks for patience.

I can continue maintaining the project for sure. That said, rather than make it one person's project, I'd love to have it hosted apart from one of our personal github accounts. I've got a php.net account, but only have karma I believe for documentation, dunno if that's covering pushing to this repo.

What can I do to help? Thanks for getting this set up.

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@wcgallego It sounds like we can only mirror to the https://github.com/php/pecl-networking-gearman repo. We can make a pecl-gearman github org and have pecl-gearman/pecl-gearman by the central repository for PRs, issues, etc.

You need a pecl.php.net account to manage the package at https://pecl.php.net/package/gearman . We can handle that, but we need to get the above figured out prior to posting a new package.

from pecl-gearman.

Tyrael avatar Tyrael commented on August 27, 2024

yeah, we only have mirrors under the php github organization, the primary repositories are on https://git.php.net/ and pushes are mirrored to the github mirrors.

from pecl-gearman.

rwngallego avatar rwngallego commented on August 27, 2024

How can we get the rpm package for the Centos PHP 7.1 version?

from pecl-gearman.

vojta avatar vojta commented on August 27, 2024

@rwngallego it's already in the Remi repo:

Available Packages
php71-php-pecl-gearman.x86_64 2.0.3-1.el6.remi remi

from pecl-gearman.

kwhat avatar kwhat commented on August 27, 2024

So the src for the remi rpm package is https://github.com/wcgallego/pecl-gearman can someone update this officially?

from pecl-gearman.

pierrejoye avatar pierrejoye commented on August 27, 2024

from pecl-gearman.

hjr3 avatar hjr3 commented on August 27, 2024

@pierrejoye if you can create the repo and give myself and @wcgallego commit bit, then I will do the work to make that the official repo.

from pecl-gearman.

pierrejoye avatar pierrejoye commented on August 27, 2024

from pecl-gearman.

RossiRun avatar RossiRun commented on August 27, 2024

i got a memory leak while i use php7.0.5 debug version and valgrind to check memory leak.
pecl-gearman-master/php_gearman.c(892) : Freeing 0x7F81E8C7A000 (687 bytes).
@rwngallego @wcgallego have you ever seen it ?
here is the detail
==24899== 687 bytes in 1 blocks are definitely lost in loss record 30 of 34
==24899== at 0x4C2817A: malloc (vg_replace_malloc.c:298)
==24899== by 0xA1934A: __zend_malloc (zend_alloc.c:2864)
==24899== by 0xA18584: _emalloc (zend_alloc.c:2457)
==24899== by 0xF789719: _php_malloc (php_gearman.c:892)
==24899== by 0xF9A5BFC: _client_do(gearman_client_st*, gearman_command_t, char const*, char const*, void const*, unsigned long, unsigned long*, gearman_return_t*) (client.cc:185)
==24899== by 0xF9A5DB7: gearman_client_do (client.cc:617)
==24899== by 0xF78CC48: gearman_client_do_work_handler (php_gearman_client.c:374)
==24899== by 0xF78CDCB: zif_gearman_client_do_normal (php_gearman_client.c:401)
==24899== by 0xAABF7F: ZEND_DO_FCALL_SPEC_HANDLER (zend_vm_execute.h:842)
==24899== by 0xAAAD78: execute_ex (zend_vm_execute.h:417)
==24899== by 0xAAAEA2: zend_execute (zend_vm_execute.h:458)
==24899== by 0xA4DDDE: zend_execute_scripts (zend.c:1443)
==24899==
==24899== LEAK SUMMARY:
==24899== definitely lost: 687 bytes in 1 blocks
==24899== indirectly lost: 0 bytes in 0 blocks
==24899== possibly lost: 0 bytes in 0 blocks
==24899== still reachable: 18,121 bytes in 58 blocks
==24899== suppressed: 0 bytes in 0 blocks
==24899== Reachable blocks (those to which a pointer was found) are not shown.

from pecl-gearman.

wcgallego avatar wcgallego commented on August 27, 2024

Hi @RossiRun, if you could, please create a new issue at https://github.com/wcgallego/pecl-gearman with the details above and the PHP code to replicate, so that we can narrow down issues

from pecl-gearman.

RossiRun avatar RossiRun commented on August 27, 2024

@wcgallego hi I just create an issue at https://github.com/wcgallego/pecl-gearman , please check~

from pecl-gearman.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.