0

I have a problem with beanstalkd on a symfony(3.4) project.

I have a symfony command used to analyse informations, the analyser is in a while true to keep the command running 24/7.

$pheanstalk = new Pheanstalk('127.0.0.1');

while (true) {
   $pheanstalk->watch($worker);
   $queue = $pheanstalk->statsTube($worker);
   if ($queue['current-jobs-ready'] > 0) {
      analyseInformations();
   else {
      //get the most charged worker...
   }

The problem that after X minutes, 5, 10 or 15, the command return exception : ORA-03135 Connection Lost

The dba said that the problem come from the symfony project and not the oracle database, i have missed anything with the beanstalkd connection ?

Beanstalkd have a timeout connection to the database ? Anything to do with the pool connection symfony ?

In the project we use doctrine dbal to make request to the database.

The exception message :

111:29:01 ERROR [console] Error thrown while running command "analyser". Message: "An exception occurred while executing 'SELECT XXX FROM XXX:

ORA-03113: end-of-file on communication channel ID de processus : 20624 ID de session : 154, Numéro de série : 6639"

Thank you

Community
  • 1
  • 1
Hussein
  • 53
  • 1
  • 6

1 Answers1

1

PHP isn't particularly well suited to long-running processes. I've run tens of millions of jobs through Beanstalkd, and hundreds of millions through other queuing systems, and will generally run the loop for some number of iterations (from 5 or 10 to several hundred or more), and then exit the script to have it clean up, and restart.

You can have whatever kicks off the script also arrange to restart it, init, upstart, supervisord or a shell script that is started from something like that.

I tend to prefer a shell script, because then I can return a specific value from the script, which is checked by the bash script, and then it can be acted upon. For one value, I can immediately restart (as planned), or pause for a moment, or if it's a another value, it may have been an unplanned exit, which would pause for a few seconds and log the issue.

Alister Bulman
  • 34,482
  • 9
  • 71
  • 110