PHP JIT memory failed awstats  [SOLVED]

For topics beyond KeyHelp. / Für Themen jenseits von KeyHelp.
User avatar
Henning
Posts: 116
Joined: Wed 6. Apr 2022, 16:19
Location: Oldenburg
Contact:

PHP JIT memory failed awstats

Post 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?
Freundliche Grüße von Henning
User avatar
Alexander
Keyweb AG
Posts: 3809
Joined: Wed 20. Jan 2016, 02:23

Re: PHP JIT memory failed awstats

Post 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
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Henning
Posts: 116
Joined: Wed 6. Apr 2022, 16:19
Location: Oldenburg
Contact:

Re: PHP JIT memory failed awstats

Post 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"?
Freundliche Grüße von Henning
User avatar
Alexander
Keyweb AG
Posts: 3809
Joined: Wed 20. Jan 2016, 02:23

Re: PHP JIT memory failed awstats

Post by Alexander »

Zeig mir bitte mal den Inhalt von

Code: Select all

/lib/systemd/system/logrotate.service
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Henning
Posts: 116
Joined: Wed 6. Apr 2022, 16:19
Location: Oldenburg
Contact:

Re: PHP JIT memory failed awstats

Post 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
Freundliche Grüße von Henning
User avatar
Alexander
Keyweb AG
Posts: 3809
Joined: Wed 20. Jan 2016, 02:23

Re: PHP JIT memory failed awstats  [SOLVED]

Post 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.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Henning
Posts: 116
Joined: Wed 6. Apr 2022, 16:19
Location: Oldenburg
Contact:

Re: PHP JIT memory failed awstats

Post 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.
Freundliche Grüße von Henning
mrpink
Posts: 2
Joined: Sun 10. Jul 2022, 22:38

Re: PHP JIT memory failed awstats

Post 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.
User avatar
Alexander
Keyweb AG
Posts: 3809
Joined: Wed 20. Jan 2016, 02:23

Re: PHP JIT memory failed awstats

Post 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.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
mrpink
Posts: 2
Joined: Sun 10. Jul 2022, 22:38

Re: PHP JIT memory failed awstats

Post 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
User avatar
Alexander
Keyweb AG
Posts: 3809
Joined: Wed 20. Jan 2016, 02:23

Re: PHP JIT memory failed awstats

Post 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.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
rbngr
Posts: 18
Joined: Sat 27. Apr 2019, 15:47
Location: Brakel
Contact:

Re: PHP JIT memory failed awstats

Post by rbngr »

Ich bin da gerade auch zufällig drüber gestolpert, Debian 11, aber die Installation ist schon was älter.
blickgerecht
Posts: 53
Joined: Tue 28. Nov 2023, 17:52

Re: PHP JIT memory failed awstats

Post 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? :)
Grüße
Roland
blickgerecht
Posts: 53
Joined: Tue 28. Nov 2023, 17:52

Re: PHP JIT memory failed awstats

Post 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?
Grüße
Roland
blickgerecht
Posts: 53
Joined: Tue 28. Nov 2023, 17:52

Re: PHP JIT memory failed awstats

Post 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?
Grüße
Roland
Post Reply