Description
Description
This is not a big deal, as the error happens in this case on PHP exit, the PHP code works, but maybe there are some other corner cases where this might be an issue.
mkdir /tmp/phpopcache
sudo chmod 777 /tmp/phpopcache
echo "<?php echo 'hi';" > test.php
sudo strace -s 256 -o strace.txt -u www-data /usr/bin/php -dopcache.enable=1 -dopcache.enable_cli=1 -dopcache.file_cache_only=1 -dopcache.file_cache="/tmp/phpopcache" -dopcache.log_verbosity_level=4 -dopcache.error_log=/tmp/opcache.error -f test.php
will produce
cat /tmp/opcache.error
Mon May 29 09:07:24 2023 (25731): Debug UnlockAll: Bad file descriptor (9)
grep EBADF strace.txt
fcntl(0, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = -1 EBADF (Bad file descriptor)
It seems like the lock file is created here
https://github.com/php/php-src/blob/master/ext/opcache/zend_shared_alloc.c#L103
but this code is executed only when the file_cache_only=0
php-src/ext/opcache/ZendAccelerator.c
Line 3200 in 2d883a6
i.e. the lock file is not created with file_cache_only=1
but regardless of the file_cache_only directive, the code tries to unlock it and generates the error here
https://github.com/php/php-src/blob/master/ext/opcache/ZendAccelerator.c#L401
PHP Version
8.1.17
Operating System
Ubuntu 18.04