licoffe / POE-Stash-indexer-NG

High performance Path of Exile stash indexer
MIT License
43 stars 12 forks source link

Segmentation Fault #2

Closed x123 closed 7 years ago

x123 commented 7 years ago

Running on Debian 8.6 64-bit. MySQL user/db/privs all correct. Turns out the issue is you provide no empty 'data' dir in your skeleton, while your main.cpp sets the download_dir to ./data/. Might want to create an empty data dir in the repo or at least mention it in the README.

# Database credentials
DB_HOST     = tcp://127.0.0.1
DB_PORT     = 3306
DB_USER     = redacted
DB_PASS     = redacted
DB_NAME     = POE
DB_DATA_DIR = /var/lib/mysql

Segfaults in /var/log/messages:

Jan  5 13:24:10 REDACTED kernel: [  950.516414] indexer[13408]: segfault at 0 ip 00007f2e107ad9e0 sp 00007f2e067fb230 error 4 in libc-2.19.so[7f2e10743000+1a1000]
Jan  5 13:26:27 REDACTED kernel: [ 1088.254572] indexer[13813]: segfault at 0 ip 00007faec44209e0 sp 00007faeba5ef230 error 4 in libc-2.19.so[7faec43b6000+1a1000]
Jan  5 13:30:48 REDACTED kernel: [ 1348.780972] indexer[13903]: segfault at 0 ip 00007fca2f19a9e0 sp 00007fca293ef230 error 4 in libc-2.19.so[7fca2f130000+1a1000]

Backtrace from gdb, this is how I found out it had to do with a problem writing a file:


GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./indexer...done.
(gdb) run
Starting program: /root/POE-Stash-indexer-NG/indexer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff2f44700 (LWP 13823)]
[Thread 0x7ffff2f44700 (LWP 13823) exited]
2017-01-05 13:26:38 > [main] Connected to DB in 0.036458 sec
2017-01-05 13:26:38 > [main] Checking last downloaded chunk
2017-01-05 13:26:38 > [main] New indexation:
[New Thread 0x7ffff2f44700 (LWP 13824)]
2017-01-05 13:26:38 > [mod_loop] Waiting for mods to insert
[New Thread 0x7ffff2537700 (LWP 13825)]
2017-01-05 13:26:38 > [requirement_loop] Waiting for requirements to insert
[New Thread 0x7ffff1d36700 (LWP 13826)]
2017-01-05 13:26:38 > [property_loop] Waiting for property to insert
[New Thread 0x7ffff1535700 (LWP 13827)]
2017-01-05 13:26:38 > [socket_loop] Waiting for socket to insert
[New Thread 0x7ffff0d34700 (LWP 13828)]
[New Thread 0x7fffe3fff700 (LWP 13829)]
[New Thread 0x7fffe37fe700 (LWP 13830)]
2017-01-05 13:26:38 > [processing_loop] Waiting for files to process
[Thread 0x7fffe37fe700 (LWP 13830) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff0d34700 (LWP 13828)]
__GI__IO_fwrite (buf=0x7fffd8015a40, size=1, count=1694, fp=0x0) at iofwrite.c:41
41      iofwrite.c: No such file or directory.
(gdb) bt
#0  __GI__IO_fwrite (buf=0x7fffd8015a40, size=1, count=1694, fp=0x0) at iofwrite.c:41
#1  0x00007ffff79673c8 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#2  0x00007ffff79876cc in ?? () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#3  0x00007ffff7987a02 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#4  0x00007ffff7981ad3 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#5  0x00007ffff797c3df in ?? () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#6  0x00007ffff7986749 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#7  0x00007ffff7986f91 in curl_multi_perform () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#8  0x00007ffff797ddeb in curl_easy_perform () from /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
#9  0x000000000041b5de in download_JSON(std::string) ()
#10 0x0000000000423c98 in download_loop() ()
#11 0x00007ffff73ec970 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007ffff7bc70a4 in start_thread (arg=0x7ffff0d34700) at pthread_create.c:309
#13 0x00007ffff6b5c62d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) quit
A debugging session is active.

        Inferior 1 [process 13819] will be killed.

Quit anyway? (y or n) Y```
licoffe commented 7 years ago

Thanks for the heads-up. It should be fixed in the last commit ;)