Support the ongoing development of Laravel.io →
Laravel Configuration
Last updated by @filbertumbawa15 1 week ago.
0

When Laravel makes an HTTP request to itself via Http::get(), Nginx locks the request in the same process. Laravel waits for the first request to finish before handling the second one. Since Laravel itself is already handling the first request, it can't handle the second one until the first finishes. This causes a deadlock where Laravel is waiting for a response from itself, but it can't process that response because it's busy waiting.

Use Http::async() to Make Requests Asynchronously

Here is modified code using async:

Route::get('testimoni', function () { $responses = Http::pool(fn ($pool) => [ $pool->get('http://localhost/api-project/api/menu-sidebar'), $pool->get('http://localhost/api-project/api/menu-sidebar'), ]); $result1 = $responses[0]->json(); $result2 = $responses[1]->json(); dump($result1, $result2); });

or you can do like this:

$result1 = app(\App\Http\Controllers\MenuSidebarController::class)->index();

0

It still same, when using pool for handle deadlock request. If using multiple request from Laravel API, it will be shown like this. The surprising thing is it only stuck when request Laravel API, if using Nest.JS Api or Fake API, it works like usually. Really, i'm very confused to handle this.

0

I mean the bug is from cURL Request, i test in sample PHP Project. It's not work too.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.