Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug] BE division-by-zero error occurs when calculating inode_percentage

Open Beginner friendly
#65,545 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cpp
Domain
backend

Research direction

Start in be/src/io/cache/block_file_cache.cpp at doris::io::disk_used_percentage, especially line 1822 and its caller BlockFileCache::check_disk_resource_limit. Reproduce or inspect the f_files and f_ffree handling for filesystems that report zero inode counts. Done means the background monitor no longer raises a division-by-zero error in that environment.

Written by the indexing model from the issue text.

Description

Search before asking
  • I had searched in the issues and found no similar issues.
Version

4.1 7126cf65d96ebc43fce0906f51e92c1a2ccf24a6 cloud version

What's Wrong?

In some environment, the inode statistics f_files/f_ffree are 0, which causes a BE division-by-zero error.

inode_total = stat.f_files = 0
inode_free = stat.f_ffree = 0

Thread 185 "run_background_" received signal SIGFPE, Arithmetic exception.
0x000055556bce32e8 in doris::io::disk_used_percentage (path=..., percent=0x7fff109ead50) at /home/chen/Programming/doris-4.1/be/src/io/cache/block_file_cache.cpp:1822
1822	    int inode_percentage = cast_set<int>(inode_free * 100 / inode_total);
(gdb) bt
#0  0x000055556bce32e8 in doris::io::disk_used_percentage (path=..., percent=0x7fff109ead50) at /home/chen/Programming/doris-4.1/be/src/io/cache/block_file_cache.cpp:1822
#1  0x000055556bce422a in doris::io::BlockFileCache::check_disk_resource_limit (this=0x7fff151c6000) at /home/chen/Programming/doris-4.1/be/src/io/cache/block_file_cache.cpp:1901
#2  0x000055556bce564d in doris::io::BlockFileCache::run_background_monitor (this=0x7fff151c6000) at /home/chen/Programming/doris-4.1/be/src/io/cache/block_file_cache.cpp:1998
#3  0x000055556bd313c3 in std::__invoke_impl<void, void (doris::io::BlockFileCache::*)(), doris::io::BlockFileCache*> (
    __f=@0x7fff14da6ff0: (void (doris::io::BlockFileCache::*)(doris::io::BlockFileCache * const)) 0x55556bce54b4 <doris::io::BlockFileCache::run_background_monitor()>, __t=@0x7fff14da6fe8: 0x7fff151c6000)
    at /home/chen/Programming/doris-4.1/ldb_toolchain/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:76
#4  0x000055556bd31228 in std::__invoke<void (doris::io::BlockFileCache::*)(), doris::io::BlockFileCache*> (
    __fn=@0x7fff14da6ff0: (void (doris::io::BlockFileCache::*)(doris::io::BlockFileCache * const)) 0x55556bce54b4 <doris::io::BlockFileCache::run_background_monitor()>)
    at /home/chen/Programming/doris-4.1/ldb_toolchain/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/invoke.h:98
#5  0x000055556bd30a99 in std::thread::_Invoker<std::tuple<void (doris::io::BlockFileCache::*)(), doris::io::BlockFileCache*> >::_M_invoke<0ul, 1ul> (this=0x7fff14da6fe8)
    at /home/chen/Programming/doris-4.1/ldb_toolchain/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_thread.h:303
#6  0x000055556bd3078c in std::thread::_Invoker<std::tuple<void (doris::io::BlockFileCache::*)(), doris::io::BlockFileCache*> >::operator() (this=0x7fff14da6fe8)
    at /home/chen/Programming/doris-4.1/ldb_toolchain/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_thread.h:310
#7  0x000055556bd30222 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (doris::io::BlockFileCache::*)(), doris::io::BlockFileCache*> > >::_M_run (this=0x7fff14da6fe0)
    at /home/chen/Programming/doris-4.1/ldb_toolchain/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/std_thread.h:255
#8  0x000055557c6bc014 in execute_native_thread_routine ()
#9  0x00007ffff6962d19 in start_thread () from /lib64/libc.so.6
#10 0x00007ffff69e664c in __clone3 () from /lib64/libc.so.6
(gdb) p stat
$5 = {f_type = 2435016766, f_bsize = 4096, f_blocks = 124348672, f_bfree = 83618897, f_bavail = 83530293, f_files = 0, f_ffree = 0, f_fsid = {__val = {-1491911987, -353343286}}, f_namelen = 255, f_frsize = 4096, 
  f_flags = 4128, f_spare = {0, 0, 0, 0}}
(gdb) p inode_free
$6 = 0
(gdb) p inode_total
$7 = 0

file system infos:

$ df -T /home/chen/Programming/doris-4.1/output/be/file_cache
文件系统       类型     1K的块      已用      可用 已用% 挂载点
/dev/nvme0n1p3 btrfs 497394688 163018220 334023188   33% /home
What You Expected?

not coredump

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Code of Conduct
Dominant language
Java
Stars
16k
Forks
4k
Avg merge
1d 23h
Merged PRs (30d)
637

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/doris

All issues in apache/doris

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.