Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gerbera in Gentoo, error: terminate called after throwing an instance of 'std::invalid_argument' what(): stoi Aborted #994

Closed
cafaia opened this issue Oct 1, 2020 · 16 comments · Fixed by #997

Comments

@cafaia
Copy link

cafaia commented Oct 1, 2020

Hello everyone!

I have installed the gerbera-1.6.1 program in my Gentoo, but this version and version 1.5 don't work either.
I manually launched the program with the command: "gerbera --logfile /var/log/gerbera.log --config /etc/gerbera/config.xml --port 49152 -i 192.168.1.10" and he worked a little bit, but after a short while he stopped with the message: 'terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi
Aborted'

I thank you for your help!

@KarlStraussberger
Copy link
Member

Can you run gerbera in gdb (debugger) and print the stack (command bt)? You can also try to run it with -D to print debug messages.

Thanks for reporting and helping to make gerbera even better.

@cafaia
Copy link
Author

cafaia commented Oct 1, 2020

Hello, thank you for your help!

Here I have the output with gdb:

Starting program: /usr/bin/gerbera --logfile /var/log/gerbera.log --config /etc/gerbera/config.xml --port 49152 -i 192.168.1.10
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffee967700 (LWP 28382)]
[New Thread 0x7fffee166700 (LWP 28427)]
[New Thread 0x7fffed965700 (LWP 28428)]
[New Thread 0x7fffed164700 (LWP 28429)]
[New Thread 0x7fffec963700 (LWP 28430)]
[New Thread 0x7fffe7fff700 (LWP 28431)]
[New Thread 0x7fffe77fe700 (LWP 28432)]
[New Thread 0x7fffe6ffd700 (LWP 28433)]
[New Thread 0x7fffe67fc700 (LWP 28435)]
[New Thread 0x7fffe5ffb700 (LWP 28454)]
[New Thread 0x7fffe57fa700 (LWP 28455)]
[New Thread 0x7fffe4ff9700 (LWP 28456)]
[New Thread 0x7fffdffff700 (LWP 28457)]
[New Thread 0x7fffdf7fe700 (LWP 28493)]
[New Thread 0x7fffdeffd700 (LWP 28494)]
[New Thread 0x7fffde7fc700 (LWP 28495)]
[New Thread 0x7fffddffb700 (LWP 28496)]
[New Thread 0x7fffdd7fa700 (LWP 28544)]
[New Thread 0x7fffdcff9700 (LWP 28545)]
[Thread 0x7fffed965700 (LWP 28428) exited]
[Thread 0x7fffe77fe700 (LWP 28432) exited]
[Thread 0x7fffe4ff9700 (LWP 28456) exited]
[Thread 0x7fffdffff700 (LWP 28457) exited]
terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi
--Type for more, q to quit, c to continue without paging--

Thread 20 "gerbera" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffdcff9700 (LWP 28545)]
0x00007ffff6d87461 in raise () from /lib64/libc.so.6
(gdb)

@cafaia
Copy link
Author

cafaia commented Oct 1, 2020

Here I have the output with '--debug':

