Page 1 of 2

PHP JIT memory failed awstats

Posted: Sun 10. Jul 2022, 21:00
by Henning
10-Jul-2022 03:08:24 Europe/Berlin] PHP Warning: preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Helper/IpAddress.php on line 158
[10-Jul-2022 03:08:25 Europe/Berlin] PHP Warning: file_put_contents(/etc/awstats/awstats.web1.conf): failed to open stream: Read-only file system in /home/keyhelp/www/keyhelp/cronjob/jobs/statistic.php on line 504
[10-Jul-2022 03:08:38 Europe/Berlin] PHP Warning: file_put_contents(/etc/awstats/awstats.web2.conf): failed to open stream: Read-only file system in /home/keyhelp/www/keyhelp/cronjob/jobs/statistic.php on line 504
[10-Jul-2022 03:08:49 Europe/Berlin] PHP Warning: preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Helper/IpAddress.php on line 158
[10-Jul-2022 03:08:49 Europe/Berlin] PHP Warning: preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Helper/IpAddress.php on line 158
[10-Jul-2022 03:08:50 Europe/Berlin] PHP Warning: preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Helper/IpAddress.php on line 158
Habe dies heute in meinem php-error.log. Möchte gerne wissen, ob ich etwas daran ändern kann, dass dies nicht mehr vorkommt - sprich, den dort genannten Vorschlag beachten?!

Oder füge ich mit dieser vorgeschlagenen Einstellung KeyHelp einen "Schaden" zu?

Re: PHP JIT memory failed awstats

Posted: Mon 11. Jul 2022, 09:40
by Alexander
Grüße,

Benutzt du noch KeyHelp < 21.3? Die read-only Nachrichten lassen darauf schließen. In dem Thread gings es auch um JIT.

-> viewtopic.php?t=10981

Re: PHP JIT memory failed awstats

Posted: Mon 11. Jul 2022, 10:45
by Henning
Nein, es ist 22.0.1 (Build 2660) installiert.

Möchtest du noch andere Logs oder Abfragen von mir haben oder soll ich das einfach so "hinnehmen"?

Re: PHP JIT memory failed awstats

Posted: Mon 11. Jul 2022, 11:23
by Alexander
Zeig mir bitte mal den Inhalt von

Code: Select all

/lib/systemd/system/logrotate.service

Re: PHP JIT memory failed awstats

Posted: Mon 11. Jul 2022, 11:54
by Henning
[Unit]
Description=Rotate log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
RequiresMountsFor=/var/log
ConditionACPower=true

[Service]
Type=oneshot
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf

# performance options
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

# hardening options
# details: https://www.freedesktop.org/software/sy ... .exec.html
# no ProtectHome for userdir logs
# no PrivateNetwork for mail deliviery
# no NoNewPrivileges for third party rotate scripts
# no RestrictSUIDSGID for creating setgid directories
LockPersonality=true
MemoryDenyWriteExecute=true
PrivateDevices=true
PrivateTmp=true
ProtectClock=true
ProtectControlGroups=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=full
RestrictNamespaces=true
RestrictRealtime=true

Re: PHP JIT memory failed awstats  [SOLVED]

Posted: Mon 11. Jul 2022, 13:41
by Alexander
Sagst mir noch schnell, was für eine OS-Version du benutzt?

Seit 21.3 wird bei den Systemen Debian 10 / Debian 11 / Ubuntu 20 noch folgender Zusatz in der Datei ergänzt:

Code: Select all

# Exception so that AWStats works without complaints
ReadWritePaths=/etc/awstats
Das folgende wäre die vollständige /lib/systemd/system/logrotate.service, wie sie seit 21.3 ausgespielt wird.

Code: Select all

[Unit]
Description=Rotate log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
ConditionACPower=true

[Service]
Type=oneshot
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf

# performance options
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

# hardening options
#  details: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
#  no ProtectHome for userdir logs
#  no PrivateNetwork for mail deliviery
#  no ProtectKernelTunables for working SELinux with systemd older than 235
#  no MemoryDenyWriteExecute for gzip on i686
PrivateDevices=true
PrivateTmp=true
ProtectControlGroups=true
ProtectKernelModules=true
ProtectSystem=full
RestrictRealtime=true

