fio icon indicating copy to clipboard operation
fio copied to clipboard

segfault if set --idle-prof=percpu with --status-interval

Open vasilymtn opened this issue 7 months ago • 1 comments

Description of the bug: Hi, if I want to track the processor idle time with an interval, then I get a segfault The error is related to the call to fio_idle_prof_cleanup in stat.c, which does free for ipc.ipts from idletime.c, and the new malloc is not called on the next interval For myself, I found a way to solve this, but I did not come up with a short good solution

root@ubuntu:~/fio$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.1 LTS Release: 24.04 Codename: noble

root@ubuntu:~/fio$ ./fio --version fio-3.40

Reproduction steps fio --name=tmp --ioengine=cpuio --cpuload=10 --cpumode=qsort --runtime=10 --idle-prof=percpu --status-interval=1

vasilymtn avatar Jun 02 '25 10:06 vasilymtn

The above reproduces for me with the following:

fio --thread --name=tmp --ioengine=cpuio --cpuload=10 --runtime=10 --idle-prof=system --status-interval=1

Here's the gdb debugging:

Thread 12 "fio" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xffffea7f80c0 (LWP 10761)]
0x0000aaaaaab4eab8 in fio_idle_prof_cpu_stat (cpu=-1) at idletime.c:401
401				p += ipt->idleness;
(gdb) info locals 
i = 0
nr_cpus = 10
ipt = 0x0
p = 0
(gdb) info args
cpu = -1
(gdb) thread apply all bt

Thread 23 (Thread 0xffffe97d80c0 (LWP 10772) "fio"):
#0  get_cpu_clock () at arch/arch-aarch64.h:39
#1  0x0000aaaaaaad4228 in __fio_gettime (tp=0xffffe97d7518) at gettime.c:191
#2  0x0000aaaaaaad4440 in fio_gettime (tp=0xffffe97d7518, caller=0x0) at gettime.c:234
#3  0x0000aaaaaaad4f80 in utime_since_now (s=0xffffe97d7558) at gettime.c:488
#4  0x0000aaaaaaaf16ac in usec_spin (usec=50000) at time.c:35
#5  0x0000aaaaaab1eab0 in fio_cpuio_queue (td=0xffffef089000, io_u=0xaaaaab750000) at engines/cpu.c:188
#6  0x0000aaaaaaad7620 in td_io_queue (td=0xffffef089000, io_u=0xaaaaab750000) at ioengines.c:388
#7  0x0000aaaaaab40554 in io_u_submit (td=0xffffef089000, io_u=0xaaaaab750000) at backend.c:604
#8  0x0000aaaaaab41c40 in do_io (td=0xffffef089000, bytes_done=0xffffe97d77d0) at backend.c:1134
#9  0x0000aaaaaab45568 in thread_main (data=0xaaaaab5320c0) at backend.c:1954
#10 0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#11 0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 22 (Thread 0xffffe9fe80c0 (LWP 10771) "fio"):
#0  idle_prof_thread_fn (data=0xaaaaab74cc60) at idletime.c:143
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 21 (Thread 0xffffec8380c0 (LWP 10770) "fio"):
#0  idle_prof_thread_fn (data=0xaaaaab74cb00) at idletime.c:143
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 20 (Thread 0xffffed0480c0 (LWP 10769) "fio"):
#0  0x0000aaaaaab4dfa0 in idle_prof_thread_fn (data=0xaaaaab74c9a0) at idletime.c:141
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 19 (Thread 0xffffed8580c0 (LWP 10768) "fio"):
#0  0x0000aaaaaab4dfb8 in idle_prof_thread_fn (data=0xaaaaab74c840) at idletime.c:141
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 18 (Thread 0xffffee0680c0 (LWP 10767) "fio"):
#0  0x0000aaaaaab4dfa4 in idle_prof_thread_fn (data=0xaaaaab74c6e0) at idletime.c:141
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 17 (Thread 0xffffee8780c0 (LWP 10766) "fio"):
#0  idle_prof_thread_fn (data=0xaaaaab74c580) at idletime.c:143
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 16 (Thread 0xffffef0880c0 (LWP 10765) "fio"):
#0  idle_prof_thread_fn (data=0xaaaaab74c420) at idletime.c:143
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 15 (Thread 0xffffec0280c0 (LWP 10764) "fio"):
#0  idle_prof_thread_fn (data=0xaaaaab74c2c0) at idletime.c:142
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 14 (Thread 0xffffeb8180c0 (LWP 10763) "fio"):
#0  idle_prof_thread_fn (data=0xaaaaab74c160) at idletime.c:143
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 13 (Thread 0xffffeb0080c0 (LWP 10762) "fio"):
#0  idle_prof_thread_fn (data=0xaaaaab74c000) at idletime.c:143
#1  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#2  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 12 (Thread 0xffffea7f80c0 (LWP 10761) "fio"):
#0  0x0000aaaaaab4eab8 in fio_idle_prof_cpu_stat (cpu=-1) at idletime.c:401
#1  0x0000aaaaaab4edc8 in show_idle_prof_stats (output=4, parent=0x0, out=0xffffea7f7608) at idletime.c:472
#2  0x0000aaaaaaaedcac in __show_run_stats () at stat.c:2730
#3  0x0000aaaaaaaee0e4 in __show_running_run_stats () at stat.c:2793
#4  0x0000aaaaaab545d0 in eval_timer (it=0xffffea7f77a8, now=0xffffea7f7770, msec_to_next_event=0xffffea7f7748) at helper_thread.c:270
#5  0x0000aaaaaab54894 in helper_thread_main (data=0xfffff66552f0) at helper_thread.c:338
--Type <RET> for more, q to quit, c to continue without paging--
#6  0x0000fffff7a9595c in start_thread (arg=0xfffff7ff2580) at ./nptl/pthread_create.c:447
#7  0x0000fffff7afba4c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone3.S:76

Thread 1 (Thread 0xfffff7ff1e40 (LWP 10749) "fio"):
#0  0x0000fffff7acbed0 in __GI___clock_nanosleep (clock_id=<optimized out>, clock_id@entry=0, flags=flags@entry=0, req=req@entry=0xffffffff6e28, rem=rem@entry=0x0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
#1  0x0000fffff7ad61fc in __GI___nanosleep (req=req@entry=0xffffffff6e28, rem=rem@entry=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:25
#2  0x0000fffff7afb4a8 in usleep (useconds=<optimized out>) at ../sysdeps/posix/usleep.c:31
#3  0x0000aaaaaab46774 in do_usleep (usecs=10000) at backend.c:2321
#4  0x0000aaaaaab475ec in run_threads (sk_out=0x0) at backend.c:2644
#5  0x0000aaaaaab4787c in fio_backend (sk_out=0x0) at backend.c:2700
#6  0x0000aaaaaaabdb84 in main (argc=8, argv=0xfffffffff158, envp=<optimized out>) at fio.c:58

If --status-interval=1 is left off then the problem doesn't occur.

sitsofe avatar Jul 23 '25 15:07 sitsofe