namhyung/uftrace

WARN: Cannot open record data: uftrace_524528: No such file or directory?

Closed this issue · 6 comments

$ uftrace --version                                                                                                                                                        130
uftrace v0.16-13-gc546 ( x86_64 dwarf python3 luajit tui perf sched dynamic kernel )

In C++11, I executed the following command through client_server:

uftrace record --data=uftrace_524528 --time client_executer # uftrace_(\d) 

client_executer has generated mcount:

$ readelf -s client_executer | grep mco
   182: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND mcount@GLIBC_2.2.5 (3)
 17569: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND mcount@@GLIBC_2.2.5

Then, the following directories were generated in the client_server directory:

drwxr-xr-x 2 root root      4096 Aug 20 10:37 uftrace_524528
drwxr-xr-x 2 root root      4096 Aug 20 10:38 uftrace_524529
drwxr-xr-x 2 root root      4096 Aug 20 10:38 uftrace_524530

I want to view information through uftrace or analyze data but cannot find the path:

uftrace info -d uftrace_524528   
WARN: cannot open record data: uftrace_524528: No such file or directory

Trying the absolute path also prompts the same:

uftrace info -d $PWD/uftrace_524528   
WARN: cannot open record data: /data/home/app/client_server/bin/uftrace_524528: No such file or directory

However, this directory truly exists:

ls /data/home/app/client_server/bin/uftrace_524528

total 437M
-rw-r--r-- 1 root root 435M Aug 20 10:47 2206632.dat
-rw-rw-rw- 1 root root    0 Aug 20 10:37 default.opts
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu0.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu10.dat
-rw-rw-rw- 1 root root  40K Aug 20 10:42 perf-cpu11.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:46 perf-cpu12.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:46 perf-cpu13.dat
-rw-rw-rw- 1 root root  88K Aug 20 10:47 perf-cpu14.dat
-rw-rw-rw- 1 root root  48K Aug 20 10:43 perf-cpu15.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu16.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu17.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu18.dat
-rw-rw-rw- 1 root root  64K Aug 20 10:45 perf-cpu19.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu1.dat
-rw-rw-rw- 1 root root  72K Aug 20 10:46 perf-cpu20.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:46 perf-cpu21.dat
-rw-rw-rw- 1 root root  72K Aug 20 10:46 perf-cpu22.dat
-rw-rw-rw- 1 root root  64K Aug 20 10:45 perf-cpu23.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu24.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu25.dat
-rw-rw-rw- 1 root root  88K Aug 20 10:47 perf-cpu26.dat
-rw-rw-rw- 1 root root  40K Aug 20 10:42 perf-cpu27.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:46 perf-cpu28.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu29.dat
-rw-rw-rw- 1 root root  88K Aug 20 10:47 perf-cpu2.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu30.dat
-rw-rw-rw- 1 root root  56K Aug 20 10:44 perf-cpu31.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu3.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu4.dat
-rw-rw-rw- 1 root root  72K Aug 20 10:47 perf-cpu5.dat
-rw-rw-rw- 1 root root  72K Aug 20 10:47 perf-cpu6.dat
-rw-rw-rw- 1 root root  48K Aug 20 10:43 perf-cpu7.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu8.dat
-rw-rw-rw- 1 root root  80K Aug 20 10:47 perf-cpu9.dat
-rw-rw-rw- 1 root root 2.5K Aug 20 10:37 sid-8291393f2d0d1620.map
-rw-rw-rw- 1 root root 245K Aug 20 10:38 task.txt
sequenceDiagram
    participant client_server
    participant client_executer
    participant uftrace

    client_server->>client_executer: creates
    client_executer->>uftrace: monitored by uftrace --time --data uftrace_*
    uftrace->>uftrace: generates uftrace_* directory
Loading

Strange.. uftrace data directories should have info file in them and that's the first file uftrace opens. Have you finished your target program properly?

@namhyung Yes,and there are files in this directory, do I need to upload the file content? Is there any debugging path?

1.2G    uftrace_524528
1.2G    uftrace_524529
1.2G    uftrace_524530
uftrace info -vv -d $PWD/uftrace_524528
uftrace: cannot open uftrace_524528/info file
WARN: cannot open record data: uftrace_524528: No such file or directory

(END)

My program is launched through client_server (a daemon), and then client_executer (which is also a daemon and started via command line) is initiated. I'm not sure if this call path has an impact, but it actually generated a uftrace_(\d) folder. However, strangely, the command prompt indicates that it cannot find the folder.

uftrace/utils/data-file.c

Lines 371 to 391 in 7e07a43

if (!strcmp(opts->dirname, UFTRACE_DIR_NAME)) {
/* try again inside the current directory */
fp = fopen("./info", "rb");
if (fp != NULL) {
opts->dirname = "./";
goto ok;
}
/* retry with old default dirname */
snprintf(buf, sizeof(buf), "%s/info", UFTRACE_DIR_OLD_NAME);
fp = fopen(buf, "rb");
if (fp != NULL) {
opts->dirname = UFTRACE_DIR_OLD_NAME;
goto ok;
}
saved_errno = errno;
/* restore original file name for error reporting */
snprintf(buf, sizeof(buf), "%s/info", opts->dirname);
}

It looks like it seems to have failed to generate the file info.

pr_dbg("cannot open %s file\n", buf);

When I uftrace record, I add some logs for reference, but the trouble is that it's not very convenient for me to see the supplemented logs.

Strange.. uftrace data directories should have info file in them and that's the first file uftrace opens. Have you finished your target program properly?

soga~ It looks like what caused it not to be generated? Or was it deleted without reason?

I'm really sorry, I think it must be my usage error, perhaps I don't understand uftrace well enough. I found that after I killed the program with kill -15 $(uftrace exec), I was able to fully generate uftrace/info.

No problem! Glad to see it works and thanks for the report! :)