BSL253 — Timeouts working with external resources¶
Summary¶
Timeouts working with external resources
Identifiers¶
| Field | Value |
|---|---|
| Rule code | BSL253 |
| Compatible alias | TimeoutsInExternalResources |
| Severity | WARNING |
| Enabled by default | Yes |
| Implemented | Yes |
| Tags | robustness, performance |
Behavior¶
- The public identifier
BSL253and aliasTimeoutsInExternalResourcesare stable. - The rule reports the cases documented on this page.
- Suppressions and project configuration are applied before publication.
- The rule requires neither an external analyzer nor network access.
Configuration and suppression¶
BSL### is the primary stable identifier. The compatible alias is accepted
in select, ignore, and compatible block suppression comments.
All three suppression families support both a current line and a range. When an opening comment follows code, it affects only that line. Use any one form:
noqa:
bsl-disable:
- compatible
BSLLSform:
When the same opening comment is on a line by itself, it starts a range. Close it with the matching marker from the same family:
// noqa: BSL253
// code without this diagnostic
// noqa-enable: BSL253
// bsl-disable: BSL253
// code without this diagnostic
// bsl-enable: BSL253
// BSLLS:TimeoutsInExternalResources-off
// code without this diagnostic
// BSLLS:TimeoutsInExternalResources-on
To disable the rule until the end of the file, omit the closing
noqa-enable, bsl-enable, or BSLLS:…-on marker.
Opening and closing markers must belong to the same family.
Description¶
When working with external resources using the WSDefinitions, WSProxy, HTTPConnection, FTPConnection there should be a time out - the time limit for the operation to be completed. Otherwise, as a result of endless waiting, the program will freeze or some of the functionality of the program will become unavailable. For the InternetMailProfile the platform sets the default timeout value to 30 seconds, but despite this, it is worth explicitly specifying the timeout value when using it.
Setting a timeout protects against external factors:
- unstable Internet connection, when the connection is interrupted regularly, and the system cannot receive a complete response from the server to which the connection is made;
- when anti-virus programs are enabled or if the firewall settings are incorrect;
- incorrect proxy-server settings;
- unreliable operation of the web server due to increased load or incorrect operation of scripts.
Examples¶
Incorrect:
or
Correct:
or
ConnectiomTimeout = 180;
HTTPConnection = New HTTPConnection("zabbix.localhost", 80,,,, ConnectiomTimeout);