wa0x6e / Cake-Resque

Resque plugin for CakePHP : for creating background jobs that can be processed offline later
MIT License
159 stars 56 forks source link

second execution of worker not load models correctly #81

Open poldotz opened 9 years ago

poldotz commented 9 years ago

Hi, first of all, sorry for my english and thank you for this wonderful plugin. I have this issue: In a worker, the first execution go ok, the second execution instead breaks:

I receive this warning when I do a find('all') with callbacks set to true:

all_user_func_array() expects parameter 1 to be a valid callback, class 'JsonableBehavior' does not have a method '1' in [...../vendor/cakephp/cakephp/lib/Cake/Utility/ObjectCollection.php.

And in the daily log this info:

IGPIPE received; attempting to reconnect.

thank you in advance.

Leonardo.

wa0x6e commented 9 years ago

What is you php version ? Cake version ? Do you have a sample of the job ?

By second execution, do you mean queueing the job again with the same payload ? Or is there a loop somewhere ?

irongomme commented 9 years ago

It is the same for me :

php5.3 cake 2.2.3

The first task enqueued works fine, but then, i've got :

[2015-09-02 18:09:27] main.INFO: got {"queue":"default","id":"2945b813293287f9436e30c09a0c147e","class":"BziiitShell","args":[["notify"]]} {"type":"got","args":"[object] (Resque_Job: {\"queue\":\"default\",\"id\":\"2945b813293287f9436e30c09a0c147e\",\"class\":\"BziiitShell\",\"args\":[[\"notify\"]]})","worker":"jerome-linux.e-wi.org:20647"} []
[2015-09-02 18:09:27] main.INFO: Processing ID:2945b813293287f9436e30c09a0c147e in default {"type":"process","worker":"jerome-linux.e-wi.org:20647","job_id":"2945b813293287f9436e30c09a0c147e"} []
[2015-09-02 18:09:27] main.INFO: SIGPIPE received; attempting to reconnect {"type":"reconnect","worker":"jerome-linux.e-wi.org:20647"} []
[2015-09-02 18:09:27] main.ERROR: {"queue":"default","id":"2945b813293287f9436e30c09a0c147e","class":"BziiitShell","args":[["notify"]]} failed: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away {"type":"fail","log":"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away","job_id":"2945b813293287f9436e30c09a0c147e","time":25,"worker":"jerome-linux.e-wi.org:20647"} []
wa0x6e commented 9 years ago

@irongomme the error seems obvious in your case

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Worker is just forking your cake app and running it with an infinite loop, so ensure that your msyql server does not close long polling connection

irongomme commented 9 years ago

Ok i've found it, this was a conflict with another plugin (DatabaseLogger)