envoyproxy / envoyproxy/envoy

LinkCreatesNamedFile test failure

Open
#23,821 9 comments 0 reactions 1 assignee Claimed by @ravenblackx View on GitHub
area/test flakes bug no stalebot
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

This test is consistently failing in my environment: https://github.com/envoyproxy/envoy/blob/35bf11a0f14a996d4e95b5302b0a953e0beba9f6/test/extensions/common/async_files/async_file_handle_thread_pool_test.cc#L140

Here's my attempt to explain why:

The function `manager_->createAnonymousFile()` relies on the underlying filesystem supporting the `O_TMPFILE` flag: https://github.com/envoyproxy/envoy/blob/35bf11a0f14a996d4e95b5302b0a953e0beba9f6/source/extensions/common/async_files/async_file_manager_thread_pool.cc#L135

The fallback code (a few lines below) creates a file and deletes it, without closing it, returning its file descriptor. I'm reaching this fallback code, because my filesystem doesn't support the `O_TMPFILE` flag.

The problem happens when a hard link is created later with `linkat()`: https://github.com/envoyproxy/envoy/blob/35bf11a0f14a996d4e95b5302b0a953e0beba9f6/source/extensions/common/async_files/async_file_context_thread_pool.cc#L49

It fails with ENOENT, as stated in the manual page:
```
ENOENT An attempt was made to link to a /proc/self/fd/NN file
corresponding to a file that has been deleted.
```
As seen here: https://man7.org/linux/man-pages/man2/link.2.html

cc @ravenblackx

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.