linuxserver / docker-smokeping

GNU General Public License v3.0
347 stars 95 forks source link

500 Internal Server Error - CGI script times out #86

Closed caffeineflo closed 3 years ago

caffeineflo commented 4 years ago

linuxserver.io

If you are new to Docker or this application our issue tracker is ONLY used for reporting bugs or requesting features. Please use our discord server for general support.

Fresh setup results in Server Error 500 - Internal Server error.

Expected Behavior

Get smokeping webinterface

Current Behavior

500 Server Error is returned

Steps to Reproduce

Use example docker compose to setup smokeping

Environment

OS: Parallels VM - Docker-machine CPU architecture: x86_64 How docker service was installed: Docker-machine

Command used to create docker container (run/create/compose/screenshot)

Docker logs

apache error log: [Fri May 08 22:08:08.237186 2020] [fcgid:warn] [pid 276] [client 192.168.178.68:63876] mod_fcgid: read data timeout in 40 seconds [Fri May 08 22:08:08.237249 2020] [core:error] [pid 276] [client 192.168.178.68:63876] End of script output before headers: smokeping.cgi

Manually running the cgi script takes about 60 seconds before the html is being printed. It seems to be an access issue somewhere

Thijmen commented 4 years ago

Same issue here, no one is able to fix? I am also not able to find any error logs regarding this issue in the container.

ThePatricide commented 4 years ago

Same issue here. Is this image maintained?

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Thijmen commented 4 years ago

Still ongoing issue, no one to the rescue?

caffeineflo commented 4 years ago

I gave up, this container seems dead. Ended up installing it on the machine without docker

Kofl commented 4 years ago

So far the current release cfb576d4-ls98 worked fine for me.

/root/docker/smokeping/smokeping/docker-compose.yml

version: "2.1"
services:
  smokeping:
    image: linuxserver/smokeping
    container_name: smokeping
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Vienna
    volumes:
      - /root/docker/smokeping/data/config:/config
      - /root/docker/smokeping/data/data:/data
    ports:
      - 84:80
    restart: unless-stopped

file /root/docker/smokeping/data/config/Targets

*** Targets ***
 probe = FPing

 menu = Top
 title = Network Latency Grapher
 remark = Welcome to this SmokePing website.

 + mysite1
 menu = Site 1
 title = Hosts in Site 1

 ++ myhost1
 host = www.google.at

mkdir -p /root/docker/smokeping/data/data

GUI is reachable via http://IP:84/

Thomas

ironicbadger commented 4 years ago

I gave up, this container seems dead. Ended up installing it on the machine without docker

Not dead, just not super popular. Sorry I missed these replies, in future ping me on Twitter with the same username if you want my attention.

I cannot reproduce this issue though. @caffeineflo as the original issue reporter, are you still able to reproduce this error with recent builds and fresh config directories?

Thijmen commented 4 years ago

I think it must be in the areas of a ungracefull stop of the container which leads to data corruption where smokeping stores it's data. Clean containers do work..

looselyrigorous commented 4 years ago

I had the same issue, and only got it to work after editing the Targets file, removing most of the Hosts. The default one didn't seem to have any errors though.

ironicbadger commented 4 years ago

@Thijmen do you have any reliable way for me to reproduce? I have tried a few different ways and can't.

vajrang commented 4 years ago

FWIW, I could reproduce with completely fresh install following the instructions for docker-compose here : https://hub.docker.com/r/linuxserver/smokeping

I'm running on a raspberry pi 4, raspberry pi os 64-bit lite with tag arm64v8-latest.

shmirgel commented 4 years ago

Today I experienced the same error. Following is my setup, findings and workaround.

- Raspberry Pi 4, armv7l(32bit)

- OS: PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"

- Docker version:

Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46
 Built:             Wed Sep 16 17:07:02 2020
 OS/Arch:           linux/arm
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46
  Built:            Wed Sep 16 17:00:52 2020
  OS/Arch:          linux/arm
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

I start the container with docker-compose with this code:

---
version: "2.1"
services:
  smokeping:
    image: linuxserver/smokeping
    container_name: smokeping
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - /my/path/config:/config
      - /my/path/data:/data
    ports:
      - 8080:80
    restart: unless-stopped

Watching the logs I got this:

<<OUTPUT OMITTED>>
smokeping    | [services.d] done.
smokeping    | AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.21.0.2. Set the 'ServerName' directive globally to suppress this message
smokeping    | WARNING: Hostname 'facebook.com' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'youtube.com' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'jupiterbroadcasting.com' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'google.com' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'linuxserver.io' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'www.telefonica.de' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'cixp.web.cern.ch' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'cam.ac.uk' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'www.uea.ac.uk' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'web.mit.edu' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'www.indiana.edu' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'www.berkeley.edu' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'ucsd.edu' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'twin-cities.umn.edu' does currently not resolve to an IPv4 address
smokeping    | WARNING: Hostname 'osuosl.org' does currently not resolve to an IPv4 address
smokeping    | Smokeping version 2.007003 successfully launched.
smokeping    | Not entering multiprocess mode for just a single probe.
smokeping    | FPing: probing 25 targets with step 300 s and offset 243 s.

At this stage with "[services.d] done." and "Smokeping version 2.007003 successfully launched." the web interface was not working and in a while I got the Internal Server Error.

It is obvious that there is a problem with DNS resolving. When I connected to the container I verified that there is Internet, but I was unable to reach hosts by FQDN.

Container's /etc/resolv.conf:

nameserver 127.0.0.11
options ndots:0

When I changed the container nameserver to 1.1.1.1, the resolving was fixed and I was able to open the Smokeping web interface immediately. When I changed back to 127.0.0.11 the web interface stopped.

Then I started the container with docker-compose on a PC:

- Laptop, x86_64

- OS: PRETTY_NAME="Debian GNU/Linux 10 (buster)"

- Docker version:
Client: Docker Engine - Community
 Version:           19.03.13
 API version:       1.40
 Go version:        go1.13.15
 Git commit:        4484c46d9d
 Built:             Wed Sep 16 17:02:55 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.13
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       4484c46d9d
  Built:            Wed Sep 16 17:01:25 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.7
  GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

And ... I was NOT able to reproduce the problem. On the laptop it worked. It could be that the problem is in my Raspberry setup.

As a workaround I've added "dns: 1.1.1.1" to the docker-compose file.

ironicbadger commented 4 years ago

