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

SIGSEGV when using direct_reads #5731

Open
dongdaoguang opened this issue Aug 23, 2019 · 0 comments
Open

SIGSEGV when using direct_reads #5731

dongdaoguang opened this issue Aug 23, 2019 · 0 comments

Comments

@dongdaoguang
Copy link

Hello there,
I am not sure if I use it wrong but when I turn on the RocksDB use_direct_reads, this SIGSEGV bug will show up when open the db. I used version 5.9.2. Hope someone can shed some light on this. Thanks!

Expected behavior

The RocksDB direct I/O mode work fine.

Actual behavior

This SIGSEGV appears when open db.

Steps to reproduce the behavior

  1. set use_direct_reads = true in options.h file.
  2. invoke DB::Open api

coredump

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fa23a22d810 in _IO_sgetn_internal () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7fa23b44aa80 (LWP 38038))]
(gdb) bt
#0  0x00007fa23a22d810 in _IO_sgetn_internal () from /lib64/libc.so.6
#1  0x00007fa23a22ac0e in fread_unlocked () from /lib64/libc.so.6
#2  0x000000000074b25a in rocksdb::PosixSequentialFile::Read (this=0x28e05a0, n=8192, result=0x7ffefb636f30, scratch=0x2864000 "") at env/io_posix.cc:159
#3  0x000000000073f500 in rocksdb::ReadFileToString (env=<optimized out>, fname=..., data=data@entry=0x7ffefb637060) at env/env.cc:297
#4  0x00000000007198c5 in rocksdb::VersionSet::Recover (this=0x26ca2c0, column_families=..., read_only=read_only@entry=false) at db/version_set.cc:2817
#5  0x0000000000689018 in rocksdb::DBImpl::Recover (this=this@entry=0x28ce000, column_families=..., read_only=read_only@entry=false, error_if_log_file_exist=error_if_log_file_exist@entry=false,
    error_if_data_exists_in_logs=error_if_data_exists_in_logs@entry=false) at db/db_impl_open.cc:361

rocksdb log

2019/08/23-13:48:05.293022 7fa23b44aa80 RocksDB version: 5.9.2
2019/08/23-13:48:05.293072 7fa23b44aa80 Git sha rocksdb_build_git_sha:231fdc1546dd492e6cc567844acee512c40ef83f
2019/08/23-13:48:05.293077 7fa23b44aa80 Compile date Aug 23 2019
2019/08/23-13:48:05.293080 7fa23b44aa80 DB SUMMARY
2019/08/23-13:48:05.293260 7fa23b44aa80 CURRENT file:  CURRENT
2019/08/23-13:48:05.293264 7fa23b44aa80 IDENTITY file:  IDENTITY
2019/08/23-13:48:05.293273 7fa23b44aa80 MANIFEST file:  MANIFEST-000937 size: 11591 Bytes
2019/08/23-13:48:05.293277 7fa23b44aa80 SST files in ./db/strings dir, Total Num: 179, files: 000089.sst 000573.sst 000577.sst 000581.sst 000585.sst 000606.sst 000667.sst 000668.sst 000680.sst
2019/08/23-13:48:05.293280 7fa23b44aa80 Write Ahead Log file in ./db/strings: 000932.log size: 35 ; 000935.log size: 0 ; 000938.log size: 0 ;
2019/08/23-13:48:05.293286 7fa23b44aa80                         Options.error_if_exists: 0
2019/08/23-13:48:05.293288 7fa23b44aa80                       Options.create_if_missing: 1
2019/08/23-13:48:05.293290 7fa23b44aa80                         Options.paranoid_checks: 1
2019/08/23-13:48:05.293292 7fa23b44aa80                                     Options.env: 0xe534c0
2019/08/23-13:48:05.293294 7fa23b44aa80                                Options.info_log: 0x28d4000
2019/08/23-13:48:05.293296 7fa23b44aa80                Options.max_file_opening_threads: 16
2019/08/23-13:48:05.293298 7fa23b44aa80                              Options.statistics: (nil)
2019/08/23-13:48:05.293301 7fa23b44aa80                               Options.use_fsync: 0
2019/08/23-13:48:05.293303 7fa23b44aa80                       Options.max_log_file_size: 536870912
2019/08/23-13:48:05.293305 7fa23b44aa80                  Options.max_manifest_file_size: 67108864
2019/08/23-13:48:05.293307 7fa23b44aa80                   Options.log_file_time_to_roll: 0
2019/08/23-13:48:05.293308 7fa23b44aa80                       Options.keep_log_file_num: 10
2019/08/23-13:48:05.293310 7fa23b44aa80                    Options.recycle_log_file_num: 0
2019/08/23-13:48:05.293312 7fa23b44aa80                         Options.allow_fallocate: 1
2019/08/23-13:48:05.293314 7fa23b44aa80                        Options.allow_mmap_reads: 0
2019/08/23-13:48:05.293315 7fa23b44aa80                       Options.allow_mmap_writes: 0
2019/08/23-13:48:05.293317 7fa23b44aa80                        Options.use_direct_reads: 1
2019/08/23-13:48:05.293319 7fa23b44aa80                        Options.use_direct_io_for_flush_and_compaction: 0
2019/08/23-13:48:05.293321 7fa23b44aa80          Options.create_missing_column_families: 0
2019/08/23-13:48:05.293322 7fa23b44aa80                              Options.db_log_dir:
2019/08/23-13:48:05.293324 7fa23b44aa80                                 Options.wal_dir: ./db/strings
2019/08/23-13:48:05.293326 7fa23b44aa80                Options.table_cache_numshardbits: 6
2019/08/23-13:48:05.293328 7fa23b44aa80                      Options.max_subcompactions: 3
2019/08/23-13:48:05.293330 7fa23b44aa80                  Options.max_background_flushes: 2
2019/08/23-13:48:05.293331 7fa23b44aa80                         Options.WAL_ttl_seconds: 0
2019/08/23-13:48:05.293333 7fa23b44aa80                       Options.WAL_size_limit_MB: 0
2019/08/23-13:48:05.293335 7fa23b44aa80             Options.manifest_preallocation_size: 4194304
2019/08/23-13:48:05.293337 7fa23b44aa80                     Options.is_fd_close_on_exec: 1
2019/08/23-13:48:05.293339 7fa23b44aa80                   Options.advise_random_on_open: 1
2019/08/23-13:48:05.293340 7fa23b44aa80                    Options.db_write_buffer_size: 0
2019/08/23-13:48:05.293342 7fa23b44aa80                    Options.write_buffer_manager: 0x28c35f0
2019/08/23-13:48:05.293344 7fa23b44aa80         Options.access_hint_on_compaction_start: 1
2019/08/23-13:48:05.293346 7fa23b44aa80  Options.new_table_reader_for_compaction_inputs: 0
2019/08/23-13:48:05.293348 7fa23b44aa80               Options.compaction_readahead_size: 0
2019/08/23-13:48:05.293349 7fa23b44aa80           Options.random_access_max_buffer_size: 1048576
2019/08/23-13:48:05.293351 7fa23b44aa80

creash reason

VersionSet::Recover -> ReadFileToString -> Read
If use direct reads, NewSequentialFile function will init fd, but FILE ptr is NULL. When invoke SequentialFile‘s Read, it will invoke fread_unlocked(scratch, 1, n, file_), but file_ is NULL, crash 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

1 participant