Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: CP hangs on license check #15643

Closed
ul8 opened this issue Sep 3, 2024 · 3 comments
Closed

[5.x]: CP hangs on license check #15643

ul8 opened this issue Sep 3, 2024 · 3 comments
Labels

Comments

@ul8
Copy link
Contributor

ul8 commented Sep 3, 2024

What happened?

Description

As previously reported in #15571, if there are connection issues to the license API, the CP hangs. It's now been reduced to 15 seconds (thanks!), but the problem could probably be eliminated altogether. Here's a suggestion by our hosting provider:

It seems the PHP process with the curl_exec holds a lock during the blocking request, which other PHP processes then have to wait for and are thus delayed for just as long as the curl_exec.

The most likely candidate would be the session lock:
https://stackoverflow.com/a/38217390/1563584

(Detailed explanation of session locks:
https://ma.ttias.be/php-session-locking-prevent-sessions-blocking-in-requests/)

The best solution would be that Craft should not start a session in the license check,
or end/close the session before the request to the license server...

Steps to reproduce

  1. On OS level, simulate that the Craft API server cannot be reached (timeout)
  2. Access the CP repeatedly (logged in)

Expected behavior

Normal performance

Actual behavior

The CP hangs up to the 15 second timeout since 5.3.5 / 4.11.4, or to curl's default timeout otherwise.

Craft CMS version

5.3.5

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

@ul8 ul8 added the bug label Sep 3, 2024
@angrybrad
Copy link
Member

@ul8 curl_multi* is meant to avoid this. Craft uses Guzzle, which uses curl.

Guzzle should pick curl_multi_exec as a default handler if it's available on the box and at least curl version 7.21.2 or higher.

https://github.com/guzzle/guzzle/blob/7.9/src/Utils.php#L88-L108

What version of curl does you box have on it and does it support curl_multi*?

@brandonkelly
Copy link
Member

Just released Craft 4.12.0 and 5.4.0 with that suggested change (c53e361).

@ul8
Copy link
Contributor Author

ul8 commented Sep 4, 2024

@angrybrad the box has curl version 7.88.1 so it should support it. We'll try with the new release, thanks @brandonkelly !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants