Coder Social home page Coder Social logo

Comments (17)

hisem avatar hisem commented on May 28, 2024

I did a composer update today and installed the phpredis extension and now everything seems to work fine... Though I'm not sure which solved it.

from bccresquebundle.

al3d avatar al3d commented on May 28, 2024

I did the same as you but composer update didn't fix it. seems phpredis solves the issue

from bccresquebundle.

t3chn0r avatar t3chn0r commented on May 28, 2024

Had the same issue, I forgot to install the redis extension in php. Once installed everything worked fine, my guess is that the extension is needed for all these bundles to work.

If someone is wondering how to install this extension, I just ran these commands under Ubuntu server.

$ wget http://pecl.php.net/get/redis-2.2.4.tgz
$ tar xzf redis-2.2.4.tgz
$ cd redis-2.2.4
$ phpize
$ ./configure
$ make & make install

from bccresquebundle.

antonrubtsov avatar antonrubtsov commented on May 28, 2024

Got the same for scheduled worker

from bccresquebundle.

hisem avatar hisem commented on May 28, 2024

I got the same problem on another setup, and installing phpredis (see @t3chn0r 's comment) definitely solves the problem. I'm closing the issue.

from bccresquebundle.

Zowie avatar Zowie commented on May 28, 2024

Hi,

I still get this error after trying t3chn0r's solution.
I can start redis, and phpredis is installed and enabled in php.ini.

I have no clue how to fix this. I have tried some things with the code in Client.php but with no avail :(

This is what i see:

PHP Warning:  strlen() expects parameter 1 to be string, array given in /var/www/QP/vendor/colinmollenhour/credis/Client.php on line 771

var_dump:

array(2) {
  [0]=>
  string(6) "select"
  [1]=>
  int(0)
}
array(5) {
  [0]=>
  string(13) "zrangebyscore"
  [1]=>
  string(29) "resque:delayed_queue_schedule"
  [2]=>
  string(4) "-inf"
  [3]=>
  int(1401204889)
  ["limit"]=>
  array(2) {
    [0]=>
    int(0)
    [1]=>
    int(1)
  }
}

Any help would be appreciated!

from bccresquebundle.

danhunsaker avatar danhunsaker commented on May 28, 2024

Check the CLI version of your php.ini... Many distros use separate configurations for CLI and Apache/FPM/CGI, so it may only be enabled in one and not the other (it needs to be enabled in both). You'll also need to restart Apache (or PHP-FPM, if you're using that) and your worker(s), to make them load the new config.

There is a fixed version of Credis available and in use by the latest development version of PHP-Resque, but bleeding edge isn't the best choice most of the time, so the Composer dependencies haven't been updated in BCCResqueBundle to use it. So a Composer update wouldn't do any good, either.

from bccresquebundle.

danhunsaker avatar danhunsaker commented on May 28, 2024

Er. Meant PHP-Resque-Scheduler there, actually.

from bccresquebundle.

Zowie avatar Zowie commented on May 28, 2024

You're right, seeing phpinfo() with phpredis enabled threw me off

After running php -i, i noticed php used the php.ini in /etc/php5/cli.

Thanks :)

from bccresquebundle.

danhunsaker avatar danhunsaker commented on May 28, 2024

Common enough issue. As soon as PHP-Resque starts moving forward again, we'll add a note about it to the README. Perhaps that would be a good idea for the BBCResqueBundle guys to do as well? (cc: @michelsalib @ruudk @mrbase)

from bccresquebundle.

KeKs0r avatar KeKs0r commented on May 28, 2024

I know that installing phpredis would solve this issue, but I am currently on a infrastructure where this would be very timeconsuming task, if it is possible at all.

Did anybody find an alternative solution?

from bccresquebundle.

danhunsaker avatar danhunsaker commented on May 28, 2024

The only viable alternative is to get a more recent version of Credis pulled in. This particular bug has been fixed since the version requested by both PHP-Resque projects, if I recall correctly. This may be easier said than done, though, of course.

from bccresquebundle.

KeKs0r avatar KeKs0r commented on May 28, 2024

I updated Credis to 1.4 and dev-master, still had issues with my scheduled-workers. And one more question, are the scheduled workers not working anymore due to this issue? I have the feeling that my delayed jobs are not properly run, although this is just a php warning.

from bccresquebundle.

danhunsaker avatar danhunsaker commented on May 28, 2024

Alright, I've looked into the issue a bit further. Turns out that Credis and PHPRedis aren't entirely compatible. The way PHPRedis expects zrangebyscore arguments requires an array at the end to hold limits, but this array contains yet another array. Scheduler's code was updated to reflect this after moving from Redisent (which expected the arguments in sequence, with no arrays) to Credis. Normally, Credis flattens arrays it gets as arguments, but it rather naively only supports arrays one level deep, resulting in the original array('zrangebyscore', 'prefix:delayed_queue_schedule', '-inf', $time, array('limit' => array(0, 1))) being reduced to array('zrangebyscore', 'prefix:delayed_queue_schedule', '-inf', $time, 'limit' => array(0, 1)), rather than the more-desirable array('zrangebyscore', 'prefix:delayed_queue_schedule', '-inf', $time, 'limit', 0, 1) (though the logic doesn't properly handle keys versus indexes, either, so if it did support multi-level flattening, it would look more like array('zrangebyscore', 'prefix:delayed_queue_schedule', '-inf', $time, 'limit', 0, 0, 1, 1), which is also wrong).

The fix, without waiting for Credis to fix its flattening implementation, is to alter the code in ResqueScheduler.php to pass the arguments the old way instead of the PHPRedis way. Sadly, there isn't currently a decent alternative.

And yes, this bug does prevent your delayed jobs from running.

from bccresquebundle.

KeKs0r avatar KeKs0r commented on May 28, 2024

Thanks a lot for looking into this. I forked the original and included my fork into my project.

Whoever comes across the issue and needs a fork with only that issue fixed: https://github.com/KeKs0r/php-resque-scheduler

from bccresquebundle.

josephdpurcell avatar josephdpurcell commented on May 28, 2024

I ran into this issue and created #111, didn't realize it was a duplicate of this one.

My solution was:

sudo apt-get install php5-redis

from bccresquebundle.

danhunsaker avatar danhunsaker commented on May 28, 2024

I think there's a PR to check whether PHPRedis is installed/loaded, then to call zrangebyscore() using the arguments appropriate to whichever library will actually process the request. That's the actual best fix at the moment, though we don't like it.

On the other hand, I think there's also a PR (possibly already merged) that allows users to inject their own Redis library instead of using Credit in the first place. Not sure if Scheduler has a similar PR, but it really should.

from bccresquebundle.

Related Issues (20)

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.