php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75353 Some files always corrupted in file cache
Submitted: 2017-10-10 15:32 UTC Modified: 2021-04-06 14:49 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: mike@php.net Assigned:
Status: Open Package: opcache
PHP Version: 7.1.10 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-10-10 15:32 UTC] mike@php.net
Description:
------------
Some files will always end up corrupted in file cache, e.g. Laravel's Support/Str.php

Test script:
---------------
Shell session:

# install laravel
git clone https://github.com/laravel/laravel.git
cd laravel
composer install

# minimal env config
APP_KEY=$(pwgen 32 1)
LARAVEL_TMP=$(mktemp -d)

# prime opcache
php -d opcache.file_cache=$LARAVEL_TMP \
    -d opcache.error_log=stderr \
    -d opcache.log_verbosity_level=2 \
    -S localhost:9999 server.php &
FCGI_PID=$!
sleep 1
for i in "" {1..5}; do curl -sSL localhost:9999/$i >/dev/null; done
kill $FCGI_PID

# now start over
php -d opcache.file_cache=$LARAVEL_TMP \
    -d opcache.error_log=stderr \
    -d opcache.log_verbosity_level=4 \
    -S localhost:9999 server.php \
2> >(sed -re 's/(^.*Added key).*/\1/' | uniq -c) &
FCGI_PID=$!
sleep 1
for i in "" {1..5}; do curl -sSL localhost:9999/$i >/dev/null; done
kill $FCGI_PID


Actual result:
--------------
[1] 14149
PHP 7.1.10RC1 Development Server started at Tue Oct 10 17:21:00 2017
Listening on http://localhost:9999
Document root is /home/mike/src/laravel.git
Press Ctrl-C to quit.
      1 Tue Oct 10 17:21:01 2017 (14149): Warning corrupted file '/tmp/.../Illuminate/Support/Str.php.bin'
      1 
      1 Tue Oct 10 17:21:01 2017 (14149): Message Cached script '/home/.../Illuminate/Support/Str.php'
    201 Tue Oct 10 17:21:01 2017 (14149): Message Added key                                                                                                                                                                                                                                                                   
[1]  + 14149 terminated  ~/src/php-719-opcache/usr/bin/php -d opcache.file_cache=$LARAVEL_TMP -d  -d  


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-11 06:34 UTC] mike@php.net
Valgrind says info.checksum points to uninitialized bytes when writev()'d in zend_file_cache_script_store(), but it is set a couple lines above.
 [2021-04-06 14:49 UTC] cmb@php.net
I have seen that error several times, but almost certainly not on
a regular basis, and that issue may have been resolved in the
meantime.  There is a relevant comment regarding uninitialized
regions[1] in the sources.

[1] <https://github.com/php/php-src/blob/php-7.4.16/ext/opcache/zend_file_cache.c#L944-L946>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC