Benjamin-Loison / YouTube-operational-API

YouTube operational API works when YouTube Data API v3 fails.
401 stars 52 forks source link

`commentThreads` with specific `id` returns HTTP error 500 #303

Open Benjamin-Loison opened 2 months ago

Benjamin-Loison commented 2 months ago

@MauroCSHPYP you have commented an inappropriate issue, I opened this one with your previous message that I removed:

As a follow-up of this Stack Overflow question, it seems like error 500 is also returned in this endpoint - commentThreads:

Example:

https://yt.lemnoslife.com/commentThreads?part=snippet,replies&id=UgwJSPbq_dQWcHA2cmB4AaABAg.9eJBArFtonn9eN4Aj6bGRG&videoId=8aoxPTJyW0Q

But, with other commentThreads, the endpoints returns 200 - OK:

Working:

https://yt.lemnoslife.com/commentThreads?part=snippet,replies&id=UgzEfRi4gKKHQiHPvex4AaABAg&videoId=ml7GWjIhYsw

Looking at the "Network" tab on the DevTools of the browser, the error 500 is due to internal server error - this could be an unhandled error (exception) or a timeout?

{3C414146-596C-4906-972D-736F0345B9AF}

Benjamin-Loison commented 2 months ago

The video you mentioned is private, hence a clean error message would be nice but there is no data to retrieve.

Benjamin-Loison commented 2 months ago

It seems that the following comments should be in #301.

https://discord.com/channels/933841502155706418/933841503103627316/1284625717359022162

curl https://yt.lemnoslife.com
curl -k https://localhost
curl http://localhost

stall from the official instance.

On my laptop:

