Skip to content

Commit

Permalink
fix: avoid deadlock on context cancel
Browse files Browse the repository at this point in the history
As the worker exits on context cancel, make sure we stop distributing
tasks if the context is canceled.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Dec 25, 2024
1 parent 58f4f0f commit 0f784bd
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 81 deletions.
24 changes: 24 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"description": "THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.",
"prHeader": "Update Request | Renovate Bot",
"extends": [
":dependencyDashboard",
":gitSignOff",
":semanticCommitScopeDisabled",
"schedule:earlyMondays"
],
"packageRules": [
{
"groupName": "dependencies",
"matchUpdateTypes": [
"major",
"minor",
"patch",
"pin",
"digest"
]
}
],
"separateMajorMinor": false
}
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-08-12T12:50:05Z by kres 2ab5924.
# Generated on 2024-12-25T15:05:54Z by kres fcff05e.

name: default
concurrency:
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
run: |
make unit-tests-race
- name: coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
files: _out/coverage-unit-tests.txt
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/slack-notify.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-03-07T14:50:46Z by kres 9087155-dirty.
# Generated on 2024-12-25T15:05:54Z by kres fcff05e.

name: slack-notify
"on":
Expand All @@ -24,11 +24,12 @@ jobs:
run: |
echo pull_request_number=$(gh pr view -R ${{ github.repository }} ${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }} --json number --jq .number) >> $GITHUB_OUTPUT
- name: Slack Notify
uses: slackapi/slack-github-action@v1
uses: slackapi/slack-github-action@v2
with:
channel-id: proj-talos-maintainers
method: chat.postMessage
payload: |
{
"channel": "proj-talos-maintainers",
"attachments": [
{
"color": "${{ github.event.workflow_run.conclusion == 'success' && '#2EB886' || github.event.workflow_run.conclusion == 'failure' && '#A30002' || '#FFCC00' }}",
Expand Down Expand Up @@ -88,5 +89,4 @@ jobs:
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
token: ${{ secrets.SLACK_BOT_TOKEN }}
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-08-12T12:50:05Z by kres 2ab5924.
# Generated on 2024-12-25T15:05:54Z by kres fcff05e.

# options for analysis running
run:
Expand Down Expand Up @@ -116,7 +116,6 @@ linters:
- gochecknoglobals
- gochecknoinits
- godox
- gomnd
- gomoddirectives
- gosec
- inamedparam
Expand All @@ -135,6 +134,7 @@ linters:
- perfsprint # complains about us using fmt.Sprintf in non-performance critical code, updating just kres took too long
- goimports # same as gci
- musttag # seems to be broken - goes into imported libraries and reports issues there
- exportloopref # WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.

issues:
exclude: [ ]
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# syntax = docker/dockerfile-upstream:1.9.0-labs
# syntax = docker/dockerfile-upstream:1.12.1-labs

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-08-12T12:50:05Z by kres 2ab5924.
# Generated on 2024-12-25T15:05:54Z by kres fcff05e.

ARG TOOLCHAIN

# cleaned up specs and compiled versions
FROM scratch AS generate

# runs markdownlint
FROM docker.io/oven/bun:1.1.22-alpine AS lint-markdown
FROM docker.io/oven/bun:1.1.40-alpine AS lint-markdown
WORKDIR /src
RUN bun i markdownlint-cli@0.41.0 sentences-per-line@0.2.1
RUN bun i markdownlint-cli@0.43.0 sentences-per-line@0.3.0
COPY .markdownlint.json .
COPY ./README.md ./README.md
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules sentences-per-line .

# base toolchain image
FROM --platform=${BUILDPLATFORM} ${TOOLCHAIN} AS toolchain
Expand Down
27 changes: 19 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-08-12T12:50:05Z by kres 2ab5924.
# Generated on 2024-12-25T15:05:54Z by kres fcff05e.

# common variables

Expand All @@ -17,15 +17,15 @@ WITH_RACE ?= false
REGISTRY ?= ghcr.io
USERNAME ?= siderolabs
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
PROTOBUF_GO_VERSION ?= 1.34.2
PROTOBUF_GO_VERSION ?= 1.36.0
GRPC_GO_VERSION ?= 1.5.1
GRPC_GATEWAY_VERSION ?= 2.21.0
GRPC_GATEWAY_VERSION ?= 2.24.0
VTPROTOBUF_VERSION ?= 0.6.0
GOIMPORTS_VERSION ?= 0.24.0
GOIMPORTS_VERSION ?= 0.28.0
DEEPCOPY_VERSION ?= v0.5.6
GOLANGCILINT_VERSION ?= v1.59.1
GOFUMPT_VERSION ?= v0.6.0
GO_VERSION ?= 1.22.6
GOLANGCILINT_VERSION ?= v1.62.2
GOFUMPT_VERSION ?= v0.7.0
GO_VERSION ?= 1.23.4
GO_BUILDFLAGS ?=
GO_LDFLAGS ?=
CGO_ENABLED ?= 0
Expand All @@ -41,11 +41,13 @@ PLATFORM ?= linux/amd64
PROGRESS ?= auto
PUSH ?= false
CI_ARGS ?=
BUILDKIT_MULTI_PLATFORM ?= 1
COMMON_ARGS = --file=Dockerfile
COMMON_ARGS += --provenance=false
COMMON_ARGS += --progress=$(PROGRESS)
COMMON_ARGS += --platform=$(PLATFORM)
COMMON_ARGS += --push=$(PUSH)
COMMON_ARGS += --build-arg=BUILDKIT_MULTI_PLATFORM=$(BUILDKIT_MULTI_PLATFORM)
COMMON_ARGS += --build-arg=ARTIFACTS="$(ARTIFACTS)"
COMMON_ARGS += --build-arg=SHA="$(SHA)"
COMMON_ARGS += --build-arg=TAG="$(TAG)"
Expand All @@ -67,7 +69,7 @@ COMMON_ARGS += --build-arg=DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)"
TOOLCHAIN ?= docker.io/golang:1.22-alpine
TOOLCHAIN ?= docker.io/golang:1.23-alpine

# help menu

Expand Down Expand Up @@ -145,6 +147,15 @@ target-%: ## Builds the specified target defined in the Dockerfile. The build r

local-%: ## Builds the specified target defined in the Dockerfile using the local output type. The build result will be output to the specified local destination.
@$(MAKE) target-$* TARGET_ARGS="--output=type=local,dest=$(DEST) $(TARGET_ARGS)"
@PLATFORM=$(PLATFORM) DEST=$(DEST) bash -c '\
for platform in $$(tr "," "\n" <<< "$$PLATFORM"); do \
echo $$platform; \
directory="$${platform//\//_}"; \
if [[ -d "$$DEST/$$directory" ]]; then \
mv -f "$$DEST/$$directory/"* $$DEST; \
rmdir "$$DEST/$$directory/"; \
fi; \
done'

lint-golangci-lint: ## Runs golangci-lint linter.
@$(MAKE) target-$@
Expand Down
36 changes: 18 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
module github.com/siderolabs/go-talos-support

go 1.22.6
go 1.22.7

require (
github.com/cosi-project/runtime v0.5.5
github.com/dustin/go-humanize v1.0.1
github.com/siderolabs/gen v0.5.0
github.com/siderolabs/talos/pkg/machinery v1.8.0-alpha.1
github.com/siderolabs/talos/pkg/machinery v1.8.0
github.com/stretchr/testify v1.9.0
golang.org/x/sync v0.8.0
google.golang.org/grpc v1.65.0
google.golang.org/grpc v1.66.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.30.3
)

require (
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.5.0.20240827111422-b5837fa4476e // indirect
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
github.com/ProtonMail/gopenpgp/v2 v2.7.5 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/adrg/xdg v0.5.0 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/containerd/go-cni v1.1.10 // indirect
github.com/containernetworking/cni v1.2.2 // indirect
github.com/containernetworking/cni v1.2.3 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/dot v1.6.2 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
Expand All @@ -37,7 +37,7 @@ require (
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -49,23 +49,23 @@ require (
github.com/opencontainers/runtime-spec v1.2.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.0 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/siderolabs/crypto v0.4.4 // indirect
github.com/siderolabs/go-api-signature v0.3.3 // indirect
github.com/siderolabs/go-api-signature v0.3.6 // indirect
github.com/siderolabs/go-pointer v1.0.0 // indirect
github.com/siderolabs/protoenc v0.2.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/api v0.30.3 // indirect
Expand Down
Loading

0 comments on commit 0f784bd

Please sign in to comment.