ClusterLabs/libqb

Error ftruncate (in unix.c[111]) when build and run libqb with WSL

minhbq opened this issue · 5 comments

I believe that libqb have this problem that is similar to issue here microsoft/WSL#902

ftruncate function doesn't execute standard on WSL like native Linux.

imz commented

Could you provide a backtrace? It would be interesting to see if it is really an ftruncate on a file already mmap'd.

Or the reason of a crash (SIGBUS) might be different, for example, as hypothesized by @wladmis and me in #409: simply not enough FS space was allocated by qb_sys_mmap_file_open.

Perhaps you could even test your case with our patch. What if it helps?.. (Although I'm sure how correctly posix_fallocate would work in WSL.)

This one:

unix.c row 114
if (ftruncate(fd, bytes) == -1) {
res = -errno;
qb_util_perror(LOG_ERR, "couldn't truncate file %s", path);
goto unlink_exit;
}

It doesn't crash, it only encounters an error with ftruncate function.
it always returns -1 and can't create ipc server successfully.
When i ignore this code, it works.

Only error on WSL.

The patch in PR #424 is pretty straightforward but I can't test it myself. Can you try it please?

it works well

Thanks for checking. The patch is now included in the source.