SQL deadlock when creating 2 servers in parallel via the API
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
Are you using InnoDB for your database?
Are you using InnoDB for your database?
Correct
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.