Only happens half of the time.
I tried running with an empty config, but it didn't solve it.
On the other hand deleting cache.db always works. So I think it is cache related.
Starting newsboat 2.20.0...
Loading configuration...done.
Opening cache...done.
Loading URLs from /home/polve/.config/newsboat/urls...done.
Loading articles from cache...done.
Segmentation fault (core dumped)
newsboat -v output:
newsboat 2.20.0
System: Linux 5.7.4-arch1-1 (x86_64)
Compiler: g++ 10.1.0
ncurses: ncurses 6.2.20200212 (compiled with 6.2)
libcurl: libcurl/7.70.0 OpenSSL/1.1.1g zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh2/1.9.0 nghttp2/1.41.0 (compiled with 7.70.0)
SQLite: 3.32.3 (compiled with 3.32.3)
libxml2: compiled with 2.9.10
Config file (copy from ~/.newsboat/config or ~/.config/newsboat/config):
# vim: set filetype:conf
auto-reload yes
feed-sort-order lastupdated
reload-threads 4
show-read-feeds no
max-items 30
external-url-viewer "urlscan -dc -r 'linkhandler {}'"
bind-key j down
bind-key k up
bind-key j next articlelist
bind-key k prev articlelist
bind-key J next-feed articlelist
bind-key K prev-feed articlelist
bind-key G end
bind-key g home
bind-key d pagedown
bind-key u pageup
bind-key l open
bind-key h quit
bind-key a toggle-article-read
bind-key n next-unread
bind-key N prev-unread
bind-key D pb-download
bind-key U show-urls
bind-key x pb-delete
bind-key L toggle-show-read-feeds
color listnormal green default bold
color listfocus yellow black standout bold
color listnormal_unread cyan default
color listfocus_unread yellow black standout bold
color info black yellow standout
browser linkhandler
macro , open-in-browser
macro k open-in-browser-and-mark-read ; hard-quit
macro t set browser "tsp youtube-dl --add-metadata -ic" ; open-in-browser ; set browser linkhandler
macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best" ; open-in-browser ; set browser linkhandler
macro v set browser "setsid mpv" ; open-in-browser ; set browser linkhandler
macro w set browser "lynx" ; open-in-browser ; set browser linkhandler
macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler
highlight all "---.*---" yellow
highlight feedlist ".*(0/0))" black
highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold
highlight article "(^Link:.*|^Date:.*)" default default
highlight article "https?://[^ ]+" green default
highlight article "^(Title):.*$" blue default bold
highlight article "\\[[0-9][0-9]*\\]" magenta default bold
highlight article "\\[image\\ [0-9]+\\]" green default bold
highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold
highlight article ":.*\\(link\\)$" cyan default
highlight article ":.*\\(image\\)$" blue default bold
highlight article ":.*\\(embedded flash\\)$" magenta default
Steps to reproduce the issue:
newsboatOther info:
Only happens with 2.20, I tried reverting to 2.19 and it works as expected.
I installed it from the Arch official repo.
I have ~50 youtube channels in the urls file and ~20 other rss.
I can reproduce with just the combination of the following two config lines (either line on their works fine):
auto-reload yes
feed-sort-order lastupdated
in combination with the following urls file (old file used for testing previous issues):
https://export.arxiv.org/rss/cs.PL
http://antirez.com/rss test abc
https://eklitzke.org/index.rss test
http://www.aerialmantis.co.uk/feed.xml
http://rss.slashdot.org/Slashdot/slashdot
file:///home/dennis/projects/newsboat/test-feed.xml abc
https://newsboat.org/news.atom abc def
https://dennisschagt.nl/invalid def
"query:Unread Articles:unread = \"yes\""
"query:Unread Articles:unread # \"yes\""
https://daten.berlin.de/datensaetze/rss.xml
https://blog.debiania.in.ua/feeds/english.atom
"query:Blogroll for Take on Rules:tags # \"abc\""
"query:Contains the (with include oper):content # \"the\""
"query:Contains the (with regexp):content =~ \"the\""
# Youtube
https://www.youtube.com/feeds/videos.xml?channel_id=UCYO_jab_esuFRV4b17AJtAw youtube
https://www.youtube.com/feeds/videos.xml?channel_id=UC7kIy8fZavEni8Gzl8NLjOQ youtube
# issue 38
http://feed.williamlong.info/
# issue 335
https://www.reddit.com/r/C_Programming/.rss
https://www.reddit.com/r/C_Programming/comments/9vz2y2/tricks_for_avoiding_void_when_implementing/.rss
# issue 1016
https://tbgforums.com/forums/extern.php?action=feed&tid=5416&type=atom
https://bbs.archlinux.org/extern.php?action=feed&tid=239217&type=atom
The first time starting (without a cache file) works fine.
After quitting, Newsboat does not start successfully anymore (Segmentation fault every time).
The configured URLs does seem to make a difference, the issue did not reproduce when I only kept a few URLs.
It looks like this issue requires some specific timing to reproduce (I can reproduce when building with -O0 but not with optimization -O2).
Git bisect points to commit https://github.com/newsboat/newsboat/commit/95c1b5dae4a842247f31b6ed90310cab7620575a, which makes sense as that commit has some changes related to the feed-sort-order configuration (I'm not completely certain as this apparent race condition might have interfered (false negative) with any of the bisection steps).
I bisected debug builds (make PROFILE=1 newsboat) which I ran three times in a row to soften the effect of false positives; I ended up on the same commit as @dennisschagt.
Not clear while this would segfault, though. Investigating...
Ah, turns out FeedContainer::unread_feed_count() doesn't acquire a mutex on FeedContainer's core data structure, a vector of feeds. It iterates over it, while FeedListFormAction is busy sorting that same vector.
The fix is trivial: just acquire the mutex. I'll submit a PR once I looked through other methods to check if they have the same problem.
Most helpful comment
I can reproduce with just the combination of the following two config lines (either line on their works fine):
in combination with the following urls file (old file used for testing previous issues):
The first time starting (without a cache file) works fine.
After quitting, Newsboat does not start successfully anymore (Segmentation fault every time).
The configured URLs does seem to make a difference, the issue did not reproduce when I only kept a few URLs.