Extension Manager Plus

MySQL server has gone away [2006] - Extension Manager Plus

Re: MySQL server has gone away [2006]

by dimassamid » Sun Aug 25, 2024 2:05 pm

Thanks for the detailed analysis!

I re-ran the extension check and now the warnings are only shown where there are actual problems with the check.
I actually have a lot of old extensions that don't have version checking available anymore.

Is this a phpBB issue or is this normal behavior when there are a lot of "problem" extensions? Should this be reported to the phpBB bug tracker?
dimassamid
Registered User
Posts: 61
Joined: Sat Aug 25, 2007 4:55 pm
Location: Tallinn, Estonia
Name: Dmitry

Re: MySQL server has gone away [2006]

by LukeWCS » Sun Aug 25, 2024 2:27 pm

Tracker would be useful, because this is clearly a phpBB problem, since the phpBB version check cannot be fully executed if a PHP or SQL timeout occurs during this. EMP 2.0.2 is no longer affected by this problem, because my workaround now simply executes all actions that are normally executed immediately after a version check only the next time the page is loaded. EMP has a ToDo function that I have now used for this workaround.

But before you report this in the tracker:

For those extensions for which EMP shows the yellow warning triangle, you should use "Details" to check whether this ext has a functioning version check. If so, you should create a list with the names of these exts. Then you should deactivate EMP and perform a version check. If the versions of your noted exts are then displayed in black instead of red or green, then this is a clear sign that phpBB could not determine the version and proof that the problem lies with phpBB.
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by LukeWCS » Tue Aug 27, 2024 12:46 pm

dimassamid wrote:Thanks for the detailed analysis!
I added an edit to the post before your answer, this may have overlapped with your answer, did you see the edit?

https://www.phpbb.com/customise/db/exte ... 43#p884443
I actually have a lot of old extensions that don't have version checking available anymore.

Is this a phpBB issue or is this normal behavior when there are a lot of "problem" extensions? Should this be reported to the phpBB bug tracker?
I just noticed that I obviously misunderstood you. Hence a new answer:

If the version check no longer works for old extensions, then this is generally the responsibility of the extension developers, but not the responsibility of phpBB itself. There is one exception, however: if the version check no longer works for an extension that comes from the CDB, then there may be an HTTP/HTTPS problem and that is actually a problem in the phpBB environment itself. See:

https://tracker.phpbb.com/browse/WEBSITE-1434
https://tracker.phpbb.com/browse/PHPBB-17385
https://github.com/phpbb/phpbb/pull/6708
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by LukeWCS » Wed Aug 28, 2024 2:33 pm

I looked at your post with your host's answer again:
dimassamid wrote: This value is global and cannot be changed. They recommend increasing the wait_timeout for the session using the site code.
SET SESSION wait_timeout = 600
I may be able to get around the SQL timeout problem at least in EMP so that phpBB can fully perform the version check. But before I can build in a workaround for this, I need some information from you. In the specific version I gave you, please make the following change:

Search for:

Code: Select all

		add_form_key('lukewcs_extmgrplus');
Add below:

Code: Select all

		$sql = "SHOW SESSION VARIABLES
				WHERE Variable_name = 'wait_timeout'";
		$result = $this->db->sql_query($sql);
		$sql_wait_timeout = $this->db->sql_fetchfield('Value');
		$this->db->sql_freeresult($result);
		var_dump($sql_wait_timeout);
		var_dump(ini_get('max_execution_time'));
Then call up the ExtMgr in the ACP. A debug text should now be visible at the top of the page. Copy it and post it here.
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by dimassamid » Wed Aug 28, 2024 6:00 pm

Thanks for creating a bug report on the tracker, as it's a bit difficult for me (as a user) to create such cases, as I am not competent enough to describe the problem. But I think phpBB should reconsider their approach to version checking.
LukeWCS wrote:If the version check no longer works for old extensions, then this is generally the responsibility of the extension developers, but not the responsibility of phpBB itself. There is one exception, however: if the version check no longer works for an extension that comes from the CDB, then there may be an HTTP/HTTPS problem and that is actually a problem in the phpBB environment itself.
I have both of these.
There are some that cannot be checked due to an outdated URL. But there are also those that cannot be checked due to a timeout, but if I click "Details", the check is successful.
LukeWCS wrote:I need some information from you. In the specific version I gave you, please make the following change:
I made these changes.

This is what I see at the top of the extensions page:

Code: Select all

string(2) "30" string(3) "600" [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/ext/lukewcs/extmgrplus/core/ext_mgr_plus.php:154)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/ext/lukewcs/extmgrplus/core/ext_mgr_plus.php:154)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/ext/lukewcs/extmgrplus/core/ext_mgr_plus.php:154)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_acp.php on line 139: Cannot modify header information - headers already sent by (output started at [ROOT]/ext/lukewcs/extmgrplus/core/ext_mgr_plus.php:154)
This is what I see after checking the version. White page with the following error

Code: Select all

