No Code Attached Yet bug
avatar wlklch
wlklch
14 Oct 2022

Steps to reproduce the issue

  • disable php-curl and verify that transport sockets is used
  • administrator -> system -> update joomla -> check for updates

in libraries/src/Http/Transport/SocketTransport.php -> request(...)
the loop at #123

        while (!feof($connection)) {
            $content .= fgets($connection, 4096);
        }

does not finish at the end of the xml-document, but loops forever, continuing over any number of timeouts

if, however, the socket closes, you get an xml parse error, because before and after the xml, there are some strange characters.

Expected result

  1. check update should neither loop nor fail parsing the xml, but return a screen with the necessary updates, or the confirmation there are none
  2. give an installation warning if php-curl is missing

Actual result

does not finish at the end of the xml-document, but loops forever, continuing over any number of timeouts
if, however, the socket closes, you get an xml parse error, because before and after the xml, there are some strange characters.

System information (as much as possible)

  • Joomla 4.3.2
  • php php-defaults (92ubuntu1) jammy
  • apache2 (2.4.52-1ubuntu4.1)
  • linux System: Kernel: 5.15.0-48-generic x86_64 bits: 64 compiler: gcc v: 11.2.0 Desktop: Cinnamon 5.4.12
    tk: GTK 3.24.33 wm: Mutter dm: LightDM Distro: Linux Mint 21 Vanessa base: Ubuntu 22.04 jammy
  • the problem was origninally detected on linux mint 20.3 and php 7, it survived a complete new installation of the operating system and all other software

Additional comments

it took me a very long time to debug the problem, as there was not response from the system and I couldn't find any hint in the logs or the web....

avatar wlklch wlklch - open - 14 Oct 2022
avatar wlklch wlklch - change - 14 Oct 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 14 Oct 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Oct 2022
avatar wlklch wlklch - change - 14 Oct 2022
The description was changed
avatar wlklch wlklch - edited - 14 Oct 2022
avatar wlklch wlklch - change - 14 Oct 2022
Title
update joomla infinite loop with curl using sockets
update joomla infinite loop without curl and instead using sockets
avatar wlklch wlklch - edited - 14 Oct 2022
avatar theredoldmen
theredoldmen - comment - 24 Jan 2023

This seems happening because on some server (ie https://update.joomla.org) the answer is chunked.

https://en.wikipedia.org/wiki/Chunked_transfer_encoding

Then the connection is always up and never closes.
Each chunk starts with the number of octets of the data it embeds expressed as a hexadecimal number in ASCII followed by optional parameters (chunk extension) and a terminating CRLF sequence, followed by the chunk data.

The only solution I found is to force HTTP 1.0

request[] = strtoupper($method) . ' ' . ((empty($path)) ? '/' : $path) . ' HTTP/1.0';


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38963.

avatar wlklch
wlklch - comment - 25 Jan 2023

thanx for the analysis.
for me the solution was to install php-curl - which I think is acceptable and makes more sense than switch to HTTP 1.0
the problem was (and still might be for other users), that no hint what so ever was given, that this could help
It would be helpfull in the loop in /SocketTransport.php -> request mentioned above

  • to put a timeout and an error message
  • and/or check for an empty string returned from fgets
avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar SniperSister SniperSister - close - 11 Mar 2024
avatar SniperSister SniperSister - change - 11 Mar 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-03-11 19:43:07
Closed_By SniperSister
avatar SniperSister
SniperSister - comment - 11 Mar 2024

See #43001 and #43002

Add a Comment

Login with GitHub to post a comment