duanfei1987 2019-06-21 13:10
浏览 209
已采纳

如何检测和记录长时间接收请求和连接超时请求

question is pretty simple even if not so obvious.

I managing a website that's showing issues with connection timeout, making the web service unaccessible and not working properly when it happens.

The actual environment is WooCommerce on a self-managed secured VPS.

php7, php-fpm, wordpress 5.+, apache2, mysql, cPanel, centOs

For a couple of time the site became unreachable showing Connection Timeout error, even if all services was up and running.

How to track or log requests originating the connection timeout error?

For example, with an application ran on the server that:

  • log every requests that occurs with more than 30 seconds execution time
  • the moment of the request
  • the request URL.

Any software, wordpress, cPanel extension or service in order to detect the issue?

  • 写回答

1条回答 默认 最新

  • doucheng7534 2019-07-21 06:34
    关注

    I get the solution in matter of detecting the situation when it happens.

    The key information can be found in PHP-FPM log (deducted that by the fact that restarting PHP-FPM and not Apache2 was solving the problem, due to a probable PHP-FPM thread appended).

    i.e., in a cPanel enviroment you would find the log at the path:

    /opt/cpanel/ea-php$$/root/usr/var/log/php-fpm/error.log
    

    In the file the following lines are noteful:

    [Tue Jul 16 09:55:30.677693 2019] [proxy_fcgi:error] [pid 17283] (70007)The timeout specified has expired: [client 162.158.91.192:16946] AH01075: Error dispatching request to : (polling), referer: https://www.example.com/my-resource.php
    [Tue Jul 16 10:00:30.738947 2019] [proxy_fcgi:error] [pid 17283] (70007)The timeout specified has expired: [client 162.158.91.192:16946] AH01075: Error dispatching request to : (polling), referer: https://www.example.com/my-resource.php
    

    So I've been able to inspect the shown resource and replicate and solve the issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?