Development

#3827 (sfCore::checkLock practicly doesn't work)

You must first sign up to be able to contribute.

Ticket #3827 (closed defect: fixed)

Opened 2 months ago

Last modified 4 weeks ago

sfCore::checkLock practicly doesn't work

Reported by: joohn Assigned to: fabien
Priority: minor Milestone: 1.0.17
Component: controller Version: 1.0.16
Keywords: sfCore, lock Cc:
Qualification: Accepted

Description

Function sfCore::checkLock calls sfToolkit::hasLockFile with time limit 5s. It doesn't make sense, because if user create custom lock file, it will work just for 5s and then application will be automatically unlocked.

Clear cache task deletes lock file when finished, so why not rely on that?

In my opinion the 97 line of sfCore should be as follows:

if(sfToolkit::hasLockFile(SF_ROOT_DIR.DIRECTORY_SEPARATOR.SF_APP.'_'.SF_ENVIRONMENT.'.lck','0'))

There is also a problem on Win2000 with FAT32 filesystem (and propably other FAT32 systems), because php function fileatime() returns not accurate date - just year month and day without hours,minutes and seconds.

I have Symfony version 1.0.17 PRE from SVN.

Change History

06/25/08 15:18:56 changed by FabianLange

sounds like #3598

06/26/08 10:48:14 changed by joohn

Yes, this is the same issue. I searched for 'lock' and couldn't find anything.

06/26/08 13:43:15 changed by FabianLange

  • version set to 1.0.16.
  • qualification changed from Unreviewed to Accepted.

r9890 has a fix for 1.1

06/26/08 14:12:49 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [9893]) fixed locking issues with the clear-cache, log-rotate, enable, and disable tasks (closes #3827)

06/27/08 14:58:16 changed by FunkyM

  • status changed from closed to reopened.
  • resolution deleted.

Application disable behaviour is still broken due to the changes causing a regression. "symfony disable <app> <env>" does no longer work.

This is caused due to a missing update of "lib/vendor/symfony/lib/controller/sfController.class.php" in line 177:

...
if (!sfConfig::get('sf_available') || sfToolkit::hasLockFile($rootDir.'/'.$app.'_'.$env.'.clilock'))
...

With r9893, "frontend_dev.lck" is created on "symfony disable frontend dev" thus failing to pass the locked state requirement above.

06/27/08 18:25:50 changed by fabien

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [9940]) fixed typo (closes #3827)

07/02/08 11:14:16 changed by medick

  • status changed from closed to reopened.
  • resolution deleted.

After all those changes I have errors in CLI:

D:\www\myproject>symfony cc
>> file+     D:\www\myproject/backend_dev-cli.lck
>> chmod 777 \D:\www\myproject/backend_dev-cli.lck

Warning: chmod(): No such file or directory in D:\www\symfony\lib\vendor\pake\pa
keFunction.php on line 273
>> file-     D:\www\myproject/backend_dev-cli.lck
>> file+     D:\www\myproject/frontend_dev-cli.lck
>> chmod 777 \D:\www\myproject/frontend_dev-cli.lck

Warning: chmod(): No such file or directory in D:\www\symfony\lib\vendor\pake\pa
keFunction.php on line 273
>> file-     D:\www\myproject/frontend_dev-cli.lck
>> file+     D:\www\myproject/frontend_prod-cli.lck
>> chmod 777 \D:\www\myproject/frontend_prod-cli.lck

Warning: chmod(): No such file or directory in D:\www\symfony\lib\vendor\pake\pa
keFunction.php on line 273
>> file-     D:\www\myproject/frontend_prod-cli.lck

Problem is odd slash in "\D:\www\myproject/frontend_prod-cli.lck".

First $lock_file defined in /data/tasks/sfPakeMisc.php:

$lock_file = $sf_root_dir.'/'.$lock_name.'-cli.lck';

Then it calls pake_chmod:

pake_chmod($lock_file, '', 0777);

In /lib/vendor/pake/pakeFunction.php function pake_chmod:

chmod($target_dir.DIRECTORY_SEPARATOR.$file, $mode);

So we have a chmod(.DIRECTORY_SEPARATOR.'/root/path/file', $mode);

08/11/08 17:37:31 changed by noel

  • status changed from reopened to closed.
  • resolution set to fixed.

(in [10741]) [1.0] fixed _safe_cache_remove()