# Exception so that AWStats works without complaints
ReadWritePaths=/etc/awstats

Wenn du also entweder den Zusatz, oder gleich die komplette Datei übernimmst und anschließend:

Code: Select all

systemctl daemon-reload
ausrufst, sollte die JIT Meldung beim nächsten Logrotate + AWStats lauf (also bei dir: 17-Jul-2022 03:xx:xx) nicht mehr auftauchen.

Re: PHP JIT memory failed awstats

Posted: Mon 11. Jul 2022, 14:52
by Henning
Sagst mir noch schnell, was für eine OS-Version du benutzt?
Debian 11.4, das System wurde damals frisch auf ein Debian 11.2 gespielt.
# Exception so that AWStats works without complaints
ReadWritePaths=/etc/awstats
Alles klar, füge ich unten ein und führe einen reload durch.

Vielen Dank für die Hilfe.

Re: PHP JIT memory failed awstats

Posted: Tue 12. Jul 2022, 09:03
by mrpink
Habe letzte Woche 21.3 auf ein Debian 11.4 frisch installiert und kann die gleiche Beobachtung machen.

Und der Eintrag ReadWritePaths existiert hier auch nicht in der logrotate.service Datei.

Re: PHP JIT memory failed awstats

Posted: Tue 12. Jul 2022, 09:28
by Alexander
Du meinst sicher 22.0.1.

Sobald ein System != Ubuntu 18 zum Einsatz kommt, wird diese Datei von KeyHelp geschrieben.
Wenn es zu einem späteren Zeitpunkt nicht mehr in der Datei steht, wurde die Datei von anderer Stelle überschrieben, das liegt dann außerhalb des Einflussbereichs von KeyHelp.
Wenn es noch nie in der Datei stand, steht in der Datei /var/log/keyhelp/install.log warum dem so ist.

Re: PHP JIT memory failed awstats

Posted: Tue 12. Jul 2022, 10:19
by mrpink
Ja natürlich 22.0.1, keine Ahnung wie ich auf 21.3 gekommen bin. :lol:

Habe soeben zum Testen eine neue VM deployed und erneut KeyHelp installiert und jetzt ist der Eintrag drin.
Sehr seltsam, da muss wirklich die Datei nachträglich geändert worden sein. Aber definitiv nicht von mir. Ich werde weiter beobachten.

Edit:
Ursache soeben gefunden, am 10.7. gab es ein logrotate update. Hier der apt history Auszug.

Code: Select all

Start-Date: 2022-07-10  03:01:07
Commandline: apt-get -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -y upgrade
Upgrade: dpkg:amd64 (1.20.10, 1.20.11), openssh-client:amd64 (1:8.4p1-5, 1:8.4p1-5+deb11u1), libfribidi0:amd64 (1.0.8-2, 1.0.8-2+deb11u1), libfreetype6:amd64 (2.10.4+dfsg-1, 2.10.4+dfsg-1+deb11u1), logrotate:amd64 (3.18.0-2, 3.18.0-2+deb11u1), openssh-server:amd64 (1:8.4p1-5, 1:8.4p1-5+deb11u1), apache2-suexec-custom:amd64 (2.4.53-1~deb11u1, 2.4.54-1~deb11u1), apache2-data:amd64 (2.4.53-1~deb11u1, 2.4.54-1~deb11u1), apache2-bin:amd64 (2.4.53-1~deb11u1, 2.4.54-1~deb11u1), bash:amd64 (5.1-2+b3, 5.1-2+deb11u1), base-files:amd64 (11.1+deb11u3, 11.1+deb11u4), distro-info-data:amd64 (0.51+deb11u1, 0.51+deb11u2), apache2-utils:amd64 (2.4.53-1~deb11u1, 2.4.54-1~deb11u1), openssh-sftp-server:amd64 (1:8.4p1-5, 1:8.4p1-5+deb11u1), nano:amd64 (5.4-2, 5.4-2+deb11u1), postfix-mysql:amd64 (3.5.6-1+b1, 3.5.13-0+deb11u1), apache2:amd64 (2.4.53-1~deb11u1, 2.4.54-1~deb11u1), libgnutls30:amd64 (3.7.1-5, 3.7.1-5+deb11u1), postfix:amd64 (3.5.6-1+b1, 3.5.13-0+deb11u1), linux-libc-dev:amd64 (5.10.120-1, 5.10.127-1)
End-Date: 2022-07-10  03:01:15

