Debug file access errors

Viewed 53

I work on a WordPress WooCommerce store that creates a lot of failing access syscalls on every page visit. The strace shows that it tries to open a lot of files, only to receive a -1 ENOENT return code. It tries to access assets or php files in wrong locations. There are 9000 access syscalls of which over 8200 fail, as well as 1800 lstat calls of which over 1500 fail.

This behaviour does not seem to be unique to this site, but also occurs on another WordPress WooCommerce page built with Bedrock and Sage.

Now, how do I debug what lines of code trigger all these file accesses?

Excerpt from strace -e trace=%file:

[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/role-command/src/Automattic/WooCommerce/Admin/API/Init.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/scaffold-command/src/Automattic/WooCommerce/Admin/API/Init.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/search-replace-command/src/Automattic/WooCommerce/Admin/API/Init.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/server-command/src/Automattic/WooCommerce/Admin/API/Init.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/shell-command/src/Automattic/WooCommerce/Admin/API/Init.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/super-admin-command/src/Automattic/WooCommerce/Admin/API/Init.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/widget-command/src/Automattic/WooCommerce/Admin/API/Init.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/cache-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/checksum-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/config-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/core-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/cron-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/db-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/entity-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/eval-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/export-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/extension-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/import-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/language-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/media-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/package-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/rewrite-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/role-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
[pid 32953] access("/home/user/project/vendor/composer/../wp-cli/scaffold-command/src/Automattic/WooCommerce/Admin/ReportExporter.php", F_OK) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)

Output of strace -c:

% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 28,65    0,007754           0      9038      8278 access
 10,51    0,002844           1      1820      1535 lstat
 10,51    0,002844           1      1924         2 openat
 10,43    0,002824           0      3090         2 read
  8,52    0,002307           1      1945           close
  6,57    0,001778           1      1199           getcwd
  5,68    0,001536           0      2088           fstat
  3,69    0,000998           2       412           poll
  3,28    0,000887          10        85           getpid
  2,25    0,000608           4       143           rt_sigaction
  1,62    0,000439           1       301           sendto
  1,50    0,000405          17        23           epoll_wait
  1,46    0,000396           1       363           recvfrom
  1,17    0,000317           0       534         2 stat
  0,66    0,000179          10        17           write
  0,62    0,000168           0       464           lseek
  0,45    0,000122           1        74           mmap
  0,37    0,000099           4        22         2 getsockopt
  0,28    0,000075           5        14           socket
  0,26    0,000070          35         2           clone
  0,19    0,000051           0        57           mprotect
  0,18    0,000048          24         2           set_robust_list
  0,16    0,000042           5         8           sendmsg
  0,15    0,000041           2        16         4 setsockopt
  0,14    0,000039           0        45         6 connect
  0,11    0,000030           2        13           brk
  0,08    0,000022           7         3         1 madvise
  0,07    0,000019           1        15           fcntl
  0,06    0,000017           0        19           rt_sigprocmask
  0,05    0,000014           4         3         1 futex
  0,05    0,000013           0        22           munmap
  0,04    0,000012           6         2           getgid
  0,04    0,000011           2         4           socketpair
  0,04    0,000011           5         2           getuid
  0,04    0,000011           2         4           geteuid
  0,04    0,000011           5         2           getegid
  0,02    0,000005           5         1           accept
  0,02    0,000005           0        49           getdents64
  0,01    0,000004           1         4           setitimer
  0,01    0,000004           0        21           getsockname
  0,01    0,000003           1         2           getpeername
  0,01    0,000002           1         2           times
  0,00    0,000001           0         2           chdir
  0,00    0,000000           0         3           ioctl
  0,00    0,000000           0        20         3 recvmsg
  0,00    0,000000           0         1           shutdown
  0,00    0,000000           0         1           bind
  0,00    0,000000           0         2           uname
  0,00    0,000000           0         2           gettid
  0,00    0,000000           0         3           ppoll
  0,00    0,000000           0         1           sendmmsg
------ ----------- ----------- --------- --------- ----------------
100,00    0,027066           1     23889      9836 total

OS: Linux, Kernel version 5.4.66

Webserver: nginx with php-fpm, PHP version 7.4.10

WordPress: Version 5.5.1, on Bedrock stack

0 Answers
Related