curl https://yt.lemnoslife.com
curl: (28) Failed to connect to yt.lemnoslife.com port 443 after 136304 ms: Couldn't connect to server
htop

    0[||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 361, 398 thr, 142 kthr; 4 running
    1[||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Load average: 252.61 252.44 244.08 
    2[||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%] Uptime: 04:31:16
    3[||||||||||||||||||||||||||||||||||||||||||||||||||||||||100.0%]
  Mem[|||||||||||||||                                    1.98G/23.4G]
  Swp[                                                      0K/24.0G]

    PID USER       PRI  NI  VIRT   RES   SHR S  CPU%▽MEM%   TIME+  Command
 104437 root        20   0  581M  158M 69120 R   7.2  0.7  0:00.11 mongosh localhost:27017/test --quiet
    995 systemd-re  20   0 21632 12416 10240 S   3.3  0.1  3:11.39 /usr/lib/systemd/systemd-resolved
  86857 www-data    20   0  207M 22412 15232 R   2.6  0.1  0:45.76 /usr/sbin/apache2 -k start
  86906 www-data    20   0  207M 22924 15616 R   2.6  0.1  0:45.61 /usr/sbin/apache2 -k start
  86910 www-data    20   0  207M 22668 15360 R   2.6  0.1  0:45.56 /usr/sbin/apache2 -k start
  86961 www-data    20   0  207M 22412 15104 R   2.6  0.1  0:45.24 /usr/sbin/apache2 -k start
  87109 www-data    20   0  207M 22668 15488 R   2.6  0.1  0:44.95 /usr/sbin/apache2 -k start
  85662 www-data    20   0  207M 25412 16384 R   2.0  0.1  0:48.70 /usr/sbin/apache2 -k start
  86160 www-data    20   0  207M 23052 15616 R   2.0  0.1  0:48.64 /usr/sbin/apache2 -k start
  86199 www-data    20   0  207M 24760 16128 R   2.0  0.1  0:48.44 /usr/sbin/apache2 -k start
  86201 www-data    20   0  207M 23948 15872 R   2.0  0.1  0:48.93 /usr/sbin/apache2 -k start
  86204 www-data    20   0  207M 24588 16000 R   2.0  0.1  0:46.66 /usr/sbin/apache2 -k start
  86208 www-data    20   0  207M 24844 16128 R   2.0  0.1  0:49.05 /usr/sbin/apache2 -k start
  86212 www-data    20   0  207M 23308 15744 R   2.0  0.1  0:48.42 /usr/sbin/apache2 -k start
  86591 www-data    20   0  207M 23052 15744 R   2.0  0.1  0:46.21 /usr/sbin/apache2 -k start
  86596 www-data    20   0  207M 22412 15104 R   2.0  0.1  0:46.88 /usr/sbin/apache2 -k start
  86597 www-data    20   0  207M 22668 15360 R   2.0  0.1  0:47.08 /usr/sbin/apache2 -k start
  86598 www-data    20   0  207M 22412 15232 R   2.0  0.1  0:46.84 /usr/sbin/apache2 -k start
  86603 www-data    20   0  207M 22796 15488 R   2.0  0.1  0:46.41 /usr/sbin/apache2 -k start
  86605 www-data    20   0  207M 22668 15360 R   2.0  0.1  0:47.10 /usr/sbin/apache2 -k start
  86607 www-data    20   0  207M 22668 15360 R   2.0  0.1  0:46.85 /usr/sbin/apache2 -k start
  86612 www-data    20   0  207M 22540 15360 R   2.0  0.1  0:46.57 /usr/sbin/apache2 -k start
  86614 www-data    20   0  207M 23052 15744 R   2.0  0.1  0:45.96 /usr/sbin/apache2 -k start
  86617 www-data    20   0  207M 22924 15616 R   2.0  0.1  0:46.34 /usr/sbin/apache2 -k start
  86623 www-data    20   0  207M 24512 16000 R   2.0  0.1  0:46.37 /usr/sbin/apache2 -k start
  86663 www-data    20   0  207M 23052 15744 R   2.0  0.1  0:46.24 /usr/sbin/apache2 -k start
  86670 www-data    20   0  207M 22540 15232 R   2.0  0.1  0:46.08 /usr/sbin/apache2 -k start
  86757 www-data    20   0  207M 22284 15104 R   2.0  0.1  0:45.99 /usr/sbin/apache2 -k start
F1Help  F2Setup F3SearchF4FilterF5Tree  F6SortByF7Nice -F8Nice +F9Kill  F10Quit  
sudo service apache2 restart

seems to help but only temporarily.

The issue does not happen when yt.lemnoslife.com is not redirecting to this instance.

Benjamin-Loison commented 2 months ago
sudo service apache2 status | cat
Output: ``` ● apache2.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled) Active: active (running) since Sat 2024-09-14 21:39:03 UTC; 1h 54min ago Docs: https://httpd.apache.org/docs/2.4/ Process: 63406 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 63410 (apache2) Tasks: 257 (limit: 28693) Memory: 858.8M (peak: 935.4M) CPU: 5h 47.614s CGroup: /system.slice/apache2.service ├─63410 /usr/sbin/apache2 -k start ├─85662 /usr/sbin/apache2 -k start ├─85954 /usr/sbin/apache2 -k start ├─86160 /usr/sbin/apache2 -k start ├─86172 /usr/sbin/apache2 -k start ├─86178 /usr/sbin/apache2 -k start ├─86179 /usr/sbin/apache2 -k start ├─86189 /usr/sbin/apache2 -k start ├─86196 /usr/sbin/apache2 -k start ├─86199 /usr/sbin/apache2 -k start ├─86201 /usr/sbin/apache2 -k start ├─86202 /usr/sbin/apache2 -k start ├─86204 /usr/sbin/apache2 -k start ├─86208 /usr/sbin/apache2 -k start ├─86212 /usr/sbin/apache2 -k start ├─86215 /usr/sbin/apache2 -k start ├─86220 /usr/sbin/apache2 -k start ├─86225 /usr/sbin/apache2 -k start ├─86226 /usr/sbin/apache2 -k start ├─86232 /usr/sbin/apache2 -k start ├─86578 /usr/sbin/apache2 -k start ├─86589 /usr/sbin/apache2 -k start ├─86590 /usr/sbin/apache2 -k start ├─86591 /usr/sbin/apache2 -k start ├─86592 /usr/sbin/apache2 -k start ├─86593 /usr/sbin/apache2 -k start ├─86594 /usr/sbin/apache2 -k start ├─86595 /usr/sbin/apache2 -k start ├─86596 /usr/sbin/apache2 -k start ├─86597 /usr/sbin/apache2 -k start ├─86598 /usr/sbin/apache2 -k start ├─86599 /usr/sbin/apache2 -k start ├─86600 /usr/sbin/apache2 -k start ├─86601 /usr/sbin/apache2 -k start ├─86602 /usr/sbin/apache2 -k start ├─86603 /usr/sbin/apache2 -k start ├─86604 /usr/sbin/apache2 -k start ├─86605 /usr/sbin/apache2 -k start ├─86606 /usr/sbin/apache2 -k start ├─86607 /usr/sbin/apache2 -k start ├─86609 /usr/sbin/apache2 -k start ├─86610 /usr/sbin/apache2 -k start ├─86611 /usr/sbin/apache2 -k start ├─86612 /usr/sbin/apache2 -k start ├─86613 /usr/sbin/apache2 -k start ├─86614 /usr/sbin/apache2 -k start ├─86615 /usr/sbin/apache2 -k start ├─86616 /usr/sbin/apache2 -k start ├─86617 /usr/sbin/apache2 -k start ├─86618 /usr/sbin/apache2 -k start ├─86621 /usr/sbin/apache2 -k start ├─86622 /usr/sbin/apache2 -k start ├─86623 /usr/sbin/apache2 -k start ├─86660 /usr/sbin/apache2 -k start ├─86661 /usr/sbin/apache2 -k start ├─86663 /usr/sbin/apache2 -k start ├─86664 /usr/sbin/apache2 -k start ├─86665 /usr/sbin/apache2 -k start ├─86666 /usr/sbin/apache2 -k start ├─86667 /usr/sbin/apache2 -k start ├─86668 /usr/sbin/apache2 -k start ├─86669 /usr/sbin/apache2 -k start ├─86670 /usr/sbin/apache2 -k start ├─86671 /usr/sbin/apache2 -k start ├─86672 /usr/sbin/apache2 -k start ├─86755 /usr/sbin/apache2 -k start ├─86756 /usr/sbin/apache2 -k start ├─86757 /usr/sbin/apache2 -k start ├─86767 /usr/sbin/apache2 -k start ├─86768 /usr/sbin/apache2 -k start ├─86770 /usr/sbin/apache2 -k start ├─86789 /usr/sbin/apache2 -k start ├─86790 /usr/sbin/apache2 -k start ├─86791 /usr/sbin/apache2 -k start ├─86811 /usr/sbin/apache2 -k start ├─86812 /usr/sbin/apache2 -k start ├─86813 /usr/sbin/apache2 -k start ├─86827 /usr/sbin/apache2 -k start ├─86829 /usr/sbin/apache2 -k start ├─86830 /usr/sbin/apache2 -k start ├─86831 /usr/sbin/apache2 -k start ├─86832 /usr/sbin/apache2 -k start ├─86833 /usr/sbin/apache2 -k start ├─86834 /usr/sbin/apache2 -k start ├─86835 /usr/sbin/apache2 -k start ├─86836 /usr/sbin/apache2 -k start ├─86837 /usr/sbin/apache2 -k start ├─86838 /usr/sbin/apache2 -k start ├─86839 /usr/sbin/apache2 -k start ├─86840 /usr/sbin/apache2 -k start ├─86841 /usr/sbin/apache2 -k start ├─86842 /usr/sbin/apache2 -k start ├─86843 /usr/sbin/apache2 -k start ├─86844 /usr/sbin/apache2 -k start ├─86845 /usr/sbin/apache2 -k start ├─86846 /usr/sbin/apache2 -k start ├─86847 /usr/sbin/apache2 -k start ├─86848 /usr/sbin/apache2 -k start ├─86849 /usr/sbin/apache2 -k start ├─86850 /usr/sbin/apache2 -k start ├─86851 /usr/sbin/apache2 -k start ├─86852 /usr/sbin/apache2 -k start ├─86853 /usr/sbin/apache2 -k start ├─86854 /usr/sbin/apache2 -k start ├─86855 /usr/sbin/apache2 -k start ├─86856 /usr/sbin/apache2 -k start ├─86857 /usr/sbin/apache2 -k start ├─86864 /usr/sbin/apache2 -k start ├─86868 /usr/sbin/apache2 -k start ├─86885 /usr/sbin/apache2 -k start ├─86886 /usr/sbin/apache2 -k start ├─86887 /usr/sbin/apache2 -k start ├─86899 /usr/sbin/apache2 -k start ├─86900 /usr/sbin/apache2 -k start ├─86901 /usr/sbin/apache2 -k start ├─86902 /usr/sbin/apache2 -k start ├─86903 /usr/sbin/apache2 -k start ├─86904 /usr/sbin/apache2 -k start ├─86905 /usr/sbin/apache2 -k start ├─86906 /usr/sbin/apache2 -k start ├─86907 /usr/sbin/apache2 -k start ├─86908 /usr/sbin/apache2 -k start ├─86909 /usr/sbin/apache2 -k start ├─86910 /usr/sbin/apache2 -k start ├─86911 /usr/sbin/apache2 -k start ├─86912 /usr/sbin/apache2 -k start ├─86913 /usr/sbin/apache2 -k start ├─86914 /usr/sbin/apache2 -k start ├─86915 /usr/sbin/apache2 -k start ├─86916 /usr/sbin/apache2 -k start ├─86917 /usr/sbin/apache2 -k start ├─86918 /usr/sbin/apache2 -k start ├─86919 /usr/sbin/apache2 -k start ├─86920 /usr/sbin/apache2 -k start ├─86921 /usr/sbin/apache2 -k start ├─86922 /usr/sbin/apache2 -k start ├─86923 /usr/sbin/apache2 -k start ├─86924 /usr/sbin/apache2 -k start ├─86925 /usr/sbin/apache2 -k start ├─86926 /usr/sbin/apache2 -k start ├─86927 /usr/sbin/apache2 -k start ├─86928 /usr/sbin/apache2 -k start ├─86929 /usr/sbin/apache2 -k start ├─86930 /usr/sbin/apache2 -k start ├─86931 /usr/sbin/apache2 -k start ├─86932 /usr/sbin/apache2 -k start ├─86933 /usr/sbin/apache2 -k start ├─86934 /usr/sbin/apache2 -k start ├─86935 /usr/sbin/apache2 -k start ├─86936 /usr/sbin/apache2 -k start ├─86937 /usr/sbin/apache2 -k start ├─86938 /usr/sbin/apache2 -k start ├─86939 /usr/sbin/apache2 -k start ├─86940 /usr/sbin/apache2 -k start ├─86942 /usr/sbin/apache2 -k start ├─86943 /usr/sbin/apache2 -k start ├─86944 /usr/sbin/apache2 -k start ├─86945 /usr/sbin/apache2 -k start ├─86946 /usr/sbin/apache2 -k start ├─86947 /usr/sbin/apache2 -k start ├─86949 /usr/sbin/apache2 -k start ├─86950 /usr/sbin/apache2 -k start ├─86951 /usr/sbin/apache2 -k start ├─86952 /usr/sbin/apache2 -k start ├─86953 /usr/sbin/apache2 -k start ├─86955 /usr/sbin/apache2 -k start ├─86956 /usr/sbin/apache2 -k start ├─86957 /usr/sbin/apache2 -k start ├─86958 /usr/sbin/apache2 -k start ├─86959 /usr/sbin/apache2 -k start ├─86960 /usr/sbin/apache2 -k start ├─86961 /usr/sbin/apache2 -k start ├─86962 /usr/sbin/apache2 -k start ├─87003 /usr/sbin/apache2 -k start ├─87004 /usr/sbin/apache2 -k start ├─87005 /usr/sbin/apache2 -k start ├─87006 /usr/sbin/apache2 -k start ├─87007 /usr/sbin/apache2 -k start ├─87008 /usr/sbin/apache2 -k start ├─87009 /usr/sbin/apache2 -k start ├─87010 /usr/sbin/apache2 -k start ├─87011 /usr/sbin/apache2 -k start ├─87012 /usr/sbin/apache2 -k start ├─87013 /usr/sbin/apache2 -k start ├─87014 /usr/sbin/apache2 -k start ├─87015 /usr/sbin/apache2 -k start ├─87016 /usr/sbin/apache2 -k start ├─87017 /usr/sbin/apache2 -k start ├─87020 /usr/sbin/apache2 -k start ├─87021 /usr/sbin/apache2 -k start ├─87022 /usr/sbin/apache2 -k start ├─87023 /usr/sbin/apache2 -k start ├─87024 /usr/sbin/apache2 -k start ├─87026 /usr/sbin/apache2 -k start ├─87028 /usr/sbin/apache2 -k start ├─87029 /usr/sbin/apache2 -k start ├─87030 /usr/sbin/apache2 -k start ├─87031 /usr/sbin/apache2 -k start ├─87032 /usr/sbin/apache2 -k start ├─87033 /usr/sbin/apache2 -k start ├─87034 /usr/sbin/apache2 -k start ├─87035 /usr/sbin/apache2 -k start ├─87070 /usr/sbin/apache2 -k start ├─87071 /usr/sbin/apache2 -k start ├─87072 /usr/sbin/apache2 -k start ├─87073 /usr/sbin/apache2 -k start ├─87074 /usr/sbin/apache2 -k start ├─87075 /usr/sbin/apache2 -k start ├─87076 /usr/sbin/apache2 -k start ├─87079 /usr/sbin/apache2 -k start ├─87080 /usr/sbin/apache2 -k start ├─87081 /usr/sbin/apache2 -k start ├─87082 /usr/sbin/apache2 -k start ├─87083 /usr/sbin/apache2 -k start ├─87084 /usr/sbin/apache2 -k start ├─87085 /usr/sbin/apache2 -k start ├─87086 /usr/sbin/apache2 -k start ├─87087 /usr/sbin/apache2 -k start ├─87088 /usr/sbin/apache2 -k start ├─87089 /usr/sbin/apache2 -k start ├─87090 /usr/sbin/apache2 -k start ├─87091 /usr/sbin/apache2 -k start ├─87092 /usr/sbin/apache2 -k start ├─87093 /usr/sbin/apache2 -k start ├─87094 /usr/sbin/apache2 -k start ├─87095 /usr/sbin/apache2 -k start ├─87096 /usr/sbin/apache2 -k start ├─87097 /usr/sbin/apache2 -k start ├─87098 /usr/sbin/apache2 -k start ├─87099 /usr/sbin/apache2 -k start ├─87100 /usr/sbin/apache2 -k start ├─87101 /usr/sbin/apache2 -k start ├─87102 /usr/sbin/apache2 -k start ├─87105 /usr/sbin/apache2 -k start ├─87106 /usr/sbin/apache2 -k start ├─87107 /usr/sbin/apache2 -k start ├─87108 /usr/sbin/apache2 -k start ├─87109 /usr/sbin/apache2 -k start ├─87110 /usr/sbin/apache2 -k start ├─87111 /usr/sbin/apache2 -k start ├─87112 /usr/sbin/apache2 -k start ├─87113 /usr/sbin/apache2 -k start ├─87114 /usr/sbin/apache2 -k start ├─87115 /usr/sbin/apache2 -k start ├─87117 /usr/sbin/apache2 -k start ├─87118 /usr/sbin/apache2 -k start ├─87119 /usr/sbin/apache2 -k start ├─87120 /usr/sbin/apache2 -k start ├─87121 /usr/sbin/apache2 -k start ├─87122 /usr/sbin/apache2 -k start ├─87123 /usr/sbin/apache2 -k start ├─87124 /usr/sbin/apache2 -k start ├─87125 /usr/sbin/apache2 -k start ├─87126 /usr/sbin/apache2 -k start ├─87127 /usr/sbin/apache2 -k start ├─87128 /usr/sbin/apache2 -k start └─87165 /usr/sbin/apache2 -k start Sep 14 21:39:03 instance-20230827-2235 systemd[1]: Starting apache2.service - The Apache HTTP Server... Sep 14 21:39:03 instance-20230827-2235 apachectl[63408]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message Sep 14 21:39:03 instance-20230827-2235 apachectl[63408]: AH00180: WARNING: MaxRequestWorkers of 1000 exceeds ServerLimit value of 256 servers, decreasing MaxRequestWorkers to 256. To increase, please see the ServerLimit directive. Sep 14 21:39:03 instance-20230827-2235 systemd[1]: Started apache2.service - The Apache HTTP Server. ``` Note: ``` Sep 14 21:39:03 instance-20230827-2235 apachectl[63408]: AH00180: WARNING: MaxRequestWorkers of 1000 exceeds ServerLimit value of 256 servers, decreasing MaxRequestWorkers to 256. To increase, please see the ServerLimit directive. ``` it directly follows `sudo service apache2 restart`, is it the case when not being pointed to by `yt.lemnslife.com`?
Benjamin-Loison commented 2 months ago

Using FileZilla:

diff -qr apache2-{official,private}-instance
Output: ``` Files apache2-official-instance/apache2.conf and apache2-private-instance/apache2.conf differ Only in apache2-official-instance: apache2.conf.dpkg-dist Only in apache2-official-instance/conf-available: php8.3-cgi.conf Files apache2-official-instance/mods-available/mpm_event.conf and apache2-private-instance/mods-available/mpm_event.conf differ Files apache2-official-instance/mods-available/mpm_prefork.conf and apache2-private-instance/mods-available/mpm_prefork.conf differ Files apache2-official-instance/mods-available/mpm_worker.conf and apache2-private-instance/mods-available/mpm_worker.conf differ Only in apache2-official-instance/mods-available: php8.0.conf Only in apache2-official-instance/mods-available: php8.0.load Only in apache2-private-instance/mods-available: php8.1.conf Only in apache2-private-instance/mods-available: php8.1.load Only in apache2-official-instance/mods-available: proxy_connect.conf Files apache2-official-instance/mods-enabled/mpm_prefork.conf and apache2-private-instance/mods-enabled/mpm_prefork.conf differ Files apache2-official-instance/mods-enabled/php8.3.conf and apache2-private-instance/mods-enabled/php8.3.conf differ Files apache2-official-instance/sites-available/000-default.conf and apache2-private-instance/sites-available/000-default.conf differ Only in apache2-official-instance/sites-available: 000-default.conf.dpkg-dist Files apache2-official-instance/sites-available/000-default-le-ssl.conf and apache2-private-instance/sites-available/000-default-le-ssl.conf differ Files apache2-official-instance/sites-enabled/000-default.conf and apache2-private-instance/sites-enabled/000-default.conf differ Files apache2-official-instance/sites-enabled/000-default-le-ssl.conf and apache2-private-instance/sites-enabled/000-default-le-ssl.conf differ ```

Both instances are up-to-date.

Benjamin-Loison commented 2 months ago

Probably related to #165.

Benjamin-Loison commented 2 months ago
find /etc/apache2/ -name 'mpm_prefork'

Source: the Stack Overflow answer 46173001

does not return anything.

find /etc/apache2/ -name 'mpm_prefork*'
/etc/apache2/mods-available/mpm_prefork.load
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-enabled/mpm_prefork.load
/etc/apache2/mods-enabled/mpm_prefork.conf

Source: the Stack Overflow answer 37057176

ls -lh /etc/apache2/mods-enabled/mpm_prefork.{load,conf}
lrwxrwxrwx 1 root root 34 Aug 27  2023 /etc/apache2/mods-enabled/mpm_prefork.conf -> ../mods-available/mpm_prefork.conf
lrwxrwxrwx 1 root root 34 Aug 27  2023 /etc/apache2/mods-enabled/mpm_prefork.load -> ../mods-available/mpm_prefork.load

/etc/apache2/mods-enabled/mpm_prefork.load:

# Conflicts: mpm_event mpm_worker
LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so

/etc/apache2/mods-available/mpm_prefork.conf:

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of requests a server process serves

StartServers            5
MinSpareServers         5
MaxSpareServers         10
MaxRequestWorkers       1000
MaxConnectionsPerChild  0

Private instance is set by default to:

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of requests a server process serves

StartServers            5
MinSpareServers         5
MaxSpareServers         10
MaxRequestWorkers       150
MaxConnectionsPerChild  0

Let us try:

StartServers            10
MinSpareServers         10
MaxSpareServers         20
MaxRequestWorkers       1500
MaxConnectionsPerChild  10000

Source: the Stack Overflow answer 46173001

sudo service apache2 restart
sudo service apache2 status
...
Sep 14 23:53:03 instance-20230827-2235 apachectl[113030]: AH00180: WARNING: MaxRequestWorkers of 1500 exceeds ServerLimit value of 256 servers, decreasing MaxRequestWorkers to 256. To increase, please see the ServerLimit directive.
...

Adding:

ServerLimit             2000

as mentioned in the Stack Overflow answer removes the warning.

Benjamin-Loison commented 2 months ago

Maybe YouTube Data API v3 servers involve this latency.

From the official instance:

time curl -s 'https://www.googleapis.com/youtube/v3/videos?part=snippet&id=_ZPpU7774DQ&key=AIzaSyDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
...
real    0m0.077s
user    0m0.041s
sys 0m0.005s

with correct output.

So YouTube servers do not seem to blame.

Benjamin-Loison commented 2 months ago

The Server Fault question 383526 may help.

find /etc/apache2/ -name *mpm*
/etc/apache2/mods-available/mpm_event.load
/etc/apache2/mods-available/mpm_worker.conf
/etc/apache2/mods-available/mpm_worker.load
/etc/apache2/mods-available/mpm_prefork.load
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-available/mpm_event.conf
/etc/apache2/mods-enabled/mpm_prefork.load
/etc/apache2/mods-enabled/mpm_prefork.conf
Benjamin-Loison commented 2 months ago
a2dismod mpm_prefork
ERROR: The following modules depend on mpm_prefork and need to be disabled first: php8.3
a2enmod mpm_worker
Considering conflict mpm_event for mpm_worker:
Considering conflict mpm_prefork for mpm_worker:
ERROR: Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first!
a2dismod php8.3
ERROR: /etc/apache2/mods-enabled/php8.3.load is not a symbolic link, not deleting
Could not remove /etc/apache2/mods-enabled/php8.3.conf: Permission denied
sudo a2dismod php8.3
ERROR: /etc/apache2/mods-enabled/php8.3.load is not a symbolic link, not deleting
Module php8.3 disabled.
To activate the new configuration, you need to run:
  systemctl restart apache2
a2enmod mpm_worker
Considering conflict mpm_event for mpm_worker:
Considering conflict mpm_prefork for mpm_worker:
ERROR: Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first!
a2dismod mpm_prefork
ERROR: The following modules depend on mpm_prefork and need to be disabled first: php8.3
sudo service apache2 stop
a2dismod mpm_prefork
ERROR: The following modules depend on mpm_prefork and need to be disabled first: php8.3
sudo service apache2 start

PHP files are returned as is.

a2enmod php8.3
Considering dependency mpm_prefork for php8.3:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php8.3:
ERROR: Module php8.3 not properly enabled: /etc/apache2/mods-enabled/php8.3.load is a real file, not touching it
a2enmod mpm_prefork
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Benjamin-Loison commented 2 months ago
apachectl -V | grep -i mpm
Server MPM:     prefork

Source: the Ask Ubuntu answer 525035

No DuckDuckGo or Google result for "ERROR: The following modules depend on mpm_prefork and need to be disabled first: php".

Benjamin-Loison commented 2 months ago

The Stack Overflow answer 67538339:

sudo a2dismod php8.3 mpm_prefork
ERROR: /etc/apache2/mods-enabled/php8.3.load is not a symbolic link, not deleting
Module php8.3 disabled.
ERROR: The following modules depend on mpm_prefork and need to be disabled first: php8.3

does not help.

Benjamin-Loison commented 2 months ago

DuckDuckGo and Google results for install apache2 mpm worker are not clear too.

Benjamin-Loison commented 2 months ago

On Debian 12 temporary official instance:

sudo apachectl -V | grep -i mpm
Server MPM:     prefork
Benjamin-Loison commented 2 months ago

https://www.reddit.com/r/oraclecloud/comments/14pg5dr/oracle_always_free_service_have_boot_volume_cost/

Benjamin-Loison commented 2 months ago
do-release-upgrade
...
Setting up fdisk (2.39.3-9ubuntu6.1) ...
Setting up iptables-persistent (1.0.20) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 79.)
debconf: falling back to frontend: Readline
Configuring iptables-persistent
-------------------------------

Current iptables rules can be saved to the configuration file /etc/iptables/rules.v4. These rules will then be loaded automatically during
system startup.

Rules are only saved automatically during package installation. See the manual page of iptables-save(8) for instructions on keeping the
rules file up-to-date.

Save current IPv4 rules? [yes/no] y

Current iptables rules can be saved to the configuration file /etc/iptables/rules.v6. These rules will then be loaded automatically during
system startup.

Rules are only saved automatically during package installation. See the manual page of ip6tables-save(8) for instructions on keeping the
rules file up-to-date.

Save current IPv6 rules? [yes/no] y

Removing obsolete conffile /etc/systemd/system/netfilter-persistent.service.d/iptables.conf ...
Setting up libjson-glib-1.0-0:arm64 (1.8.0-2build2) ...
...
Benjamin-Loison commented 2 months ago
sudo apt purge -y apache2
Output: ``` Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: apache2-data apache2-utils Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: apache2* 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 465 kB disk space will be freed. (Reading database ... 184273 files and directories currently installed.) Removing apache2 (2.4.58-1ubuntu8.4) ... Processing triggers for man-db (2.12.0-4build2) ... (Reading database ... 184224 files and directories currently installed.) Purging configuration files for apache2 (2.4.58-1ubuntu8.4) ... dpkg: warning: while removing apache2, directory '/var/www/html' not empty so not removed dpkg: warning: while removing apache2, directory '/etc/apache2/sites-available' not empty so not removed dpkg: warning: while removing apache2, directory '/etc/apache2/mods-enabled' not empty so not removed ```
sudo apt autoremove -y
Output: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: apache2-data apache2-utils 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. After this operation, 1640 kB disk space will be freed. (Reading database ... 184058 files and directories currently installed.) Removing apache2-data (2.4.58-1ubuntu8.4) ... Removing apache2-utils (2.4.58-1ubuntu8.4) ... Processing triggers for man-db (2.12.0-4build2) ... ```
sudo apt install -y apache2
Output: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: apache2-data apache2-utils Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser ufw The following NEW packages will be installed: apache2 apache2-data apache2-utils 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 350 kB of archives. After this operation, 2105 kB of additional disk space will be used. Get:1 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 apache2-data all 2.4.58-1ubuntu8.4 [163 kB] Get:2 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 apache2-utils arm64 2.4.58-1ubuntu8.4 [96.3 kB] Get:3 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports noble-updates/main arm64 apache2 arm64 2.4.58-1ubuntu8.4 [90.2 kB] Fetched 350 kB in 0s (850 kB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package apache2-data. (Reading database ... 183738 files and directories currently installed.) Preparing to unpack .../apache2-data_2.4.58-1ubuntu8.4_all.deb ... Unpacking apache2-data (2.4.58-1ubuntu8.4) ... Selecting previously unselected package apache2-utils. Preparing to unpack .../apache2-utils_2.4.58-1ubuntu8.4_arm64.deb ... Unpacking apache2-utils (2.4.58-1ubuntu8.4) ... Selecting previously unselected package apache2. Preparing to unpack .../apache2_2.4.58-1ubuntu8.4_arm64.deb ... Unpacking apache2 (2.4.58-1ubuntu8.4) ... Setting up apache2-data (2.4.58-1ubuntu8.4) ... Setting up apache2-utils (2.4.58-1ubuntu8.4) ... Setting up apache2 (2.4.58-1ubuntu8.4) ... Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. Enabling module auth_basic. Enabling module access_compat. Enabling module authn_file. Enabling module authz_user. Enabling module alias. Enabling module dir. Enabling module autoindex. Enabling module env. Enabling module mime. Enabling module negotiation. Enabling module setenvif. Enabling module filter. Enabling module deflate. Enabling module status. Enabling module reqtimeout. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /usr/lib/systemd/system/apache2.service. Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 148. Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /usr/lib/systemd/system/apache-htcacheclean.servi ce. Processing triggers for man-db (2.12.0-4build2) ... Scanning processes... Scanning linux images... Running kernel seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host. ```
Benjamin-Loison commented 2 months ago

The Ask Ubuntu answer 590912 may help.

curl http://localhost
curl: (7) Failed to connect to localhost port 80 after 0 ms: Couldn't connect to server
ls /etc/apache2/sites-{available,enabled}/
/etc/apache2/sites-available/:
000-default-le-ssl.conf  000-default.conf  default-ssl.conf  travian-le-ssl.conf  travian.conf

/etc/apache2/sites-enabled/:
000-default.conf
Benjamin-Loison commented 2 months ago
sudo a2ensite 000-default-le-ssl
Enabling site 000-default-le-ssl.
To activate the new configuration, you need to run:
  systemctl reload apache2
sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
Benjamin-Loison commented 2 months ago
service apache2 status | cat
Output: ``` × apache2.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Sun 2024-09-15 11:58:54 UTC; 36s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 369672 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE) CPU: 16ms Sep 15 11:58:54 instance-20230827-2235 systemd[1]: Starting apache2.service - The Apache HTTP Server... Sep 15 11:58:54 instance-20230827-2235 apachectl[369674]: [Sun Sep 15 11:58:54.691575 2024] [php:crit] [pid 369674:tid 250345066545184] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. Sep 15 11:58:54 instance-20230827-2235 apachectl[369674]: AH00013: Pre-configuration failed Sep 15 11:58:54 instance-20230827-2235 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE Sep 15 11:58:54 instance-20230827-2235 systemd[1]: apache2.service: Failed with result 'exit-code'. Sep 15 11:58:54 instance-20230827-2235 systemd[1]: Failed to start apache2.service - The Apache HTTP Server. ```

Searching DuckDuckGo and Google for "Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.".

The Stack Overflow answer 62041173.

ls /etc/apache2/mods-enabled/*mpm*
/etc/apache2/mods-enabled/mpm_event.conf  /etc/apache2/mods-enabled/mpm_event.load
Benjamin-Loison commented 2 months ago
sudo a2dismod mpm_event
Module mpm_event disabled.
To activate the new configuration, you need to run:
  systemctl restart apache2
ls /etc/apache2/mods-enabled/*mpm*
ls: cannot access '/etc/apache2/mods-enabled/*mpm*': No such file or directory
sudo a2enmod mpm_worker
Considering conflict mpm_event for mpm_worker:
Considering conflict mpm_prefork for mpm_worker:
Enabling module mpm_worker.
To activate the new configuration, you need to run:
  systemctl restart apache2
ls /etc/apache2/mods-enabled/*mpm*
/etc/apache2/mods-enabled/mpm_worker.conf  /etc/apache2/mods-enabled/mpm_worker.load
sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
service apache2 status | cat
× apache2.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2024-09-15 12:04:42 UTC; 17s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 371550 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
        CPU: 21ms

Sep 15 12:04:42 instance-20230827-2235 systemd[1]: Starting apache2.service - The Apache HTTP Server...
Sep 15 12:04:42 instance-20230827-2235 apachectl[371552]: [Sun Sep 15 12:04:42.413761 2024] [php:crit] [pid 371552:tid 263665626697760] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
Sep 15 12:04:42 instance-20230827-2235 apachectl[371552]: AH00013: Pre-configuration failed
Sep 15 12:04:42 instance-20230827-2235 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Sep 15 12:04:42 instance-20230827-2235 systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 15 12:04:42 instance-20230827-2235 systemd[1]: Failed to start apache2.service - The Apache HTTP Server.
Benjamin-Loison commented 2 months ago

https://forums.opensuse.org/t/apache-is-running-a-threaded-mpm-but-your-php-module-is-not-compiled-to-be-threadsafe-you-need-to/133987/2:

sudo apt install -y php-fpm
Output: ``` Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: php8.3-fpm Suggested packages: php-pear The following NEW packages will be installed: php-fpm php8.3-fpm 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. Need to get 1888 kB of archives. After this operation, 5964 kB of additional disk space will be used. Get:1 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports noble-updates/universe arm64 php8.3-fpm arm64 8.3.6-0ubuntu0.24.04.1 [1884 kB] Get:2 http://eu-marseille-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports noble/universe arm64 php-fpm all 2:8.3+93ubuntu2 [4162 B] Fetched 1888 kB in 0s (9188 kB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package php8.3-fpm. (Reading database ... 184273 files and directories currently installed.) Preparing to unpack .../php8.3-fpm_8.3.6-0ubuntu0.24.04.1_arm64.deb ... Unpacking php8.3-fpm (8.3.6-0ubuntu0.24.04.1) ... Selecting previously unselected package php-fpm. Preparing to unpack .../php-fpm_2%3a8.3+93ubuntu2_all.deb ... Unpacking php-fpm (2:8.3+93ubuntu2) ... Setting up php8.3-fpm (8.3.6-0ubuntu0.24.04.1) ... Creating config file /etc/php/8.3/fpm/php.ini with new version NOTICE: Not enabling PHP 8.3 FPM by default. NOTICE: To enable PHP 8.3 FPM in Apache2 do: NOTICE: a2enmod proxy_fcgi setenvif NOTICE: a2enconf php8.3-fpm NOTICE: You are seeing this message because you have apache2 package installed. Created symlink /etc/systemd/system/multi-user.target.wants/php8.3-fpm.service → /usr/lib/systemd/system/php8.3-fpm.service. Setting up php-fpm (2:8.3+93ubuntu2) ... Processing triggers for man-db (2.12.0-4build2) ... Processing triggers for php8.3-fpm (8.3.6-0ubuntu0.24.04.1) ... NOTICE: Not enabling PHP 8.3 FPM by default. NOTICE: To enable PHP 8.3 FPM in Apache2 do: NOTICE: a2enmod proxy_fcgi setenvif NOTICE: a2enconf php8.3-fpm NOTICE: You are seeing this message because you have apache2 package installed. Scanning processes... Scanning linux images... Running kernel seems to be up-to-date. No services need to be restarted. No containers need to be restarted. No user sessions are running outdated binaries. No VM guests are running outdated hypervisor (qemu) binaries on this host. ```
sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
service apache2 status | cat
× apache2.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2024-09-15 12:11:36 UTC; 9s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 375148 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
        CPU: 25ms

Sep 15 12:11:36 instance-20230827-2235 systemd[1]: Starting apache2.service - The Apache HTTP Server...
Sep 15 12:11:36 instance-20230827-2235 apachectl[375150]: [Sun Sep 15 12:11:36.936088 2024] [php:crit] [pid 375150:tid 252513107337248] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
Sep 15 12:11:36 instance-20230827-2235 apachectl[375150]: AH00013: Pre-configuration failed
Sep 15 12:11:36 instance-20230827-2235 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Sep 15 12:11:36 instance-20230827-2235 systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 15 12:11:36 instance-20230827-2235 systemd[1]: Failed to start apache2.service - The Apache HTTP Server.

So it does not help.

Benjamin-Loison commented 2 months ago

Maybe could give a try to NGINX, but I do not remember if it is supposed to work well with the no-key service, as have to pay attention to ytPrivate/keys.txt visibility due to .htaccess.

Well it seems to support no-key service, see wiki/Home/1c7139f68af217d41d0a201a97eaecf87c139a8b.

I am just afraid for other websites that I have on this VPS.

Benjamin-Loison commented 2 months ago
cd /etc/apache2; . envvar; apache2 -D DUMP_MODULES -t
-bash: envvar: No such file or directory
[Sun Sep 15 12:17:14.645395 2024] [core:warn] [pid 377061] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot

The Ask Ubuntu comment 1366318 does not help.

Following comment does not seem to help:

sudo apt purge php8filter
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php8filter

https://forums.opensuse.org/t/apache-is-running-a-threaded-mpm-but-your-php-module-is-not-compiled-to-be-threadsafe-you-need-to/133987/2:

a2enmod -l
Unknown option: l
Benjamin-Loison commented 2 months ago

Maybe reading keys.txt due to the mutex is the bottleneck.

Benjamin-Loison commented 2 months ago
sudo a2dismod mpm_worker
Module mpm_worker disabled.
To activate the new configuration, you need to run:
  systemctl restart apache2
sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xeu apache2.service" for details.
service apache2 status | cat
× apache2.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2024-09-15 12:20:53 UTC; 6s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 378368 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
        CPU: 16ms

Sep 15 12:20:53 instance-20230827-2235 systemd[1]: Starting apache2.service - The Apache HTTP Server...
Sep 15 12:20:53 instance-20230827-2235 apachectl[378370]: AH00534: apache2: Configuration error: No MPM loaded.
Sep 15 12:20:53 instance-20230827-2235 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Sep 15 12:20:53 instance-20230827-2235 systemd[1]: apache2.service: Failed with result 'exit-code'.
Sep 15 12:20:53 instance-20230827-2235 systemd[1]: Failed to start apache2.service - The Apache HTTP Server.
Benjamin-Loison commented 2 months ago
sudo a2enmod mpm_prefork
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Enabling module mpm_prefork.
To activate the new configuration, you need to run:
  systemctl restart apache2
sudo service apache2 restart

does not return anything.

Benjamin-Loison commented 2 months ago

As PHP is not interpreted:

a2enmod php
ERROR: Module php does not exist!
a2enmod php8.3
Considering dependency mpm_prefork for php8.3:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php8.3:
ERROR: Module php8.3 not properly enabled: /etc/apache2/mods-enabled/php8.3.load is a real file, not touching it

No matter sudo and sudo service apache2 restart does not help.

Benjamin-Loison commented 2 months ago

On a private instance:

sudo a2dismod php8.3
Module php8.3 disabled.
To activate the new configuration, you need to run:
  systemctl restart apache2
diff -qr /etc/apache2{,_15_09_24}/
Only in apache2_15_09_24/mods-enabled: php8.3.conf
Only in apache2_15_09_24/mods-enabled: php8.3.load

PHP is still interpreted.

sudo service apache2 restart

PHP is no more interpreted.

diff -qr /etc/apache2{,_15_09_24}/
Only in /etc/apache2_15_09_24/mods-enabled: php8.3.conf
Only in /etc/apache2_15_09_24/mods-enabled: php8.3.load
sudo a2enmod php8.3
Considering dependency mpm_prefork for php8.3:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php8.3:
Enabling module php8.3.
To activate the new configuration, you need to run:
  systemctl restart apache2
diff -qr /etc/apache2{,_15_09_24}/

does not return anything.

sudo service apache2 restart

brings back PHP interpretation.

/etc/apache2/mods-enabled/php8.3.conf:

# Using (?:pattern) instead of (pattern) is a small optimization that
# avoid capturing the matching pattern (as $1) which isn't used here
<FilesMatch ".+\.ph(?:ar|p|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".+\.phps$">
    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Require all denied
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(?:ar|p|ps|tml)$">
    Require all denied
</FilesMatch>

# Running PHP scripts in user directories is disabled by default
# 
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_flag engine Off
    </Directory>
</IfModule>
Benjamin-Loison commented 2 months ago

On the official instance:

ls /etc/apache2/mods-enabled/php8.3.{conf,load}
ls: cannot access '/etc/apache2/mods-enabled/php8.3.conf': No such file or directory
/etc/apache2/mods-enabled/php8.3.load

Restoring /etc/apache2/mods-enabled/php8.3.conf from the private instance content and sudo service apache2 restart made PHP work again.

Also proceeded again to https://github.com/Benjamin-Loison/YouTube-operational-API/blob/8d4747ea7b4414d53177f6f4b5876264b3d63d0f/README.md?plain=1#L17.

crontab -l:

0 0 1 */3 * certbot --apache --key-type ecdsa --elliptic-curve secp384r1 -d yt.lemnoslife.com,yt5.lemnoslife.com
sudo service apache2 status
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-09-15 12:44:46 UTC; 3min 48s ago
...

/var/log/apache2/error.log:

[Sun Sep 15 12:45:18.696987 2024] [php:warn] [pid 387871] [client XXX.XXX.XXX.XXX:45174] PHP Warning:  file_get_contents(tests/part=activity&amp;id=XXXXXXXXXXX.json): Failed to open stream: No such file or directory in /var/www/html/videos.php on line 30
[Sun Sep 15 12:45:18.909401 2024] [mpm_prefork:error] [pid 387576] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
wc -l /var/www/yt/ytPrivate/keys.txt
2460 /var/www/yt/ytPrivate/keys.txt
head /var/www/yt/ytPrivate/keys.txt
AIzaSyDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AIzaSyDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
...
curl -s 'https://www.googleapis.com/youtube/v3/videos?part=snippet&id=_ZPpU7774DQ&key=AIzaSyDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
{
  "error": {
    "code": 403,
    "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
    "errors": [
      {
        "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
        "domain": "youtube.quota",
        "reason": "quotaExceeded"
      }
    ]
  }
}

so let us order keys before restarting apache2. Would be nice to actually be the only one to run noKey/index.php and see progress.

If I remember correctly I already worked towards this goal.

Benjamin-Loison commented 2 months ago

Maybe the lock on the keys.txt exists but no thread releases it as it died.

After using https://github.com/Benjamin-Loison/YouTube-operational-API/issues/18#issuecomment-1286216222 on:

~/Desktop/bens_folder/dev/yt/youtube_data_api_v3_* | sort | uniq

on my Linux Mint 22 Cinnamon Framework 13,

sudo service apache2 start

makes the no-key service works fine.

Benjamin-Loison commented 1 month ago

Should try on Debian 12 it may help.

Unclear how to proceed as it already use the whole disk.

Benjamin-Loison commented 1 month ago

Maybe removing unit tests or similar possibly requiring a disk access would help. However, this is only about web-scraping endpoints.