Articles in this section

The web statistics calculation process for a specific domain in Plesk gets stuck

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • Plesk Obsidian running on a RHEL-based operating system
  • During the execution of the Plesk Daily Maintenance task, a process tied to the specific recalculation of web statistics for a Plesk domain gets stuck and does not finish:
    The following is visible in /var/log/cron :

    CONFIG_TEXT: Mar 25 10:01:01 server anacron[3639301]: Job `cron.daily' locked by another anacron - skipping

    The process remains stuck and does not exit:

    # [root@server:~]$ ps aux | grep anacron
    root 818645 0.0 0.0 234724 2728 ? Ss Mar21 0:00 /usr/sbin/anacron -s

    # [root@server:~]$ pstree -capl 818645
    anacron,818645 -s 
    └─run-parts,828802 /bin/run-parts /etc/cron.daily 
    ├─50plesk-daily,828806 /etc/cron.daily/50plesk-daily 
    │ └─sw-engine,828808 -c /usr/local/psa/admin/conf/php.ini /usr/local/psa/admin/plib/DailyMaintainance/script.php 
    │ └─sw-engine,876523 -c /usr/local/psa/admin/conf/php.ini /usr/local/psa/admin/plib/DailyMaintainance/task-script.php ExecuteWebStatistics --period=daily 
    │ └─web_statistic_e,876530 
    │ └─awstats_buildst,912343 /usr/share/awstats/tools/awstats_buildstaticpages.pl -awstatsprog=/usr/share/awstats/wwwroot/cgi-bin/awstats.pl -configdir=/usr/local/psa/etc/awstats -config=example.com-https -dir=/var/www/vhosts/system/example.com/statistics//webstat-ssl/current 
    │ └─sh,912415 -c "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=example.com-https -staticlinks -configdir=/usr/local/psa/etc/awstats -output=keywords 2>&1 
    │ └─awstats.pl,912416 /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=example.com-https -staticlinks -configdir=/usr/local/psa/etc/awstats -output=keywords 
    └─sed,828807 1i\\\012/etc/cron.daily/50plesk-daily:\\\012

    # [root@server:~]$ ps aux | grep 912416
    root 912416 98.5 0.0 264064 22448 ? RN Mar21 5546:18 /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=example.com-https -staticlinks -configdir=/usr/local/psa/etc/awstats -output=keywords

    # [root@server:~]$ lsof -p 912416
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME 
    awstats.p 912416 root cwd DIR 8,3 4096 25431117 /usr/local/psa/tmp 
    awstats.p 912416 root rtd DIR 8,3 4096 2 / 
    awstats.p 912416 root txt REG 8,3 12736 24524239 /usr/bin/perl 
    awstats.p 912416 root mem REG 8,3 20304 131358 /usr/lib64/perl5/vendor_perl/auto/Cwd/Cwd.so 
    awstats.p 912416 root mem REG 8,3 111216 25824831 /usr/lib64/perl5/vendor_perl/auto/Storable/Storable.so 
    awstats.p 912416 root mem REG 8,3 24136 131430 /usr/lib64/perl5/auto/Fcntl/Fcntl.so 
    awstats.p 912416 root mem REG 8,3 45808 25824897 /usr/lib64/perl5/vendor_perl/auto/Encode/Encode.so 
    awstats.p 912416 root mem REG 8,3 52008 25824850 /usr/lib64/perl5/vendor_perl/auto/Socket/Socket.so 
    awstats.p 912416 root mem REG 8,3 217800224 24537522 /usr/lib/locale/locale-archive 
    awstats.p 912416 root mem REG 8,3 2089992 24512020 /usr/lib64/libc-2.28.so 
    awstats.p 912416 root mem REG 8,3 17024 24515666 /usr/lib64/libutil-2.28.so 
    awstats.p 912416 root mem REG 8,3 136008 24515692 /usr/lib64/libcrypt.so.1.1.0 
    awstats.p 912416 root mem REG 8,3 1598880 24537438 /usr/lib64/libm-2.28.so 
    awstats.p 912416 root mem REG 8,3 19128 24525451 /usr/lib64/libdl-2.28.so 
    awstats.p 912416 root mem REG 8,3 92976 24537651 /usr/lib64/libresolv-2.28.so 
    awstats.p 912416 root mem REG 8,3 149984 24537649 /usr/lib64/libpthread-2.28.so 
    awstats.p 912416 root mem REG 8,3 2181120 24515490 /usr/lib64/libperl.so.5.26.3 
    awstats.p 912416 root mem REG 8,3 1061896 24522782 /usr/lib64/ld-2.28.so 
    awstats.p 912416 root 0r FIFO 0,13 0t0 506702740 pipe 
    awstats.p 912416 root 1w FIFO 0,13 0t0 507276872 pipe 
    awstats.p 912416 root 2w FIFO 0,13 0t0 507276872 pipe 
    awstats.p 912416 root 3r DIR 8,3 4096 13766372 /var/www/vhosts/system/example.com/statistics/webstat-ssl

  • The /var/www/vhosts/system/example.com/statistics/webstat-ssl directory contains many temporary files related to the web statistics calculation process:

    # [root@server:/var/www/vhosts/system/example.com/statistics/webstat-ssl]$ ls -alh
    total 1.8M 
    ... 
    -rw-r--r-- 1 root root 24K Mar 25 12:22 awstats032024.example.com-https.tmp.3757448 
    -rw-r--r-- 1 root root 24K Mar 25 12:40 awstats032024.example.com-https.tmp.3771805 
    -rw-r--r-- 1 root root 24K Mar 25 12:46 awstats032024.example.com-https.tmp.3777518 
    -rw-r--r-- 1 root root 24K Mar 25 13:11 awstats032024.example.com-https.tmp.3849788 
    -rw-r--r-- 1 root root 352K Mar 21 12:24 awstats032024.example.com-https.txt 
    ...

  • An attempt to recalculate the statistics for the same domain by using the steps in this article results in the same behavior

Cause

The files tied to the web statistics calculation process for the domain are corrupted. Any files in the /var/www/vhosts/system/example.com/statistics/webstat-ssl directory that contain .tmp are temporary and should disappear after the statistics calculation process has been finalized. The web stats calculation process for this domain was most likely interrupted and this caused corruption for one or more of the related files.

Resolution

  1. Connect to the server via SSH
  2. Create the directory /root/webstatbak/ by executing the following command:

    # mkdir -p /root/webstatbak/

  3. Move the corrupted web statistics files to the newly created directory by executing the following command:
    Note: Replace example.com with your domain in all of the following commands

    # mv /var/www/vhosts/system/example.com/statistics/webstat-ssl/awstats032024.example.com.ie-https.t* /root/webstatbak/

  4. Run the following command in order to force the recreation of web statistics files for the affected domain:

    # plesk sbin statistics --calculate-one --domain-name=example.com

After the corrupted files are removed, the command above will finish without issues and due to this, the same issue will not appear for this domain while next execution of the Plesk Daily Maintenance task is ongoing.

Additional information

How to recalculate statistics for a particular domain in Plesk?

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.