Bug #81041 [Ver->Opn]: Phpstan does not finish on Windows when opcache is enabled

From: Date: Tue, 01 Jun 2021 12:01:40 +0000
Subject: Bug #81041 [Ver->Opn]: Phpstan does not finish on Windows when opcache is enabled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234138@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81041&edit=1

 ID:                 81041
 Updated by:         cmb@php.net
 Reported by:        mvorisek at mvorisek dot cz
 Summary:            Phpstan does not finish on Windows when opcache is
                     enabled
-Status:             Verified
+Status:             Open
 Type:               Bug
 Package:            opcache
-Operating System:   Windows
+Operating System:   *
 PHP Version:        7.4.19
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Further findings: this is not particularly related to Windows;
you get the same failure on Ubuntu as well, with SHM cache[1]
and with file_cache_only[2].  However, the script runs fine as
soon as Xdebug is loaded, even on Windows[3].

Interestingly, running with file_cache_only and Xdebug (3.0.4)
loaded, there are no repro/ui/vendor/atk4/core files are generated
in the file cache.  That explains why the script is running fine
with Xdebug, although I have no idea why the files are not cached.
That might be an Xdebug issue.

[1] <https://github.com/cmb69/phpstan-src/actions/runs/895876662>
[2] <https://github.com/cmb69/phpstan-src/actions/runs/895872108>
[3] <https://github.com/cmb69/phpstan-src/actions/runs/895881729>


Previous Comments:
------------------------------------------------------------------------
[2021-05-27 20:05:44] m at m dot cz

Where else the bug should be? See the generated xdebug trace logs - I generated them in absolutely
same enviromenment without any random/time functions used inside. One with opcache enabled, one with
opcached disabled. And they differs.

------------------------------------------------------------------------
[2021-05-27 17:13:53] cmb@php.net

On Windows with OPcache enabled, by the time
Atk4\Core\ReadableCaptionTrait is to be autoloaded,
PHPStan\Reflection\BetterReflection\SourceLocator\FileReadTrapStreamWrapper
is registered as file wrapper, so an empty file is compiled, and
the trait is not found.  That happens just for that single file;
all the rest is good.  I'm not sure that there is actually a bug
in php-src.

------------------------------------------------------------------------
[2021-05-25 10:11:17] m at m dot cz

@cmb Did you get anywhere?

------------------------------------------------------------------------
[2021-05-18 21:43:43] cmb@php.net

I'm able reliably reproduce the issue (with SHM or file cache),
and it is definitely a Windows only thing (on Linux, there are no
problems even with file cache only[1]).  Debugging this on Windows
is a bit hard, due to missing helpers (like .gdbinit), but I hope
to make some real progress tomorrow.

[1] <https://github.com/cmb69/phpstan-src/runs/2611756608>

------------------------------------------------------------------------
[2021-05-18 13:42:41] m at m dot cz

@cmb I collected more than 100 GBs of xdebug trace logs and isolated the issue. The logs started to
be different (after I removed randomness from time() and simillar func calls) on line 210 362 792.

Here are relevant short logs:
https://github.com/mvorisek/phpstan-src/commit/f9e1b786f6a210fd8573fd8d5caf1b9cd4815e45

They differ on line 121, with opcache disabled "include" calls spl_autoload_call, with
opcache disabled, "include" returns true.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=81041


--
Edit this bug report at https://bugs.php.net/bug.php?id=81041&edit=1


Thread (22 messages)

« previous php.bugs (#234138) next »