string(2) "30" string(3) "600" [phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 1813: Cannot modify header information - headers already sent by (output started at [ROOT]/ext/lukewcs/extmgrplus/core/ext_mgr_plus.php:154)
dimassamid
Registered User
Posts: 61
Joined: Sat Aug 25, 2007 4:55 pm
Location: Tallinn, Estonia
Name: Dmitry

Re: MySQL server has gone away [2006]

by LukeWCS » Wed Aug 28, 2024 7:08 pm

dimassamid wrote: But there are also those that cannot be checked due to a timeout, but if I click "Details", the check is successful.
Yes, those are exactly the extensions that have the phpBB-SQL-timeout-problem and that's exactly what I'm trying to fix with a workaround.
dimassamid wrote:This is what I see at the top of the extensions page:
Great, that's all I needed, then the workaround might actually work. Test this new version:

edit: Attachment removed because it does not work as hoped.
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by dimassamid » Wed Aug 28, 2024 9:08 pm

Extension versions are checked, but I still see a yellow warning triangle next to the green/red version number. The triangle disappears if I click "Details".
dimassamid
Registered User
Posts: 61
Joined: Sat Aug 25, 2007 4:55 pm
Location: Tallinn, Estonia
Name: Dmitry

Re: MySQL server has gone away [2006]

by LukeWCS » Thu Aug 29, 2024 5:30 pm

Darn it! Okay, I implemented your hoster's suggestion, but unfortunately it doesn't work. So I have no other options now. The problem is with phpBB, not EMP. Unfortunately, the version check checks all extensions at once, instead of doing it in blocks. And it is precisely this behavior that leads to the SQL timeout.

With the first workaround, EMP can now at least save the versions of all successfully checked extensions in the DB. And you have to check the rest manually using "Details" so that EMP can also save this data. Not ideal, but better than nothing.
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by dimassamid » Mon Sep 02, 2024 8:06 am

Anyway, thanks for the edits you made. It already solved the main problem described in this topic. 👍
dimassamid
Registered User
Posts: 61
Joined: Sat Aug 25, 2007 4:55 pm
Location: Tallinn, Estonia
Name: Dmitry

Re: MySQL server has gone away [2006]

by LukeWCS » Wed Sep 04, 2024 6:40 pm

dimassamid wrote:Anyway, thanks for the edits you made.
It was worth a try. :)

However, that was just a workaround so that EMP at least wouldn't be blocked by the SQL timeout, not a solution. When it became clear that your hoster's suggestion wouldn't work, I came up with a theoretical concept of how to solve it. In the last few evenings I started to create the necessary auxiliary functions and this evening I was able to do a first test run. I think when I show two screens it will become clear what I'm building. ;)

1.
PicPick_2024-09-04_19-54-09.png
2.
PicPick_2024-09-04_19-54-38.png
PicPick_2024-09-04_19-54-38.png (5.97 KiB) Viewed 72 times
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by dimassamid » Thu Sep 05, 2024 3:22 am

Wow. Splitting the process into multiple parts, like with creating search indexes. That looks cool. 8-)
dimassamid
Registered User
Posts: 61
Joined: Sat Aug 25, 2007 4:55 pm
Location: Tallinn, Estonia
Name: Dmitry

Re: MySQL server has gone away [2006]

by LukeWCS » Thu Sep 05, 2024 2:58 pm

Yep. The technology used is old, but proven. ^^

I need some more information from you. You wrote that you have 140 extensions. And how many of them have a version check?
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by dimassamid » Thu Sep 05, 2024 9:47 pm

96 of them with version check.
dimassamid
Registered User
Posts: 61
Joined: Sat Aug 25, 2007 4:55 pm
Location: Tallinn, Estonia
Name: Dmitry

Re: MySQL server has gone away [2006]

by LukeWCS » Fri Sep 06, 2024 12:27 pm

Okay, then we now have all the data we need to do a bit of theorizing and calculations.
  • Extensions with VC: 96
  • Duration of the version check for you: around 45 seconds
  • SQL limit: 30 seconds <- This is the bottleneck that blocks phpBB and EMP
  • PHP limit: 600 seconds <- We definitely don't have to worry about this value ;)
Since the version check takes 45 seconds and the SQL time limit is already reached at 30 seconds, that means to me that phpBB continues undeterred even when the SQL server has long since said goodbye. phpBB therefore only has 30 seconds to determine the versions. However, since the entire version check takes 45 seconds, phpBB can roughly only determine 66.6% of the versions. That's the equivalent of around 63 extensions. That means that for 33 extensions the version cannot be determined at all.

This is of course not a precise calculation but just a rough estimate based on the average. How long the version check actually takes and how many versions can actually be determined depends primarily on the following factors:
  1. How good the connection is between the phpBB server (where your phpBB is installed) and the respective version server (where the version file is retrieved).
  2. How busy the phpBB server is.
  3. How busy the respective version server is.
It follows that the setting for the maximum number of extensions in 2.1.0-b1 is not ideal. To be more precise: it is inflexible and unsafe. So I will change this in 2.1.0-b2 so that you can define the number of seconds instead, so the time span of a run is taken into account, not the number of extensions.

With this change, 2.1.0 can flexibly adapt to the actual conditions/circumstances. Since 30 seconds is often the standard PHP limit on the Internet (at least according to my observations), I use 15 seconds as a "safe value". Also because phpBB itself uses 50% as a safe value in certain places. This means that under ideal conditions more extensions can be determined per run (more flexible) and under poor conditions phpBB/EMP would have enough reserves (more secure) for the version check to still be completed successfully.
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany

Re: MySQL server has gone away [2006]

by LukeWCS » Sat Sep 07, 2024 5:32 pm

@dimassamid

I have now published branch 2.1.0 in the GitHub repository, the current version is 2.1.0-b2. Please test it and give me feedback.

This must be treated like a regular update, so deactivate EMP and delete it via FTP and replace it completely with 2.1.0, then activate it again.

https://github.com/LukeWCS/ext-mgr-plus/tree/2.1.0
May the backup be with you. Always.
User avatar
LukeWCS
Registered User
Posts: 309
Joined: Mon Dec 08, 2014 12:32 pm
Location: Germany