Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
minhbq opened this issue Mar 29, 2020 · 5 comments
Closed

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

minhbq opened this issue Mar 29, 2020 · 5 comments

Comments

@minhbq
Copy link

minhbq commented Mar 29, 2020

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
Copy link
Contributor

imz commented Jul 4, 2020

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.)

@minhbq
Copy link
Author

minhbq commented Oct 2, 2020

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.

@chrissie-c
Copy link
Contributor

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

@minhbq
Copy link
Author

minhbq commented Oct 2, 2020

it works well

@chrissie-c
Copy link
Contributor

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants