进程分叉期间发生PHAR内部损坏(CRC32不匹配)

问题描述 投票:6回答:1

我是ko-worker库的开发人员。我将带有phar可执行文件的功能添加为守护程序应用程序。并发现了与phar和进程派生undex linux的奇怪行为。每次主进程派生一个以上的孩子时,我都会得到类似这样的错误

include(phar:///opt/www/worker.phar/vendor/path/to/file.php): 
failed to open stream: phar error: internal corruption of phar    

"/opt/www/worker.phar" (crc32 mismatch on file "vendor/path/to/file.php")
in `phar:///opt/www/worker.phar/vendor/composer/ClassLoader.php` line 412

phar外观的存根(original stub here

#!/usr/bin/env php
<?php
     Phar::mapPhar('worker.phar');
     require_once 'phar://worker.phar/vendor/autoload.php';

     //Execute next going fork code more then one 1 time
     ...
     $pid = pcntl_fork();
     if ($pid == -1) {
         die('could not fork');
     } else if ($pid) {
        // we are the parent
        ...
     } else {
        // we are the child
        ...
        exit(1);
     }

     __HALT_COMPILER();

我不使用cache_list。仅当使用GZ或BZ2压缩phar时才会发生这种情况。不压缩的Phar文件不会重现此错误。是否有任何变通办法,或者是有关限制压缩相位和分支过程的信息?

php linux fork phar
1个回答
0
投票

似乎是一个PHP问题,请作为https://bugs.php.net/处的错误报告,并包含重现步骤。

© www.soinside.com 2019 - 2024. All rights reserved.