Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Resize fifo to 1024K #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Resize fifo to 1024K #55

wants to merge 1 commit into from

Conversation

kkkkun
Copy link

@kkkkun kkkkun commented Mar 20, 2024

The container which writes logs synchronously would be blocked in the following scenarios:

  1. Container writes logs synchronously to stdout or stderr .
  2. Upgrade containerd and speed a lot of time.

So it is important to resize fifo in container runtime. After commit, the pipe_max_size had adjusted to 1024K.

@kkkkun kkkkun force-pushed the resize-fifo branch 6 times, most recently from 531a956 to 81d32d8 Compare March 22, 2024 09:52
@kkkkun
Copy link
Author

kkkkun commented Jul 17, 2024

/assign @thaJeztah

fifo.go Outdated
Comment on lines 45 to 49
const (
F_SETPIPE_SZ = 1031
)

const FIFO_SIZE = 1024 * 1024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub actions looks to have purged logs for the previous run, but I think the linter may have been complaining about this, and likely wants them to be combined;

const (
	F_SETPIPE_SZ = 1031
	FIFO_SIZE = 1024 * 1024
)

And as both are only used internally, it's better to not export them; perhaps use camelCase to make linters happy, but you can refer to the upstream counterpart for these, e.g.

// Sizes here match what's defined in the kernel; see https://github.com/torvalds/linux/commit/ff9da691c0498ff81fdd014e7a0731dab2337dac
const (
	fsetPipeSize = 1031        // F_SETPIPE_SZ
	fifoSize     = 1024 * 1024 // FIFO_SIZE
)

I'm also curios if these are consts that would make sense to be included in golang.org/x/sys - this PR is making changes assuming Linux, but the file is used for other unix-y platforms; would this be problematic for any of the other flavours (macOS, freeBSD)? /cc @samuelkarp

@kkkkun
Copy link
Author

kkkkun commented Jul 18, 2024

The failed tests seem not to be related to the change.

@thaJeztah
Copy link
Member

The failed tests seem not to be related to the change.

Hm.. interesting; linting failure I suspect is because of an old version of GolangCI-lint, which is not yet aware of the max builtin? Not sure why that only shows up now.

Running [/home/runner/golangci-lint-1.51.1-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=src/github.com/containerd/fifo] in [/home/runner/work/fifo/fifo/src/github.com/containerd/fifo] ...
  Error: undefined: max (typecheck)
  
  Error: issues found

Don't know about the other one (I'm not too familiar with all of this repository);

=== RUN   TestFifoCloseWhileReadingAndWriting
    fifo_test.go:450: 
        	Error Trace:	/home/runner/work/fifo/fifo/src/github.com/containerd/fifo/fifo_test.go:450
        	Error:      	An error is expected but got nil.
        	Test:       	TestFifoCloseWhileReadingAndWriting
    fifo_test.go:454: Read should not succeed
--- FAIL: TestFifoCloseWhileReadingAndWriting (0.50s)

@thaJeztah
Copy link
Member

Can you rebase your PR? #58 should have fixed the CI failures

@kkkkun kkkkun force-pushed the resize-fifo branch 8 times, most recently from 530c14d to 08074a4 Compare July 19, 2024 09:44
Signed-off-by: kkkkun <scuzk373x@gmail.com>
@kkkkun
Copy link
Author

kkkkun commented Jul 22, 2024

Can you rebase your PR? #58 should have fixed the CI failures

Done. I do not understand the failed test.

=== RUN   TestFifoCloseWhileReadingAndWriting
    fifo_test.go:450: 
        	Error Trace:	/home/runner/work/fifo/fifo/src/github.com/containerd/fifo/fifo_test.go:450
        	Error:      	An error is expected but got nil.
        	Test:       	TestFifoCloseWhileReadingAndWriting
    fifo_test.go:454: Read should not succeed
--- FAIL: TestFifoCloseWhileReadingAndWriting (0.50s)

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

Successfully merging this pull request may close these issues.

None yet

2 participants