miniflux / v2

Minimalist and opinionated feed reader
https://miniflux.app
Apache License 2.0
6.97k stars 728 forks source link

`panic: runtime error: invalid memory address or nil pointer dereference` #2876

Closed xfzv closed 1 month ago

xfzv commented 1 month ago

I've been compiling Git version for several months without any issue. Today, after updating from https://github.com/miniflux/v2/commit/e07203ad46d91551f87e0d50009181e2a1363209 to https://github.com/miniflux/v2/commit/e1050e21b5fb44d020ec5534d2a8f4161b99b468, I got the following errors twice in a few hours:

miniflux[5118]: panic: runtime error: invalid memory address or nil pointer dereference
miniflux[5118]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x55fe6bd372c5]
miniflux[5118]: goroutine 35 [running]:
miniflux[5118]: miniflux.app/v2/internal/reader/fetcher.(*ResponseHandler).IsRateLimited(...)
miniflux[5118]:         /root/.local/bin/miniflux/internal/reader/fetcher/response_handler.go:73
miniflux[5118]: miniflux.app/v2/internal/reader/handler.RefreshFeed(0xc00012b1b8, 0x1, 0x42, 0x0)
miniflux[5118]:         /root/.local/bin/miniflux/internal/reader/handler/handler.go:244 +0x785
miniflux[5118]: miniflux.app/v2/internal/worker.(*Worker).Run(0xc00036a810, 0xc0000d7340)
miniflux[5118]:         /root/.local/bin/miniflux/internal/worker/worker.go:38 +0x345
miniflux[5118]: created by miniflux.app/v2/internal/worker.NewPool in goroutine 1
miniflux[5118]:         /root/.local/bin/miniflux/internal/worker/pool.go:31 +0x71
systemd[1]: miniflux.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
systemd[1]: miniflux.service: Failed with result 'exit-code'.

[...]

miniflux[31077]: panic: runtime error: invalid memory address or nil pointer dereference
miniflux[31077]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x56035979d2c5]
miniflux[31077]: goroutine 34 [running]:
miniflux[31077]: miniflux.app/v2/internal/reader/fetcher.(*ResponseHandler).IsRateLimited(...)
miniflux[31077]:         /root/.local/bin/miniflux/internal/reader/fetcher/response_handler.go:73
miniflux[31077]: miniflux.app/v2/internal/reader/handler.RefreshFeed(0xc000063170, 0x1, 0x44, 0x0)
miniflux[31077]:         /root/.local/bin/miniflux/internal/reader/handler/handler.go:244 +0x785
miniflux[31077]: miniflux.app/v2/internal/worker.(*Worker).Run(0xc000034750, 0xc0002fc4d0)
miniflux[31077]:         /root/.local/bin/miniflux/internal/worker/worker.go:38 +0x345
miniflux[31077]: created by miniflux.app/v2/internal/worker.NewPool in goroutine 1
miniflux[31077]:         /root/.local/bin/miniflux/internal/worker/pool.go:31 +0x71
systemd[1]: miniflux.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
systemd[1]: miniflux.service: Failed with result 'exit-code'.
% /usr/bin/miniflux --info
Version: 2.2.1
Commit: e1050e21
Build Date: 2024-10-06T10:11:14+0200
Go Version: go1.23.2
Compiler: gc
Arch: amd64
OS: linux

How I compile miniflux, if that matters:

cd /root/.local/bin/miniflux || return
make miniflux
systemctl stop miniflux.service
mv miniflux /usr/bin/miniflux
systemctl start miniflux.service

Edit:

% systemctl cat miniflux.service

# /etc/systemd/system/miniflux.service
# Changing the systemd config can be done like this:
# 1) Edit the config file: systemctl edit --full miniflux
# 2) Restart the process: systemctl restart miniflux
# All your changes can be reverted with `systemctl revert miniflux.service`.
# See https://wiki.archlinux.org/index.php/Systemd#Editing_provided_units.
# Also see https://www.freedesktop.org/software/systemd/man/systemd.service.html
# for available configuration options in this file.

[Unit]
Description=Miniflux
Documentation=man:miniflux(1) https://miniflux.app/docs/index.html
After=network.target postgresql.service

[Service]
ExecStart=/usr/bin/miniflux
User=miniflux

# Load environment variables from /etc/miniflux.conf.
EnvironmentFile=/etc/miniflux.conf

# Miniflux uses sd-notify protocol to notify about it's readiness.
Type=notify

# Enable watchdog.
WatchdogSec=60s
WatchdogSignal=SIGKILL

# Automatically restart Miniflux if it crashes.
Restart=always
RestartSec=5

# Allocate a directory at /run/miniflux for Unix sockets.
RuntimeDirectory=miniflux

# Allow Miniflux to bind to privileged ports.
AmbientCapabilities=CAP_NET_BIND_SERVICE

# Make the system tree read-only.
ProtectSystem=strict

# Allocate a separate /tmp.
PrivateTmp=yes

# Ensure the service can never gain new privileges.
NoNewPrivileges=yes

# Prohibit access to any kind of namespacing.
RestrictNamespaces=yes

# Make home directories inaccessible.
ProtectHome=yes

# Make device nodes except for /dev/null, /dev/zero, /dev/full,
# /dev/random and /dev/urandom inaccessible.
PrivateDevices=yes

# Make cgroup file system hierarchy inaccessible.
ProtectControlGroups=yes

# Deny kernel module loading.
ProtectKernelModules=yes

# Make kernel variables (e.g. /proc/sys) read-only.
ProtectKernelTunables=yes

# Deny hostname changing.
ProtectHostname=yes

# Deny realtime scheduling.
RestrictRealtime=yes

# Deny access to the kernel log ring buffer.
ProtectKernelLogs=yes

# Deny setting the hardware or system clock.
ProtectClock=yes

# Filter dangerous system calls. The following is listed as safe basic
# choice in systemd.exec(5).
SystemCallArchitectures=native

# Deny kernel execution domain changing.
LockPersonality=yes

# Deny memory mappings that are writable and executable.
MemoryDenyWriteExecute=yes

[Install]
WantedBy=multi-user.target