douyi6922 2015-04-02 12:29
浏览 105

进程fork期间PHAR内部损坏(crc32不匹配)

I am developer of ko-worker library. I add feature with phar executable as daemons application. And found strange behavior with phar and process forking undex linux. Each time the master process fork`s more then 1 child i got error like that

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

The stub (original stub here) of phar look`s like

#!/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();

I do not use cache_list. This happens only if phar is compressed with GZ or BZ2. Phar files without compression do not reproduce this bug. Is any workarounds around it or may be some information about restriction of compressed phars and forked process?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度