Re: PHP JIT memory failed awstats

Posted: Tue 12. Jul 2022, 11:08
by Alexander
Okay, das wäre natürlich ungünstig, wenn trotz --force-confold diese Dateien bei apt-get upgrade überschrieben werden.

Ich schreib es mir mal auf, das bei Gelegenheit mal näher zu untersuchen.

Re: PHP JIT memory failed awstats

Posted: Tue 29. Nov 2022, 21:53
by rbngr
Ich bin da gerade auch zufällig drüber gestolpert, Debian 11, aber die Installation ist schon was älter.

Re: PHP JIT memory failed awstats

Posted: Sun 11. Feb 2024, 09:49
by blickgerecht
Guten Morgen,

ich hatte den Fehler vergangenes Jahr auch und konnte ihn lösen, mit Hilfe der der Ergänzung von:

Code: Select all

# Exception so that AWStats works without complaints
ReadWritePaths=/etc/awstats

Nach Update auf Version 24.0 und anschließendem Upgrade von Debian 11 auf 12 ist der Fehler wieder aufgetreten. Ich habe gerade eben erneut die zwei Zeilen in /lib/systemd/system/logrotate.service ergänzt – sie hatten wieder gefehlt. Ich schätze, der Fehler ist damit wieder behoben.

Vielleicht hat ja noch jmd. erneut das gleiche Problem. Evtl. ließe sich das auch im Update- oder Upgrade-Skript ergänzen? :)

Re: PHP JIT memory failed awstats

Posted: Mon 11. Mar 2024, 10:27
by blickgerecht
Hallo zusammen,

nach dem Update auf Version 24.0 und anschließendem Upgrade von Debian 11 auf 12 kamen ja wieder die "alten" Fehler auf. Daraufhin habe ich in /lib/systemd/system/logrotate.service wieder folgende Zeilen ergänzt, die gefehlt hatten:

Code: Select all

# Exception so that AWStats works without complaints
ReadWritePaths=/etc/awstats
Leider hat das das Problem diesmal nicht behoben, wie ich erst dachte. Jeden Sonntag um 0 Uhr die gleichen Einträge:

Code: Select all

[10-Mar-2024 00:00:08 Europe/Berlin] PHP Warning:  preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Utilities/IpAddress.php on line 175
[10-Mar-2024 00:00:08 Europe/Berlin] PHP Warning:  preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Utilities/IpAddress.php on line 175
[10-Mar-2024 00:00:09 Europe/Berlin] PHP Warning:  preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Utilities/IpAddress.php on line 175
[10-Mar-2024 00:00:10 Europe/Berlin] PHP Warning:  preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /home/keyhelp/www/keyhelp/core/Utilities/IpAddress.php on line 175
Könnte ich noch etwas anderes tun?

Re: PHP JIT memory failed awstats

Posted: Wed 13. Mar 2024, 14:03
by blickgerecht
Weil ich gerade durch ein anderes Thema (viewtopic.php?t=13102) noch einmal darauf kam …

Anhand des Lösungsvorschlags sollte das Problem ja in Zusammenhang mit AWStats stehen. Ich habe mal in die Statistiken geschaut, da sieht für mich erst einmal alles aktuell und "normal" aus. Den Eintrag dazu hatte ich ja auch bei Logrotate ergänzt. Der Server wurde seitdem auch schon mehrmals neugestartet, also sollten die Änderungen auf jeden Fall übernommen worden sein.

Mir ist zudem aufgefallen, dass es in der Fehlermeldung zu Beginn des Themas zwar um die gleiche Datei ging:

Code: Select all

/home/keyhelp/www/keyhelp/core/Utilities/IpAddress.php
Allerdings war es zu Beginn Zeile 158, in meiner Fehlermeldung Zeile 175.

Ggf. liegt das einfach am Upgrade und einem geänderten Skript, oder ist das Problem ggf. sogar ein ganz anderes als Logrotate?