2020-10-01 17:17:25 info: [main.cc:77] logCopyright(): Gerbera UPnP Server version 1.6.1 - http://gerbera.io/
2020-10-01 17:17:25 info: [main.cc:78] logCopyright(): ===============================================================================
2020-10-01 17:17:25 info: [main.cc:79] logCopyright(): Gerbera is free software, covered by the GNU General Public License version 2
2020-10-01 17:17:25 info: [main.cc:80] logCopyright(): Copyright 2016-2020 Gerbera Contributors.
2020-10-01 17:17:25 info: [main.cc:81] logCopyright(): Gerbera is based on MediaTomb: Copyright 2005-2010 Gena Batsyan, Sergey Bostandzhyan, Leonhard Wimmer.
2020-10-01 17:17:25 info: [main.cc:82] logCopyright(): ===============================================================================
2020-10-01 17:17:25 info: [config_manager.cc:156] load(): Loading configuration from: /etc/gerbera/config.xml
2020-10-01 17:17:25 info: [config_manager.cc:163] load(): Checking configuration...
2020-10-01 17:17:25 info: [config_manager.cc:601] load(): Setting filesystem import charset to UTF-8
2020-10-01 17:17:25 info: [config_manager.cc:613] load(): Setting metadata import charset to UTF-8
2020-10-01 17:17:25 info: [config_manager.cc:625] load(): Setting playlist charset to UTF-8
2020-10-01 17:17:25 info: [config_manager.cc:1292] load(): Configuration check succeeded.
2020-10-01 17:17:25 info: [sql_storage.cc:2241] doMetadataMigration(): About to migrate metadata from mt_cds_object to mt_metadata
2020-10-01 17:17:25 info: [sql_storage.cc:2242] doMetadataMigration(): No data will be removed from mt_cds_object
2020-10-01 17:17:25 info: [sql_storage.cc:2258] doMetadataMigration(): Migrated metadata - object count: 0
2020-10-01 17:17:25 info: [server.cc:127] run(): Initialized port: 49152
2020-10-01 17:17:25 info: [server.cc:133] run(): Server bound to: 192.168.1.10
2020-10-01 17:17:26 info: [server.cc:236] run(): The Web UI can be reached by following this link: http://192.168.1.10:49152/

@KarlStraussberger
Copy link
Member

Hello, thank you for your help!

Here I have the output with gdb:

Starting program: /usr/bin/gerbera --logfile /var/log/gerbera.log --config /etc/gerbera/config.xml --port 49152 -i 192.168.1.10
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffee967700 (LWP 28382)]
[New Thread 0x7fffee166700 (LWP 28427)]
[New Thread 0x7fffed965700 (LWP 28428)]
[New Thread 0x7fffed164700 (LWP 28429)]
[New Thread 0x7fffec963700 (LWP 28430)]
[New Thread 0x7fffe7fff700 (LWP 28431)]
[New Thread 0x7fffe77fe700 (LWP 28432)]
[New Thread 0x7fffe6ffd700 (LWP 28433)]
[New Thread 0x7fffe67fc700 (LWP 28435)]
[New Thread 0x7fffe5ffb700 (LWP 28454)]
[New Thread 0x7fffe57fa700 (LWP 28455)]
[New Thread 0x7fffe4ff9700 (LWP 28456)]
[New Thread 0x7fffdffff700 (LWP 28457)]
[New Thread 0x7fffdf7fe700 (LWP 28493)]
[New Thread 0x7fffdeffd700 (LWP 28494)]
[New Thread 0x7fffde7fc700 (LWP 28495)]
[New Thread 0x7fffddffb700 (LWP 28496)]
[New Thread 0x7fffdd7fa700 (LWP 28544)]
[New Thread 0x7fffdcff9700 (LWP 28545)]
[Thread 0x7fffed965700 (LWP 28428) exited]
[Thread 0x7fffe77fe700 (LWP 28432) exited]
[Thread 0x7fffe4ff9700 (LWP 28456) exited]
[Thread 0x7fffdffff700 (LWP 28457) exited]
terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi
--Type for more, q to quit, c to continue without paging--

Thread 20 "gerbera" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffdcff9700 (LWP 28545)]
0x00007ffff6d87461 in raise () from /lib64/libc.so.6
(gdb)

Can you type bt before quitting. It gives the stacktrace of the crash.

@cafaia
Copy link
Author

cafaia commented Oct 1, 2020

Sorry for my lapse, here's the output of the bt command:

[Switching to Thread 0x7fffdcff9700 (LWP 25985)]
0x00007ffff6d87421 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff6d87421 in raise () at /lib64/libc.so.6
#1 0x00007ffff6d7153b in abort () at /lib64/libc.so.6
#2 0x00007ffff6fa9745 in () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#3 0x00007ffff6fd95d6 in () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#4 0x00007ffff6fd9641 in () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#5 0x00007ffff6fd9893 in () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#6 0x00007ffff6fac1b8 in std::__throw_invalid_argument(char const*) () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#7 0x00005555556e418b in ()
#8 0x00005555556e42f8 in ()
#9 0x0000555555660359 in ()
#10 0x00005555556466d3 in ()
#11 0x0000555555649025 in ()
#12 0x000055555564d467 in ()
#13 0x000055555564d827 in ()
#14 0x000055555564fb87 in ()
#15 0x00005555556504d6 in ()
#16 0x0000555555643a34 in ()
#17 0x0000555555644099 in ()
#18 0x00007ffff7e9de67 in start_thread () at /lib64/libpthread.so.0
#19 0x00007ffff6e476cf in clone () at /lib64/libc.so.6
(gdb)

@KarlStraussberger
Copy link
Member

Well the gdb output is of no real help, because gerbera was compiled without debug symbols (or stripped afterwards).

On the other hand, your output with --debug does not contain any details with "debug:". Make sure it is the first option in the commandline.

@whyman
Copy link
Member

whyman commented Oct 2, 2020

You will want to enable symbols for this package, see: https://blog.ramses-pyramidenbau.de/?p=252

@whyman whyman closed this as completed Oct 2, 2020
@whyman whyman reopened this Oct 2, 2020
@cafaia
Copy link
Author

cafaia commented Oct 2, 2020

Hello!

Thank you both for your patience and tips!
Now I did the commands again, and that came out:

(gdb) run
Starting program: /usr/bin/gerbera --logfile /var/log/gerbera.log --config /etc/gerbera/config.xml --port 49152 -i 192.168.1.10
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffee967700 (LWP 27461)]
[New Thread 0x7fffee166700 (LWP 11760)]
[New Thread 0x7fffed965700 (LWP 11761)]
[New Thread 0x7fffed164700 (LWP 11762)]
[New Thread 0x7fffec963700 (LWP 11763)]
[New Thread 0x7fffe7fff700 (LWP 11764)]
[New Thread 0x7fffe77fe700 (LWP 11765)]
[New Thread 0x7fffe6ffd700 (LWP 11766)]
[New Thread 0x7fffe67fc700 (LWP 11767)]
[New Thread 0x7fffe5ffb700 (LWP 11768)]
[New Thread 0x7fffe57fa700 (LWP 11769)]
[New Thread 0x7fffe4ff9700 (LWP 11770)]
[New Thread 0x7fffdffff700 (LWP 11771)]
[New Thread 0x7fffdf7fe700 (LWP 11772)]
[New Thread 0x7fffdeffd700 (LWP 11773)]
[New Thread 0x7fffde7fc700 (LWP 11774)]
[New Thread 0x7fffddffb700 (LWP 11775)]
[New Thread 0x7fffdd7fa700 (LWP 11776)]
[New Thread 0x7fffdcff9700 (LWP 11777)]
[New Thread 0x7fffbffff700 (LWP 11778)]
[Thread 0x7fffed965700 (LWP 11761) exited]
[Thread 0x7fffe7fff700 (LWP 11764) exited]
[Thread 0x7fffdeffd700 (LWP 11773) exited]
[Thread 0x7fffdffff700 (LWP 11771) exited]
[Thread 0x7fffe4ff9700 (LWP 11770) exited]
[Thread 0x7fffe5ffb700 (LWP 11768) exited]
[Thread 0x7fffec963700 (LWP 11763) exited]
[Thread 0x7fffed164700 (LWP 11762) exited]
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
--Type <RET> for more, q to quit, c to continue without paging--

Thread 21 "gerbera" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffbffff700 (LWP 11778)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff6d7153b in __GI_abort () at abort.c:79
#2  0x00007ffff6fa9745 in  () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#3  0x00007ffff6fd95d6 in  () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#4  0x00007ffff6fd9641 in  () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#5  0x00007ffff6fd9893 in  () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#6  0x00007ffff6fac1b8 in std::__throw_invalid_argument(char const*) () at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/libstdc++.so.6
#7  0x00005555556e418b in __gnu_cxx::__stoa<long, int, char, int>(long (*)(char const*, char**, int), char const*, char const*, unsigned long*, int)
    (__idx=0x0, __str=0x7fffbfffd920 "Type", __name=0x5555557583de "stoi", __convf=<optimized out>)
    at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/basic_string.h:320
#8  std::__cxx11::stoi(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long*, int)
    (__base=10, __idx=0x0, __str="Type") at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/basic_string.h:6504
#9  FfmpegHandler::addFfmpegMetadataFields(std::shared_ptr<CdsItem> const&, AVFormatContext*) const (this=<optimized out>, item=
    std::shared_ptr<class CdsItem> (use count 3, weak count 0) = {...}, pFormatCtx=0x7fffb00bba80)
    at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/metadata/ffmpeg_handler.cc:127
#10 0x00005555556e42f8 in FfmpegHandler::fillMetadata(std::shared_ptr<CdsItem>)
    (this=this@entry=0x7fffbfffdcc0, item=std::shared_ptr<class CdsItem> (use count 3, weak count 0) = {...})
    at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/metadata/ffmpeg_handler.cc:258
#11 0x0000555555660359 in MetadataHandler::setMetadata(std::shared_ptr<Config> const&, std::shared_ptr<CdsItem> const&) (config=
    std::shared_ptr<class Config> (use count 10, weak count 0) = {...}, item=std::shared_ptr<class CdsItem> (use count 3, weak count 0) = {...})
    at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/ext/atomicity.h:96
#12 0x00005555556466d3 in ContentManager::createObjectFromFile(std::filesystem::__cxx11::path const&, bool, bool)
    (this=0x55555581bfa0, path=..., magic=<optimized out>, allow_fifo=<optimized out>)
    at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/content_manager.cc:1133
#13 0x0000555555649025 in ContentManager::createSingleItem(std::filesystem::__cxx11::path const&, std::filesystem::__cxx11::path&, bool, bool, std::shared_ptr<CMAddFileTask> const&)
--Type <RET> for more, q to quit, c to continue without paging--
    (this=0x55555581bfa0, path=filesystem::path "/hd/Musics/COLETANEAS/Discos_Marcus_Pereira/Discos Marcus Pereira- Coleção 166 LPs, Vinils, CDs/Escola De Samba Acadêmicos Do Salgueiro - História Das Escolas de Samba – Salgueiro (1975)/11-Assi"... = {...}, rootPath=filesystem::path "/hd/Musics" = {...}, checkStorage=<optimized out>, processExisting=<optimized out>, task=std::shared_ptr<class CMAddFileTask> (empty) = {...})
    at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/content_manager.cc:454
#14 0x000055555564d467 in ContentManager::_addFile(std::filesystem::__cxx11::path const&, std::filesystem::__cxx11::path, bool, bool, bool, std::shared_ptr<CMAddFileTask> const&)
    (this=0x55555581bfa0, path=filesystem::path "/hd/Musics/COLETANEAS/Discos_Marcus_Pereira/Discos Marcus Pereira- Coleção 166 LPs, Vinils, CDs/Escola De Samba Acadêmicos Do Salgueiro - História Das Escolas de Samba – Salgueiro (1975)/11-Assi"... = {...}, rootPath=filesystem::path "/hd/Musics" = {...}, recursive=<optimized out>, hidden=<optimized out>, rescanResource=<optimized out>, task=std::shared_ptr<class CMAddFileTask> (empty) = {...})
    at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/content_manager.cc:506
#15 0x000055555564d827 in ContentManager::addFileInternal(std::filesystem::__cxx11::path const&, std::filesystem::__cxx11::path const&, bool, bool, bool, bool, bool, unsigned int, bool)
    (this=0x55555581bfa0, path=filesystem::path "/hd/Musics/COLETANEAS/Discos_Marcus_Pereira/Discos Marcus Pereira- Coleção 166 LPs, Vinils, CDs/Escola De Samba Acadêmicos Do Salgueiro - História Das Escolas de Samba – Salgueiro (1975)/11-Assi"... = {...}, rootpath=..., recursive=false, async=<optimized out>, hidden=false, rescanResource=false, lowPriority=false, parentTaskID=0, cancellable=true) at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/bits/basic_string.h:936
#16 0x000055555564fb87 in ContentManager::_rescanDirectory(std::shared_ptr<AutoscanDirectory> const&, int, std::shared_ptr<GenericTask> const&)
    (this=0x55555581bfa0, adir=..., containerID=<optimized out>, task=...) at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/autoscan.h:139
#17 0x00005555556504d6 in CMRescanDirectoryTask::run() (this=0x7fffe8295990) at /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include/g++-v9/ext/atomicity.h:96
#18 0x0000555555643a34 in ContentManager::threadProc() (this=0x55555581bfa0) at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/content_manager.cc:1260
#19 0x0000555555644099 in ContentManager::staticThreadProc(void*) (arg=<optimized out>)
    at /var/tmp/portage/net-misc/gerbera-1.6.1/work/gerbera-1.6.1/src/content_manager.cc:1279
#20 0x00007ffff7e9de67 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x00007ffff6e476cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)

@whyman
Copy link
Member

whyman commented Oct 2, 2020

It looks like some file path "/hd/Musics/COLETANEAS/Discos_Marcus_Pereira/Discos Marcus Pereira- Coleção 166 LPs, Vinils, CDs/Escola De Samba Acadêmicos Do Salgueiro - História Das Escolas de Samba – Salgueiro (1975)/11-Assi....has a date field that is tripping us up.

What is the value of the date in that file?

@cafaia
Copy link
Author

cafaia commented Oct 2, 2020

The dates in this file are:

"Created: 02/1/2019 18:17:40 -02
Modified: 10/6/2018 10:34:20 -03
Accessed: 02/1/2019 18:17:40 -02"

I used the date format: day / month / Year

Thanks for your attention and help!

@cafaia
Copy link
Author

cafaia commented Oct 2, 2020

Hello!

Problem solved, I removed the folder with the file above and the program returned to work normally.
I have in my collection 258473 audio files and it looks like this is the only one with a problem, is this possible?
With best regards,

Eduardo Coutinho Scalabrin

@whyman
Copy link
Member

whyman commented Oct 2, 2020

Yes, it is possible.

To clarify my previous request, I believe it is the metadata date field within the file e.g. ID3 or Vorbis comment etc.

@KarlStraussberger
Copy link
Member

KarlStraussberger commented Oct 2, 2020

We should add std::isdigit in that code to avoid future crashes.

(std::find_if(value.begin(), value.end(), [ ](unsigned char c) { return !std::isdigit(c); }) == value.end()) && in line 127 of ffmpeg_handler.cc

@cafaia
Copy link
Author

cafaia commented Oct 3, 2020

I am sending the file that presented a problem, maybe that helps.
11-Assim Não é Legal.tar.gz

@KarlStraussberger
Copy link
Member

KarlStraussberger commented Oct 3, 2020

The file is definitively strange

Album                                    : Type Value Here
Performer                                : Type Value Here
Recorded date                            : Type Value Here

The fix above did the trick.

Change album, artist and date and you should be able to import it until we can publish an update.

@cafaia
Copy link
Author

cafaia commented Oct 3, 2020

Hello!

I did what you said, I changed the tags and put the folder back on the server and everything worked fine!
Thank you so much for everything, whyman and KarlStraussberger, and congratulations on the work!
With best regards,

Eduardo Coutinho Scalabrin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants