Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swoole: Server freezes with concurrent requests if a request within request points to the same server #961

Open
joysonjoy1811 opened this issue Oct 18, 2024 · 3 comments

Comments

@joysonjoy1811
Copy link

Octane Version

2.5.9

Laravel Version

11.x

PHP Version

8.3.11

What server type are you using?

Swoole

Server Version

5.1.4

Database Driver & Version

No response

Description

I encountered random crashes in a production application running on Laravel Octane with Swoole, where requests would hang indefinitely until timing out. Initially, I suspected a memory leak, but further investigation pointed to "timeout" errors in the Laravel logs from HTTP Facade. Only after these timeouts occur, all subsequent requests become unresponsive until I manually restart the daemon.

The issue was traced to a particular request that was making another request to the same server(though targeting a different endpoint). After running benchmarks locally, I was able to reproduce the problem.

Steps To Reproduce

class TestController extends Controller
{
    public function foo(Request $request)
    {
        $response = Http::asForm()->post('http://127.0.0.1:8000/api/test/bar', [
            'foo' => 'bar'
        ]);
        return $response;
    }

    public function bar(Request $request) {
        return $request->all();
    }
}
Route::get('/test/foo', [TestController::class, 'foo']);
Route::post('/test/bar', [TestController::class, 'bar']);

php artisan octane:start
ab -n 120 -c 24 http://127.0.0.1:8000/api/test/foo

Output:

This is ApacheBench, Version 2.3 <$Revision: 1913912 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)...apr_pollset_poll: The timeout specified has expired (70007)
Total of 1 requests completed
Screenshot 2024-10-18 at 9 47 54 PM
@crynobone
Copy link
Member

Hey there, thanks for reporting this issue.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

@joysonjoy1811
Copy link
Author

You can find the repository here - https://github.com/joysonjoy1811/laravel-bug-report-961

@NathanFreeman
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants