minio/internal
Klaus Post 4a6c97463f
Fix all racy use of NewDeadlineWorker (#18861)
AlmosAll uses of NewDeadlineWorker, which relied on secondary values, were used in a racy fashion,
which could lead to inconsistent errors/data being returned. It also propagates the deadline downstream.

Rewrite all these to use a generic WithDeadline caller that can return an error alongside a value.

Remove the stateful aspect of DeadlineWorker - it was racy if used - but it wasn't AFAICT.

Fixes races like:

```
WARNING: DATA RACE
Read at 0x00c130b29d10 by goroutine 470237:
  github.com/minio/minio/cmd.(*xlStorageDiskIDCheck).ReadVersion()
      github.com/minio/minio/cmd/xl-storage-disk-id-check.go:702 +0x611
  github.com/minio/minio/cmd.readFileInfo()
      github.com/minio/minio/cmd/erasure-metadata-utils.go:160 +0x122
  github.com/minio/minio/cmd.erasureObjects.getObjectFileInfo.func1.1()
      github.com/minio/minio/cmd/erasure-object.go:809 +0x27a
  github.com/minio/minio/cmd.erasureObjects.getObjectFileInfo.func1.2()
      github.com/minio/minio/cmd/erasure-object.go:828 +0x61

Previous write at 0x00c130b29d10 by goroutine 470298:
  github.com/minio/minio/cmd.(*xlStorageDiskIDCheck).ReadVersion.func1()
      github.com/minio/minio/cmd/xl-storage-disk-id-check.go:698 +0x244
  github.com/minio/minio/internal/ioutil.(*DeadlineWorker).Run.func1()
      github.com/minio/minio/internal/ioutil/ioutil.go:141 +0x33

WARNING: DATA RACE
Write at 0x00c0ba6e6c00 by goroutine 94507:
  github.com/minio/minio/cmd.(*xlStorageDiskIDCheck).StatVol.func1()
      github.com/minio/minio/cmd/xl-storage-disk-id-check.go:419 +0x104
  github.com/minio/minio/internal/ioutil.(*DeadlineWorker).Run.func1()
      github.com/minio/minio/internal/ioutil/ioutil.go:141 +0x33

Previous read at 0x00c0ba6e6c00 by goroutine 94463:
  github.com/minio/minio/cmd.(*xlStorageDiskIDCheck).StatVol()
      github.com/minio/minio/cmd/xl-storage-disk-id-check.go:422 +0x47e
  github.com/minio/minio/cmd.getBucketInfoLocal.func1()
      github.com/minio/minio/cmd/peer-s3-server.go:275 +0x122
  github.com/minio/pkg/v2/sync/errgroup.(*Group).Go.func1()
```

Probably back from #17701
2024-01-24 10:08:31 -08:00
..
amztime add codespell action (#18818) 2024-01-17 23:03:17 -08:00
arn Allow OpenID ARN resource ID to start with a `-` (#18255) 2023-10-16 13:50:51 -07:00
auth Add "name" and "description" params to service acc (#17172) 2023-05-17 17:05:36 -07:00
bpool allow pre-allocating buffers to reduce frequent GCs during growth (#18686) 2023-12-21 08:59:38 -08:00
bucket add codespell action (#18818) 2024-01-17 23:03:17 -08:00
color log: Do not interpret verbs in object names in console output (#16233) 2022-12-13 08:27:40 -08:00
config add codespell action (#18818) 2024-01-17 23:03:17 -08:00
crypto add codespell action (#18818) 2024-01-17 23:03:17 -08:00
deadlineconn add deadlineConnections on remoteTransport (#16010) 2022-11-05 11:09:21 -07:00
disk fix: linter errors in Windows specific code (#18276) 2023-10-18 11:08:15 -07:00
dsync add codespell action (#18818) 2024-01-17 23:03:17 -08:00
etag add codespell action (#18818) 2024-01-17 23:03:17 -08:00
event add codespell action (#18818) 2024-01-17 23:03:17 -08:00
fips disable builds for go1.18 (#16332) 2022-12-30 11:37:07 -08:00
grid Add extra protection for grid reconnects (#18840) 2024-01-22 09:39:06 -08:00
handlers send proper IPv6 names avoid bracketing notation (#18699) 2023-12-21 16:56:55 -08:00
hash add codespell action (#18818) 2024-01-17 23:03:17 -08:00
http add codespell action (#18818) 2024-01-17 23:03:17 -08:00
init force all internal MinIO operations to be under UTC (#16009) 2022-11-04 16:44:38 -07:00
ioutil Fix all racy use of NewDeadlineWorker (#18861) 2024-01-24 10:08:31 -08:00
jwt allow JWT parsing on large session policy based tokens (#17167) 2023-05-09 00:53:08 -07:00
kms Update to minio/pkg/v2 (#17967) 2023-09-04 12:57:37 -07:00
lock fix: linter errors in Windows specific code (#18276) 2023-10-18 11:08:15 -07:00
logger add codespell action (#18818) 2024-01-17 23:03:17 -08:00
lsync cleanup Go linter settings (#16736) 2023-03-04 20:57:35 -08:00
mcontext Add X-Amz-Request-Id to internode calls (#16146) 2022-12-06 09:27:26 -08:00
mountinfo add codespell action (#18818) 2024-01-17 23:03:17 -08:00
net fix: return error when requested interface has no stats available (#17666) 2023-07-17 01:14:01 -07:00
once Support persistent queue store for loggers (#17121) 2023-05-08 21:20:31 -07:00
pubsub add codespell action (#18818) 2024-01-17 23:03:17 -08:00
rest add codespell action (#18818) 2024-01-17 23:03:17 -08:00
s3select add codespell action (#18818) 2024-01-17 23:03:17 -08:00
store Send kafka notification messages in batches when queue_dir is enabled (#18164) 2023-10-07 08:07:38 -07:00