Important: #92655 - Make request timeout configurable for linkvalidator
See forge#92655
Description
The external link checking now uses a default (total) timeout of 20 seconds.
Previously, a timeout was not set, which resulted in the default from
Global Configuration $GLOBALS
being used, which was 0 by default. 0 means no timeout.
In some edge cases, this caused the link checking to hang indefinitely, which also lead to a scheduler task hanging indefinitely.
The timeout now defaults to 20 seconds (which is twice the time that is set as connect_timeout in the core Global Configuration).
The timeout can be changed in Page TSconfig:
mod.linkvalidator.linktypesConfig.external.timeout = 10
You can also unset it, which will result in the Global Configuration
$GLOBALS
being used:
mod.linkvalidator.linktypesConfig.external.timeout >
Important
It is not recommended to use 0.
Background information
The Linkvalidator External
class uses the core
Request
(which uses Guzzle under the hood).
Request
expects a set of options where
the timeout can be passed along.
If it is not, the core $GLOBALS
is used.
If a timeout for querying an external link is not set, the request may linger indefinitely and will not terminate. See the related issues for steps to reproduce this.
How does HTTP request timeout generally work?
Depending on the library used and the tool, you can usually set:
- connect timeout
- read timeout
- general timeout
Libraries and utilities often have these options separately, including - for example - the curl command line tool or Guzzle.
TYPO3 uses Guzzle under the hood.
Core Global Configuration
These are currently the defaults in the core:
$GLOBALS
['TYPO3_ CONF_ VARS'] ['HTTP'] ['connect_ timeout'] = 10; $GLOBALS
['TYPO3_ CONF_ VARS'] ['HTTP'] ['timeout'] = 0;
This sets the corresponding timeouts in Guzzle.
Guzzle request options
These are currently the default timeouts in Guzzle (but connect_timeout and timeout will be overridden by the core):
- connect_timeout: 0
- read_timeout: Defaults to the value of the default_socket_timeout PHP ini setting
- timeout: 0
More information
- Guzzle Request Options
- see
typo3/
sysext/ core/ Configuration/ Default Configuration. php in core - see
Guzzle
andClient Factory Request
in the coreFactory