octane: Terminated process/502 on syscall timeouts

  • Octane Version: 1.4.2
  • Laravel Version: 9.52.4
  • PHP Version: 8.1.9
  • Server & Version: Swoole 5.0.1

Description:

When a request is timed out due to a syscall (curl, for example), response is not returned, causing a 502. Worst of all, master process gets restarted for whatever reason, causing a downtime before Octane restarts.

The exit code is 139 (segfault), meaning it is a bug in Swoole allowing Octane to do something wrong. Yet, it’s very likely Octane is doing something wrong here, given it’s relation to max_execution_time.

Steps To Reproduce:

Set max_execution_time in config/octane.php to 5; add this route:

Route::get('test', function () {
	Http::timeout(40)->connectTimeout(40)->get('https://hub.dummyapis.com/delay?seconds=10');
});

start Octane and navigate to your_domain/test. You will get a 502 if you’re using a reverse proxy, or just a cut-off response if you’re hitting Octane directly. You’ll also see that the Octane process has terminated with an exit code of 139.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I’ll take a look later.

It’s possible to debug this down to C++ Swoole code; the segfault is happening somewhere in there based on the coredump I got from production. I don’t have the specific line number, only the function.

I can try debugging it more to get a line number if that’s needed, but I’m not very familiar with neither C++ nor debugging it 😃 My only guess is that that function uses reference to the worker to send the response, and the worker gets killed by Octane prior to sending the response.