http request between 2 local apps: deadlock with default settings!


  • | 559 points

    Hi,

    I am new to Laragon and had some troubles with my setup that took me hours yesterday. Maybe my (simple) solution helps others, or or better maybe the default settings could be changed by the Laragon team to prevent this.

    Setup:
    2 Local (Laravel) Apps talking to each other over Http REST APIs.
    Browser -> makes a Http-Request to App 1 -> within the request App 1 makes a Guzzle-Http Request to the API of App 2

    This results in a permanent deadlock!

    Reason:
    Nginx has in the default config only one PHP upstream slot, so App 1 is waiting for the result of the API Reqeust, this is scheduled by Nginx until the first Http Request is closed. A classic deadlock situation :-)

    Solution:
    In your usr/laragon.ini: Add
    [nginx]
    Upstream=2 (or a higher value)

    I am not sure why this happens (is upstream a nginx setting or is there some magic done by laragon inbetween?

    Anyway @laragonTeam please add Upstream > 1 as default value for futures releases.


  • administrators
    | 108154 points

    @peterreb : Many thanks for posting your issue and solution here. The upstream magic is done by Laragon and I will set it > 1 as your request.


  • | 436 points

    What about apache? Does this issue affects it as well?


  • administrators
    | 108154 points

    @peterreb : I've release Laragon 4.0.14 which set the Upstream=2 by default.
    https://forum.laragon.org/topic/1204/laragon-4-0-released-with-quick-add-feature

    @gsabater : This issue does not affect Apache. However, please be careful when using env vars in Apache in Laravel when you have 2+ apps which communicate each other:
    https://forum.laragon.org/topic/1468/why-you-should-use-nginx-instead-of-apache-for-laragon


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.