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

Where's the pid files? #96

Open davidsteinsland opened 9 years ago

davidsteinsland commented 9 years ago

I've specified an alternate location of the pid files, and they are showing up in the commands:

PIDFILE='/var/www/releases/1446826801/tmp/resque/14468555833567'

No file with that path exists, nor does the logs contain any information as to why it doesn't. When no pid file exists, I cannot stop the workers via the console shell, I have to kill them manually.

On a second note, the LOGHANDLERTARGET is also set:

/var/www/releases/1446826801/tmp/logs/resque.log

This file doesn't exist either.

wa0x6e commented 9 years ago

Are you using capistrano or similar tools for deployment ?

davidsteinsland commented 9 years ago

Yes, I'm using DeployBot.

wa0x6e commented 9 years ago

Does deploybot have a shared folder ? Pid files should reside in a shared folder, so that file persists between deploy.

On Monday, 9 November 2015, David Steinsland notifications@github.com wrote:

Yes, I'm using DeployBot.

— Reply to this email directly or view it on GitHub https://github.com/wa0x6e/Cake-Resque/issues/96#issuecomment-155051177.

davidsteinsland commented 9 years ago

Yes, all that is taken care off.

wa0x6e commented 9 years ago

The tmp folder is shared between deployment ?

On Tuesday, 10 November 2015, David Steinsland notifications@github.com wrote:

Yes, all that is taken care off.

— Reply to this email directly or view it on GitHub https://github.com/wa0x6e/Cake-Resque/issues/96#issuecomment-155150131.

davidsteinsland commented 9 years ago

Again, yes. Permissions are OK. Problem is not with my setup. As I said initially, the processes are started with the correct environment variables. So any failure should be logged, and it isnt.

wa0x6e commented 8 years ago

Ca you post the full deployment log for DeployBot ?

mfn commented 8 years ago

@davidsteinsland

I've specified an alternate location of the pid files, and they are showing up in the commands:

You didn't mentioned it specifically, but if you mean CakeResque.Resque.tmpdir: I did a analysis recently and found out that these PID files are only very short lived and used to check if the worker properly started and are then removed from the file system:

  1. pidfile created
    https://github.com/wa0x6e/Cake-Resque/blob/3ea90434e478b24629d55d9aed43a2a5a4004a1d/src/Shell/CakeResqueShell.php#L825
  2. worker spawned
    https://github.com/wa0x6e/Cake-Resque/blob/3ea90434e478b24629d55d9aed43a2a5a4004a1d/src/Shell/CakeResqueShell.php#L860
  3. pidfile passed to _checkStartedWorker
    https://github.com/wa0x6e/Cake-Resque/blob/3ea90434e478b24629d55d9aed43a2a5a4004a1d/src/Shell/CakeResqueShell.php#L873
  4. in _checkStartedWorker: pidfile removed
    https://github.com/wa0x6e/Cake-Resque/blob/3ea90434e478b24629d55d9aed43a2a5a4004a1d/src/Shell/CakeResqueShell.php#L1072

Only within redis the PIDs are permanently persisted for the lifetime of a worker.