panel icon indicating copy to clipboard operation
panel copied to clipboard

SQL deadlock when creating 2 servers in parallel via the API

Open rxdn opened this issue 6 years ago • 3 comments

Background (please complete the following information):

  • Panel or Daemon: Panel
  • Version of Panel/Daemon: Panel v1.0.3, Daemon v1.0.1
  • Server's OS: Debian 10
  • Your Computer's OS & Browser: Windows 10, Opera

Describe the bug When creating 2 servers simultaneously via the API, a HTTP 500 is encountered:

{
    "errors": [
        {
            "code": "QueryException",
            "status": "500",
            "detail": "An unexpected error was encountered while processing this request, please try again."
        }
    ]
}

Taking a look at the panel's logs shows the following: http://bin.ptdl.co/iu1mh

Only one of the 2 servers are created.

To Reproduce Use the API to create 2 new servers simultaneously

Expected behavior That both servers are created

rxdn avatar Nov 08 '20 17:11 rxdn

Are you using InnoDB for your database?

GravityCube avatar Nov 08 '20 18:11 GravityCube

Are you using InnoDB for your database?

Correct

rxdn avatar Nov 08 '20 18:11 rxdn

https://github.com/pterodactyl/panel/blob/develop/app/Services/Servers/ServerCreationService.php#L164-L172 https://laravel.com/docs/8.x/database#handling-deadlocks

This can probably be solved adding retry attempts.

GravityCube avatar Nov 08 '20 18:11 GravityCube