This doesn't make sense. I have smokeping running in 3 different servers and all have the same nameserver configuration in /etc/resolv.conf as you do. The fact that you've added Cloudflare as an explicit DNS option seems to suggest that it is a DNS issue (isn't it always).

However, I'm afraid I can't reproduce this issue in multiple systems that have similar Docker Engine versions to you.

# running on digitalocean
ironicbadger@ktz-status:~$ docker exec -it smokeping bash
root@3e380e7cbbdb:/# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
root@3e380e7cbbdb:/# curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

And another instance

# running at my house
root@a1b4ff8e6c62:/# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
root@a1b4ff8e6c62:/# curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

Both of these systems are Ubuntu 20.04. I will try with Debian.

ironicbadger commented 4 years ago

Not able to reproduce on a fresh install of Debian 10.6.

Happy to take any suggestions on how to repro.

ironicbadger commented 4 years ago

I would like to see how your container is handling DNS without the explicit dns: 1.1.1.1 definition in compose. We can use nsenter to do this like so:

root@cartman:/home/alex# PID=$(docker inspect --format {{.State.Pid}} smokeping)
root@cartman:/home/alex# echo $PID
3655525
root@cartman:/home/alex# nsenter --target $PID --mount --uts --ipc --net --pid
a1b4ff8e6c62:/# dig google.com

; <<>> DiG 9.16.6 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32739
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     4   IN  A   172.217.7.142

;; Query time: 7 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Fri Oct 30 20:27:26 UTC 2020
;; MSG SIZE  rcvd: 55

a1b4ff8e6c62:/#
shmirgel commented 4 years ago

This is what I collected.

With dns: entry in docker-compose:

# PID=$(docker inspect --format {{.State.Pid}} smokeping)
echo $PID
1802
# nsenter --target $PID --mount --uts --ipc --net --pid

271ce2b31101:/# dig google.com

; <<>> DiG 9.16.6 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7943
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             36      IN      A       216.58.214.142

;; Query time: 0 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Fri Oct 30 20:43:22 UTC 2020
;; MSG SIZE  rcvd: 55

271ce2b31101:/# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0

Without dns: entry in docker-compose file:

# PID=$(docker inspect --format {{.State.Pid}} smokeping)
# echo $PID
17083
# nsenter --target $PID --mount --uts --ipc --net --pid

586f5fc7d8b0:/# dig google.com

; <<>> DiG 9.16.6 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44538
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             289     IN      A       172.217.169.110

;; Query time: 0 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Fri Oct 30 21:08:25 UTC 2020
;; MSG SIZE  rcvd: 55

586f5fc7d8b0:/# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0

Unfortunately earlier today I had to reboot the Raspberry and now I am not able to reproduce the problem whatever I try. That should be the reason for the output from dig - now it is just working. If I make it stop I will get back with some output.

caffeineflo commented 3 years ago

Hey @IronicBadger!

Sorry for abandoning this issue, I changed GitHub Nicknames and lost track of this issue.

I've just retried this image on both my Docker Desktop (for mac) installation as well as on my QNAP. Both installations had the same issue: URLs aren't resolved. DNS name resolution times out - I have about ~20 other container running that don't have any such issue. (A few other linuxserver images as well)

As a second try, I've tested the dns option for the compose file from PR #1199 with 1.1.1.1 and 8.8.8.8 and from the terminal on these containers, DNS doesn't resolve, but smokeping seems to be able to properly resolve things and seems to collect ping times.

I hope this helps or at least puts the issue to rest

Edit: Looking at it now after a few hours of running Smokeping, it seems that only the standard derivation with DNSProbes work, not the actual pinging. I'll look into this

Unicorn-Tulkas commented 3 years ago

Hi all, just wanted to add my little tidbit, as I ran into that issue as well today. I am running kernel 5.4.61 on a NanoPi Neo3. What I suspect may have caused my issues is that I am running pi-hole and unbound containers on that machine simultaneously as my networkwide recursive DNS. Changing the default DNS of the container fixed the issue for me and smokeping is now collecting data normally. As a newbie to Linux, Servers, GitHub and the lot I was glad I found this thread and was able to make it work for me. Here's how I set it up for now:

sudo docker run -d \
  --name=smokeping \
  -e PUID=1002 \
  -e PGID=1002 \
  -e TZ=Europe/Berlin \
  -p 8080:80 \
  --dns=1.1.1.1 \
  -v /var/lib/docker/volumes/smokeping_config/_data:/config \
  -v /var/lib/docker/volumes/smokeping_data/_data:/data \
  --restart unless-stopped \
  ghcr.io/linuxserver/smokeping
hypn commented 3 years ago

As per @Unicorn-Tulkas's post above, adding

dns: 
  - 1.1.1.1

to my docker-compose file's smokeping entry resolved the "does currently not resolve to an IPv4 address" logs on startup for me.

I'm also running pi-hole, for my home network's DNS, on the same device (a raspberry pi 4) that I'm running smokeping on.

pi@pihole:~ $ uname -a
Linux pihole 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux
ironicbadger commented 3 years ago

Looks like the solution is to explicitly define a DNS upstream if you're running into issues. Close?

timdonovanuk commented 3 years ago

Same for me, fresh install, running PiHole as DNS.

Inside the container, I can ping hostnames fine (both internal servers and google.com) and they resolve to the right IP.

Adding dns: 8.8.8.8 to my smokeping service entry fixes it, but this shouldn't really be necessary I think? If I set it to my internal DNS (PiHole) I get the same issue with HTTP 500.

Tamadite commented 3 years ago

What I see is that DNS does not get configured. This is what I get from the shell:

root@smokeping-2:/# cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
root@smokeping-2:/#

Is this meant to be so?

j0nnymoe commented 3 years ago

cat /etc/resolv.conf

Yep this is as expected.

Same for me, fresh install, running PiHole as DNS.

Inside the container, I can ping hostnames fine (both internal servers and google.com) and they resolve to the right IP.

Adding dns: 8.8.8.8 to my smokeping service entry fixes it, but this shouldn't really be necessary I think? If I set it to my internal DNS (PiHole) I get the same issue with HTTP 500.

Not the first time we've seen pihole interfere with DNS like this. Best thing to do is not run your server through pihole.

j0nnymoe commented 3 years ago

Closing as it's not inherintely an issue with the container but upstream dns causing the issues.

RamboRogers commented 2 years ago

So i make a kubernetes version of this....... and I get the 500 error. I fixed it by adding this to the container spec.

      dnsConfig:
        nameservers:
          - 1.1.1.1
          - 2.2.2.2