PHP error (2): fsockopen(): unable to connect to 127.0.0.1:4711 (Connection refused)

Seem to have the same error. at quite some time (eg 36h) I get the error from thread-starter. only cure seems to restart the system via web-interface or ssh-shell. the debug log afterwards is pretty fine,.. haven't startet while the error is happing, cause I am usually at work, and my wife at home, throws me hateful messages, why she doen't have internet.
Just writing to let You know, there are more people with this problem.
Next time the error happens I post a debug log.

1 Like

I'm not yet convinced that your issue would be related to Lighttpd failed to start on fresh install - configuration issue, Binog.

wieb's observation evolved from a PHP error over a port conflict with Apache and a lighttpd startup issue (all web UI related) into outright DNS failure due to lack of upstream connectivity.

Does your lighttpd fail to start as well?
Did you see the same PHP error?
Do you also run Apache as webserver, instead of or in addition to lighttpd?
Did you see the same lighttpd error?
Is DNS resolution also failing for you?
Does your Pi-hole run on Armbian as well?
Do you have the same peculiarities in your routing table?

OK,

Just now again this behavior.

Here is my token. and no I don't have apache installed and am not running on Armbian. But still the same error. So as Threadstarter assumes: doesn't have anything to do with apache.
I opened 4711 via UFW on UDP and TCP. Don't know If this is important...
But I would still be thankful, If anyone of You can help me solve it.
Jimmy

https://tricorder.pi-hole.net/GRGfrH6d/

Your debug log shows a normal routing table:

*** [ DIAGNOSING ]: Network routing table
   default via 10.0.1.1 dev eth0 src 10.0.1.20 metric 202 
   10.0.1.0/24 dev eth0 proto dhcp scope link src 10.0.1.20 metric 202

And while you have no problems with upstream connectivity, your Pi-hole's local IPv4 network connectivity is lacking (which is the reverse of wieb):

*** [ DIAGNOSING ]: Name resolution (IPv4) using a random blocked domain and a known ad-serving domain
[βœ—] Failed to resolve gycz53t.top on lo (127.0.0.1)
[βœ—] Failed to resolve gycz53t.top on eth0 (10.0.1.20)
[βœ“] doubleclick.com is 172.217.18.110 via a remote, public DNS server (8.8.8.8)

Also, pihole-FTL is not detected as claiming any ports (while wieb's log did show them as expected):

*** [ DIAGNOSING ]: Ports in use
    udp:0.0.0.0:68 is in use by dhcpcd
    udp:0.0.0.0:58983 is in use by avahi-daemon
    udp:0.0.0.0:5353 is in use by avahi-daemon
    udp:*:52319 is in use by avahi-daemon
    udp:*:5353 is in use by avahi-daemon
[βœ“] tcp:0.0.0.0:80 is in use by lighttpd
    tcp:0.0.0.0:50969 is in use by sshd
[βœ“] tcp:[::]:80 is in use by lighttpd
    tcp:*:8888 is in use by pigpiod
    tcp:[::]:50969 is in use by sshd
    tcp:[::1]:4700 is in use by cnid_metad
    tcp:*:548 is in use by afpd

At the same time, pihole-FTL is still reported as running:

*** [ DIAGNOSING ]: Pi-hole processes
[βœ“] lighttpd daemon is active
[βœ“] pihole-FTL daemon is active

I'm going to split Binog's posts into a separate topic.

Are clients able to resolve DNS?

Run from a client, what's the result of

nslookup pi.hole 10.0.1.20

nslookup pi.hole 10.0.1.20
;; connection timed out; no servers could be reached

and again, no dnsrestart could solve the problem, just a raspy restart...

Else (now after restart) it shows:
Server: 10.0.1.20
Address: 10.0.1.20#53
Name: pi.hole
Address: 10.0.1.20

Were both of those run from the same client?
Just asking because they look like they may have been run from your Pi-hole machine instead (output suggests a Linux nslookup rather than Windows, and client are Windows more often than not).

Also, was your above debug log created during an outage?
If so, could you please provide another debug log look when it's working?

I have that error intermittently.
My PiHoles is running on a USB stick. Maybe a defrag or faster one more expensive one.
My PiHoles is using Unbound

Well, I am on a unix-derived system: Macosx. No outages - as far as I can tell,. I mean, the raspy is responding.. via ssh...
Here is the log of a working dns resolving:
https://tricorder.pi-hole.net/q96nwilp/

Still have the problem... any solution at the sky above?

Apologies, I've missed your debug token, which has expired by now.
Could you please provide a fresh one?

Well it "crashed" while generating the debug log. htop shows a 100% CPU on:
pihole-FTL sqlite3 /etc/pihole/gravity.db SELECT domain FROM vw_gravity ORDER BY RANDOM() LIMIT 1
After a while I sigtermed and later sigkilled the process, nothing happened (the process wasn't killed) but later on it vanished and the CPU reduced.
the web-interface was unresponsive althow the the pi reported:

pihole status
  [βœ—] DNS service is NOT running
  [βœ—] DNS service is NOT running
pi@fire-hole:~ $ pihole restartdns
  [βœ“] Restarting DNS server
pi@fire-hole:~ $ pihole status
  [βœ“] FTL is listening on port 53
     [βœ“] UDP (IPv4)
     [βœ“] TCP (IPv4)
     [βœ“] UDP (IPv6)
     [βœ“] TCP (IPv6)

  [βœ“] Pi-hole blocking is enabled

but still no web interface and still no answered queries. Merly the restart got it running again. And now I am trying to generate another debug log -now directly on the pi. hang on..

https://tricorder.pi-hole.net/cGeztIdR/

debug.txt (1.5 MB)

Hi,

it seems i have the same problem.

Attached you can find my debug log. Tried to upload it via the debug integrated function but my pi hole crashes during this.

Kind regards

I doubt it actually crashed - it's more likely that storage was busy writing your well over 20,000 individual blocklist entries.

It seems that about 17,000 of them are related to blocking YouTube content.
Note that trying to block YT via a DNS blocker is not the most promising approach to block ads on YT, as YT is continuing to delivering its content via the same domain as its ads, and they have proven pretty adept in cancelling DNS blocking attempts.
The high count would suggest that you are or have been using a third-party script that regularly updates your gravity database with newly detected YT domains in short intervals, rather than the once-per week default.

Since your overall blocked domain count is about 7.3 million entries, running that third-party update may have unwanted side-effects, especially if it would start again before the previous run had finished.
This could result in database deadlocks as well as database corruption, and it probably could also explain your observed outages.

You should verify whether such a script or remnants thereof are still active, and I'd recommend to fully remove them.

I also noticed that you have added some regex for the seemingly same purpose of blocking YT, which at first glance looks like a good approximation of a pattern maching the majority of the individual blocked domains.
This would suggest that you could consider to clean out most or all of those 17,000 exact blacklist entries without losing too much of your intended blocking.

1 Like

Thank You very much for looking into the depth! I really appreciate that !
It bulk deleted all Youtube entries. Lets see if this helps..

The entries by themselves would just slow down debug log creation.

It's the third-party script being still active and triggering frequent gravity updates that could potentially cause Pi-hole to become unresponsive at times.

So please also...

Of interest in your debug log - why do you have whitelists in your adlists? Adding those URL's to your adlists blocks those domains.

*** [ DIAGNOSING ]: Adlists
   id     enabled  group_ids     address                                                                                               date_added           date_modified        comment                                           
   -----  -------  ------------  ----------------------------------------------------------------------------------------------------  -------------------  -------------------  --------------------------------------------------
   378          1                https://raw.githubusercontent.com/notracking/hosts-blocklists-scripts/master/hostnames.whitelist.txt  2022-01-15 12:04:57  2022-01-15 12:06:15  whitelist                                         
   
   379          1                https://raw.githubusercontent.com/nextdns/metadata/master/privacy/affiliate-tracking-domains          2022-01-15 12:05:08  2022-01-15 12:06:13  whitelist                                         
   
   380          1                https://raw.githubusercontent.com/EnergizedProtection/unblock/master/basic/formats/domains.txt        2022-01-15 12:05:19  2022-01-15 12:06:09  whitelist                                         
   
   381          1                https://raw.githubusercontent.com/raghavdua1995/DNSlock-PiHole-whitelist/master/whitelist.list        2022-01-15 12:05:28  2022-01-15 12:06:07  whitelist                                         
   
   382          1                https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/referral-sites.txt               2022-01-15 12:05:42  2022-01-15 12:06:04  whitelist    

You also have several adlists which are improperly formatted for Pi-hole:

  [i] Target: https://raw.githubusercontent.com/AdguardTeam/AdGuardSDNSFilter/master/Filters/exclusions.txt
  [βœ“] Status: Retrieval successful
  [i] Analyzed 354 domains, 251 domains invalid!
      Sample of invalid domains:
      - ||geotrust.com^
      - ||postclickmarketing.com^
      - ||monitor.azure.com^
      - ||custumer.io^
      - ||branch.io^
  [i] List stayed unchanged

  [i] Target: https://raw.githubusercontent.com/xlimit91/xlimit91-block-list/master/regex.list
  [βœ“] Status: Retrieval successful
  [i] Analyzed 13 domains, 13 domains invalid!
      Sample of invalid domains:
      - ^(.+[_.-])?ad[sxv]?[0-9]*[_.-]
      - ^(.+[_.-])?adse?rv(er?|ice)?s?[0-9]*[_.-]
      - ^(.+[_.-])?telemetry[_.-]
      - ^adim(age|g)s?[0-9]*[_.-]
      - ^adtrack(er|ing)?[0-9]*[_.-]
  [i] List stayed unchanged

  [i] Target: https://raw.githubusercontent.com/mmotti/pihole-regex/master/regex.list
  [βœ“] Status: Retrieval successful
  [i] Analyzed 12 domains, 12 domains invalid!
      Sample of invalid domains:
      - ^ad([sxv]?[0-9]*|system)[_.-]([^.[:space:]]+\.){1,}|[_.-]ad([sxv]?[0-9]*|system)[_.-]
      - ^(.+[_.-])?adse?rv(er?|ice)?s?[0-9]*[_.-]
      - ^(.+[_.-])?telemetry[_.-]
      - ^adim(age|g)s?[0-9]*[_.-]
      - ^adtrack(er|ing)?[0-9]*[_.-]

A few others which may no longer exist:

   196          1  0,1,3,4,5,6,  rlwpx.free.fr/WPFF/hsex.7z                                                                            2021-03-19 19:56:02  2021-03-19 20:13:46                                                    
                   8,9,10,11                                                                                                                                                                                                       
   
   197          1  0,1,3,4,5,6,  rlwpx.free.fr/WPFF/hpub.7z                                                                            2021-03-19 19:56:08  2021-03-19 20:13:42                                                    
                   8,9,10,11

   334          1  0,1,3,4,5,6,  http://malc0de.com/bl/ZONES                                                                           2021-05-15 11:14:15  2022-01-15 12:19:05                                                    
                   8,9,10,11,12                                                                                                                                                                                                                                                                                        

This one isn't a list of any type - it's a URL leading to a Reddit post:

https://discourse.pi-hole.net/t/how-do-i-block-ads-on-youtube/253

There are likely other problems as well. I recommend eliminating all the lists you have that attempt to block YouTube ads (these don't work), and then look carefully at the output of the following command to see which lists either do not exist or have compatibility problems:

pihole -g -f

1 Like

Thank you very much. the whitelist where enable but not assigned to any device,. I disabled em. Wanted to add them via batch to the whitelist.list....

Do one has to add the regex lists manually or ist there any way to batch em? I disabled em.

no longer existing lists I deleted them.
... it's a URL leading to a Reddit post:
that just did my day ! :joy:

getting also php error 2 with the same message.

My debug log

https://tricorder.pi-hole.net/DpIJLsl1/

the last days i already resetted the pi hole and removed some lists.

pihole -g -f

shows no error.

1 Like

@Bucking_Horn Thank You mate ! I completely forgot about that script, after deleting all of its components, it did not "crash" anymore... so I guess it is solved.

Thx again !