Comments (17)
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.
I did the same as you but composer update didn't fix it. seems phpredis solves the issue
from bccresquebundle.
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.
Got the same for scheduled worker
from bccresquebundle.
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.
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.
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.
Er. Meant PHP-Resque-Scheduler there, actually.
from bccresquebundle.
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.
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.
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.
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.
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.
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.
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.
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.
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)
- New Relic transaction naming support for Jobs? HOT 1
- Event for failed jobs? HOT 3
- Cleanly shutdown Supervisor? HOT 2
- Dependent Jobs HOT 4
- Warn users of potential data loss
- call on getContainer() on class that extends ContainerAwareJob gives an error HOT 1
- Removing non responsive workers HOT 3
- new stable release HOT 12
- Cannot install from composer HOT 1
- autoload.php with supervisord HOT 2
- bcc:resque:worker-run commands
- supervisor - waiting for queue HOT 3
- How to get resque log in Monolog? HOT 3
- Scheduled worker - strlen expects parameter 1 to be string HOT 2
- Event kernel.terminate is not called hence SwiftMailer spool does not work HOT 2
- Allow to set *Kernel in bundle configuration
- Workers won't run (Windows) HOT 2
- Support for Symfony 3 HOT 5
- How can I set a Job priority HOT 7
- Supervisor processes are throwing exceptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bccresquebundle.