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

Download fails 'std::invalid_argument' what(): stoi #101

Closed
hollunder opened this issue Jan 18, 2017 · 10 comments
Closed

Download fails 'std::invalid_argument' what(): stoi #101

hollunder opened this issue Jan 18, 2017 · 10 comments

Comments

@hollunder
Copy link

hollunder commented Jan 18, 2017

$ lgogdownloader --download
terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi
Aborted (core dumped)

Happens with latest git and 3.1.
I also created fresh config, no difference.
Since both versions are affected I assume this is due to a change on gog.com.

@Sude-
Copy link
Owner

Sude- commented Jan 18, 2017

Does this also happen with lgogdownloader --list

Backtrace from debug build would be helpful.

@hollunder
Copy link
Author

hollunder commented Jan 19, 2017

Yes, it also happens with --list and --repair. That's all I have tried so far.
It always crashes at the end of "getting game names".
I did make a debug build but don't see anything obviously wrong. Most of it is a list of the games.

The text output is rather long and I have yet to sanitize it. Is there a specific part that you are looking for?

@Sude-
Copy link
Owner

Sude- commented Jan 19, 2017

The text output is rather long and I have yet to sanitize it. Is there a specific part that you are looking for?

The last json output from it might be useful.

Run the debug build with gdb

gdb ./lgogdownloader
run --list

after the downloader crashes type

thread apply all backtrace

Output from that backtrace command would be helpful

@hollunder
Copy link
Author

Hi, here is the requested output.

terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi

Thread 1 "lgogdownloader" received signal SIGABRT, Aborted.
0x00007ffff526a04f in raise () from /usr/lib/libc.so.6
(gdb) thread apply all bt

Thread 1 (Thread 0x7ffff7fadd80 (LWP 2117)):
#0 0x00007ffff526a04f in raise () from /usr/lib/libc.so.6
#1 0x00007ffff526b47a in abort () from /usr/lib/libc.so.6
#2 0x00007ffff5b814ed in __gnu_cxx::__verbose_terminate_handler () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00007ffff5b7f2a6 in __cxxabiv1::__terminate (handler=) at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4 0x00007ffff5b7f2f1 in std::terminate () at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5 0x00007ffff5b7f508 in __cxxabiv1::__cxa_throw (obj=obj@entry=0xc1c6b0, tinfo=0x6d4780 , dest=0x7ffff5b94f90 std::invalid_argument::~invalid_argument())
at /build/gcc/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:87
#6 0x00007ffff5ba8f8f in std::__throw_invalid_argument (__s=0x4b0d90 "stoi") at /build/gcc/src/gcc/libstdc++-v3/src/c++11/functexcept.cc:82
#7 0x0000000000450008 in int __gnu_cxx::__stoa<long, int, char, int>(long ()(char const, char**, int), char const*, char const*, unsigned long*, int) ()
#8 0x0000000000466b44 in Website::getGames() ()
#9 0x00000000004749b4 in Downloader::getGameList() ()
#10 0x0000000000487acd in Downloader::listGames() ()
#11 0x00000000004382a3 in main ()

@Sude-
Copy link
Owner

Sude- commented Jan 19, 2017

Try lgogdownloader --list with this patch: https://sites.google.com/site/gogdownloader/getgames_invalid_argument.diff
(no need for debug build with this patch)

Hopefully it won't crash with this patch.
It should output game name and some json when std::invalid_argument exception is thrown. I'm interested in what it outputs.

@hollunder
Copy link
Author

hollunder commented Jan 19, 2017

Well, it no longer crashes. I don't think you need the entire list of games, so here is the beginning:

$ lgogdownloader --list
std::invalid_argument: stoi / 78
the_witcher_3_wild_hunt_game
null
Getting game names (9/9) 78 / 78
1954_alcatraz
the_7th_guest
99_levels_to_hell
a_bird_story
...

Worth mentioning is that I have the the_witcher_3_wild_hunt dlc, but not the basegame.

@Sude-
Copy link
Owner

Sude- commented Jan 19, 2017

Apparently the crash was caused by null value for updates in json. The value was probably null because of not owning the base game.
22f47de adds a check for this and should fix the issue

@hollunder
Copy link
Author

Thanks, it works now.
I wonder what changed, because I had that DLC for a long time.

@felisucoibi
Copy link

having this problem with ubuntu 18.04 ppa v 3.3

@Sude-
Copy link
Owner

Sude- commented Sep 5, 2018

@felisucoibi does this happen with latest git version?
If this happens with current git version then I need a backtrace from debug build

Build a debug build

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make

and then run the debug build with gdb
gdb -batch -ex "run" -ex "thread apply all bt" --args ./lgogdownloader --your --options --here

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

No branches or pull requests

3 participants