hjr3 / pecl-gearman

PHP wrapper to libgearman
Other
46 stars 24 forks source link

PHP7 support #12

Open oligriffiths opened 8 years ago

oligriffiths commented 8 years ago

Hi

Is there any plan for this?

Thanks

Oli

hotrush commented 8 years ago

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

vojta commented 8 years ago

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

IvixLabs commented 8 years ago

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

hjr3 commented 8 years ago

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

cc @wcgallego

jacobalberty commented 8 years ago

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

wcgallego commented 8 years ago

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.

asterixcapri commented 8 years ago

@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.

jacobalberty commented 8 years ago

@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

IvixLabs commented 8 years ago

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.

IvixLabs commented 8 years ago

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'];

wcgallego commented 8 years ago

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/

jacobalberty commented 8 years ago

Fixed the issues I was having.

asterixcapri commented 8 years ago

The fix works for me! Good job! :)

wcgallego commented 8 years ago

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

vincentdesmares commented 8 years ago

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

IvixLabs commented 8 years ago

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"
wcgallego commented 8 years ago

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!

IvixLabs commented 8 years ago

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.

acasademont commented 8 years ago

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

hjr3 commented 8 years ago

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

acasademont commented 8 years ago

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

hjr3 commented 8 years ago

@acasademont good idea. i will make one tonight

acasademont commented 8 years ago

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

vojta commented 8 years ago

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

I'm running Centos6, PHP 7.0.2

wcgallego commented 8 years ago

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

vojta commented 8 years ago

Details are here: https://github.com/wcgallego/pecl-gearman/issues/3

failCallback() is triggered instead of jobCallback()

acasademont commented 8 years ago

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 :(

wcgallego commented 8 years ago

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.

acasademont commented 8 years ago

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

oligriffiths commented 8 years ago

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

hjr3 commented 8 years ago

@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: https://github.com/hjr3/pecl-gearman/commit/2a20dcff243012532668dd92b2ca78914b83c352

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

oligriffiths commented 8 years ago

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 notifications@github.com 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

hjr3 commented 8 years ago

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

hjr3 commented 8 years ago

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

oligriffiths commented 8 years ago

Amazing, thanks Herman!

On 16 Mar 2016, at 18:55, Herman J. Radtke III notifications@github.com 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

sebastien-fauvel commented 8 years ago

@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!

acasademont commented 8 years ago

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

sebastien-fauvel commented 8 years ago

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?

acasademont commented 8 years ago

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
wcgallego commented 8 years ago

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.

tomahock commented 8 years ago

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!

sebastien-fauvel commented 8 years ago

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

oerdnj commented 8 years ago

@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.

wcgallego commented 8 years ago

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.

oligriffiths commented 8 years ago

@wcgallego Hows it looking on the worker exception?

wcgallego commented 8 years ago

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

oligriffiths commented 8 years ago

Awesome, thanks so much, great work!

sebastien-fauvel commented 8 years ago

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 -uuuid-f foo')... Works fine, too :)

oerdnj commented 8 years ago

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

punkeel commented 8 years ago

👍 please