Skip to content

error_log on Windows can hold the file write lock #8923

Closed

Description

@neil-pearce

Description

The problem can only be seen on a very busy Windows box. If error_log is called then the lock is not immediately released by the file close but at a time that "depends upon available system resources". This is a 'feature' of the Windows function LockFileEx. The problem has already been addressed in the routine ps_files_close (in the file mod_files.c):

static void ps_files_close(ps_files *data)
{
	if (data->fd != -1) {
#ifdef PHP_WIN32
		/* On Win32 locked files that are closed without being explicitly unlocked
		   will be unlocked only when "system resources become available". */
		flock(data->fd, LOCK_UN);
#endif
		close(data->fd);
		data->fd = -1;
	}
}

The same logic should be implemented in the routine php_log_err_with_severity (in main.c).

PHP Version

All versions

Operating System

Windows

Activity

  1. cmb69 commented on Jul 5, 2022

    @cmb69
    Member

    Good bug report. Thank you!

  2. self-assigned this
    on Jul 5, 2022
  3. added a commit that references this issue on Jul 5, 2022
    9799b87
  4. added 2 commits that reference this issue on Jul 12, 2022
    77e954a
    5a459f6
  5. added a commit that references this issue on Jul 12, 2022
    31b02a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions