Skip to content

Race condition in drop_privilege_test.go #2099

Open
@bbockelm

Description

@bbockelm

The xrootd/drop_privilege_test.go tests have a race condition. I think what's meant to happen is:

  1. Main thread sends a command
  2. Child thread receives command
  3. Main thread closes socket pair

However, there's no synchronization between steps (2) and (3). The main thread is free to exit and fire its defer function before the goroutine in (2) tries to read from its socket. I observed this race condition at least once in the GitHub Actions although it seems to not be particularly prevalent currently.

In general, it doesn't look like this test really tests all that much -- it kinda looks half-written to me:

  • It prepares a new CA bundle but doesn't seem to check anything about it.
  • It has code paths for both cache and origin testing but only the origin code paths are reachable.
  • It has a function named receiveFD which suggests it is receiving a file descriptor (the point of one of the drop privilege commands). However, there's no receiving of file descriptors in the code!

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinginternalInternal code improvements, not user-facingtestImprovements to the test suite

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions