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

segfault when trying to list a not indexed directory #236

Open
deathtrip opened this issue Mar 25, 2020 · 26 comments
Open

segfault when trying to list a not indexed directory #236

deathtrip opened this issue Mar 25, 2020 · 26 comments
Assignees

Comments

@deathtrip
Copy link

When i'm inside a directory not in the database, and type duc ls i get:

Path /home/deathtrip not found in database
Requested path not found
zsh: segmentation fault (core dumped) duc ls

@zevv
Copy link
Owner

zevv commented Mar 26, 2020 via email

@deathtrip
Copy link
Author

duc version: 1.4.4
options: cairo x11 ui leveldb
Running on Arch Linux.

@l8gravely
Copy link
Collaborator

l8gravely commented Apr 3, 2020 via email

@deathtrip
Copy link
Author

Arch Linux is a rolling distro, so there is no "release", the segfault happens on both the 5.5 and 5.6 kernels.

duc info shows:
Date Time Files Dirs Size Path
2020-03-26 16:28:17 2.8K 1.7K 4.3G /home/deathtrip/makepkg/sources

Yes, i use a different $LANG (than en_US i assume).

@l8gravely
Copy link
Collaborator

l8gravely commented Apr 14, 2020 via email

@l8gravely l8gravely self-assigned this May 17, 2020
@splaisan
Copy link

I also have a similar issue under ubuntu 16.4 when I use * in my query

duc ls -D -d /opt/biotools/duc/db/freenas.db /mnt/freenas/NC_projects/*
...
expected output then at the end
...
Requested path not found
Segmentation fault (core dumped)

duc built from source

duc --version
duc version: 1.4.4
options: cairo x11 ui tokyocabinet

@l8gravely
Copy link
Collaborator

l8gravely commented Oct 19, 2020 via email

@splaisan
Copy link

ls /mnt/freenas/NC_projects/* returns a whole bunch of folders and content.
Just gut feeling but since I get some results, could it be that the tool fails when it tries to report '.' and or '..' ?
I have the impression that the failure comes after a substantial number of good results like if DUC would reach the end of its work-list and chew on something tasting bad.
again, just a gut feeling :-)

@l8gravely
Copy link
Collaborator

l8gravely commented Oct 21, 2020 via email

@l8gravely
Copy link
Collaborator

l8gravely commented Oct 30, 2020 via email

@alexmyczko
Copy link

alexmyczko commented Aug 9, 2021

I get a segmentation fault on Ubuntu 18.04 with duc --version

duc version: 1.4.3
options: ui tokyocabinet

as well as with

duc version: 1.4.4
options: ui tokyocabinet

when trying to duc index /scratch

maybe the output of strace duc index -x -p /scratch is helpful, the last few lines

openat(AT_FDCWD, "tests", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 13
fstat(13, {st_mode=S_IFDIR|0755, st_size=104, ...}) = 0
chdir("tests")                          = 0
getdents(13, /* 6 entries */, 32768)    = 192
lstat("__init__.py", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat("__init__.pyc", {st_mode=S_IFREG|0644, st_size=155, ...}) = 0
lstat("test_denton.py", {st_mode=S_IFREG|0644, st_size=1256, ...}) = 0
lstat("test_denton.pyc", {st_mode=S_IFREG|0644, st_size=1760, ...}) = 0
getdents(13, /* 0 entries */, 32768)    = 0
chdir("..")                             = 0
sched_yield()                           = 0
sched_yield()                           = 0
sched_yield()                           = 0
close(13)                               = 0
getdents(12, /* 0 entries */, 32768)    = 0
chdir("..")                             = 0
sched_yield()                           = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV +++
Segmentation fault

that is how it's mounted:
/dev/mapper/vg0-scr on /scratch type btrfs (rw,relatime,compress=lzo,space_cache,subvolid=5,subvol=/)

@l8gravely
Copy link
Collaborator

l8gravely commented Aug 10, 2021 via email

@alexmyczko
Copy link

alexmyczko commented Aug 10, 2021

@l8gravely I had tried with 1.4.4, you maybe mean a master/main checkout (current)?

Funnily, now I get a different output:

# duc index /scratch
free(): invalid next size (normal)
Aborted

as usual i get the upstream source, and oh well it ships debian/, is that needed, or can it be dropped?

ok now it looks different:

# duc --version
duc version: 1.4.5-rc1
options: ui tokyocabinet
# duc index /scratch
Using old database at "/root/.duc.db", please move this to "$XDG_CACHE_HOME/duc/duc.db"
free(): invalid next size (normal)
Aborted

ok so i remove /root/.duc.db and run it again, and it looks good. time for a new release, pity it won't make it into
debian bullseye...

and what should $XDG_CACHE_HOME if it's not defined? what happens on gnu/kfreebsd or macOS?

@l8gravely
Copy link
Collaborator

l8gravely commented Aug 12, 2021 via email

@alexmyczko
Copy link

it was 4.15.0 kernel of ubuntu 18.04, on btrfs with live file compression, see my previous two messages. fun fact: it doesn't crash anymore since indexed with 1.4.5-rc1 (yesterdays master), now 1.4.3 is back installed...

@l8gravely
Copy link
Collaborator

l8gravely commented Aug 12, 2021 via email

@alexmyczko
Copy link

alexmyczko commented Aug 12, 2021

Well, I have like 200 workstations (2 with 18.04, the rest with 20.04 of Ubuntu) with /scratch mostly being btrfs, and some are xfs, I'll need to rerun it on all to find the 1% that fail. I guess it's not related to filesystem generally, but more likely the files/directories where some just make it fail, for reasons
I can't imagine yet. Will keep posting here if I find out more...

@splaisan
Copy link

no idea if this could play here but I have had bad times long ago with windows users naming files or folders with prohibited characters like / \ | ( ) : that got somewhere interpreted and made my life miserable

@l8gravely
Copy link
Collaborator

l8gravely commented Aug 12, 2021 via email

@alexmyczko
Copy link

Thanks for the hint, it could of course very well be symlink loop(s).

@l8gravely
Copy link
Collaborator

l8gravely commented Aug 15, 2021 via email

@iksnalybok
Copy link

Hi, I just run into the same segfault issue.
Here is a test case:

$ wget https://github.com/zevv/duc/releases/download/1.4.4/duc-1.4.4.tar.gz
$ tar xf duc-1.4.4.tar.gz
$ cd duc-1.4.4/
$ ./configure && make
$ ./duc index --database=my.db .
$ ./duc ls --database=my.db doesNotExist
Requested path not found
Segmentation fault
$ ./duc ls --database=my.db /
Path / not found in database
Requested path not found
Segmentation fault

$ uname -a
Linux vrtc 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux

Full compilation-logs.txt.

@l8gravely
Copy link
Collaborator

l8gravely commented Oct 22, 2021 via email

@iksnalybok
Copy link

Hi, I compiled it from source (git clone, commit d2d1dfb), and I cannot reproduce the error.

$ ./duc index --database=my.db .
$ ./duc ls --database=my.db doesNotExist
The requested path 'doesNotExist' was not found in the database,
Please run 'duc info' for a list of available directories.
$ ./duc ls --database=my.db /
Path / not found in database
The requested path '/' was not found in the database,
Please run 'duc info' for a list of available directories.

It looks like ok. I also had similar issue on larger database, which I cannot reproduce too.

@l8gravely
Copy link
Collaborator

l8gravely commented Oct 25, 2021 via email

@platima
Copy link

platima commented Mar 20, 2022

Just build with the latest version (1.4.5-rc1) and have not had this again thankfully!

Note I did remove my .duc.db first too, just in case with the version change.

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

7 participants