Skip to content

Performance: Redundant syscalls triggered by context.IsSet #2282

@lifubang

Description

@lifubang

My urfave/cli version is

v1.22.17

Checklist

  • [Y] Are you running the latest v1 release? The list of releases is here.
  • [Y] Did you check the manual for your release? The v1 manual is here.
  • [Y] Did you perform a search about this problem? Here's the GitHub guide about searching.

Dependency Management

  • My project is using go modules.
  • My project is using vendoring.

Describe the bug

There are numerous unnecessary system calls in the strace output.

[pid 16713] newfstatat(AT_FDCWD, "",  <unfinished ...>
[pid 16714] nanosleep({tv_sec=0, tv_nsec=20000},  <unfinished ...>
[pid 16713] <... newfstatat resumed>0x40000a63f8, 0) = -1 ENOENT (No such file or directory)
[pid 16714] <... nanosleep resumed>NULL) = 0
[pid 16713] newfstatat(AT_FDCWD, "",  <unfinished ...>
[pid 16714] nanosleep({tv_sec=0, tv_nsec=20000},  <unfinished ...>
[pid 16713] <... newfstatat resumed>0x40000a64b8, 0) = -1 ENOENT (No such file or directory)
[pid 16713] newfstatat(AT_FDCWD, "", 0x40000a6578, 0) = -1 ENOENT (No such file or directory)
[pid 16714] <... nanosleep resumed>NULL) = 0
[pid 16713] newfstatat(AT_FDCWD, "",  <unfinished ...>
[pid 16714] nanosleep({tv_sec=0, tv_nsec=20000},  <unfinished ...>
[pid 16713] <... newfstatat resumed>0x40000a6638, 0) = -1 ENOENT (No such file or directory)
[pid 16714] <... nanosleep resumed>NULL) = 0
[pid 16713] newfstatat(AT_FDCWD, "",  <unfinished ...>
[pid 16714] epoll_pwait(4,  <unfinished ...>
[pid 16713] <... newfstatat resumed>0x40000a66f8, 0) = -1 ENOENT (No such file or directory)
[pid 16714] <... epoll_pwait resumed>[], 128, 0, NULL, 0) = 0
[pid 16713] newfstatat(AT_FDCWD, "", 0x40000a67b8, 0) = -1 ENOENT (No such file or directory)
[pid 16714] nanosleep({tv_sec=0, tv_nsec=20000},  <unfinished ...>
[pid 16713] newfstatat(AT_FDCWD, "",  <unfinished ...>
[pid 16714] <... nanosleep resumed>NULL) = 0
[pid 16713] <... newfstatat resumed>0x40000a6878, 0) = -1 ENOENT (No such file or directory)
[pid 16714] nanosleep({tv_sec=0, tv_nsec=20000},  <unfinished ...>
[pid 16713] newfstatat(AT_FDCWD, "",  <unfinished ...>
[pid 16714] <... nanosleep resumed>NULL) = 0
[pid 16713] <... newfstatat resumed>0x40000a6938, 0) = -1 ENOENT (No such file or directory)
[pid 16714] nanosleep({tv_sec=0, tv_nsec=20000},  <unfinished ...>
[pid 16713] newfstatat(AT_FDCWD, "", 0x40000a69f8, 0) = -1 ENOENT (No such file or directory)
[pid 16713] newfstatat(AT_FDCWD, "",  <unfinished ...>
[pid 16714] <... nanosleep resumed>NULL) = 0
[pid 16713] <... newfstatat resumed>0x40000a6ab8, 0) = -1 ENOENT (No such file or directory)

To reproduce

strace -f runc run test

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/v1relates to / is being considered for v1kind/bugdescribes or fixes a bugstatus/triagemaintainers still need to look into this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions