Skip to content

error_log on Windows can hold the file write lock #8923

Closed
@neil-pearce

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions