laravel octane 在請求中Artisan call會記憶體洩露, 求解

阿凡發表於2021-10-22

github提的issues被秒關
大神們試試 有沒這情況

  • Octane Version: v1.0.15
  • Laravel Version: v8.64.0
  • PHP Version: 8.0.3
  • Server & Version: Swoole 4.6.6
  • Database Driver & Version: no

Description:

啟動命令

php artisan octane:start --workers=1 --port=8000 --task-workers=4 --server=swoole --max-requests=0

路由 (route/api.php)

Route::get('/hello', function (Request $request) {
\Illuminate\Support\Facades\Artisan::call('hello');
return 'hello';
});

HelloCommand

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class HelloCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'hello';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'hello';

    /**
     * Create a new command instance.
     *
     * [[@return](https://learnku.com/users/31554)](https://learnku.com/users/31554) void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * [[@return](https://learnku.com/users/31554)](https://learnku.com/users/31554) int
     */
    public function handle()
    {
        $this->line('hello');
        logger('hello');
        return Command::SUCCESS;
    }
}

Steps To Reproduce:

 200    GET /api/hello ....................................................................................................................................................................................... 55.55 mb 7.16 ms
  200    GET /api/hello ....................................................................................................................................................................................... 55.68 mb 5.48 ms
  200    GET /api/hello ....................................................................................................................................................................................... 55.82 mb 4.76 ms
  200    GET /api/hello ....................................................................................................................................................................................... 55.95 mb 5.69 ms
  200    GET /api/hello ....................................................................................................................................................................................... 56.09 mb 4.64 ms
  200    GET /api/hello ....................................................................................................................................................................................... 56.22 mb 4.46 ms
  200    GET /api/hello ....................................................................................................................................................................................... 56.36 mb 4.74 ms
  200    GET /api/hello ....................................................................................................................................................................................... 56.49 mb 4.94 ms
  200    GET /api/hello ....................................................................................................................................................................................... 56.63 mb 4.57 ms
  200    GET /api/hello ....................................................................................................................................................................................... 56.76 mb 4.46 ms
  200    GET /api/hello ....................................................................................................................................................................................... 56.90 mb 5.04 ms
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章