Skip to content

Add sync.once for Init()#9

Open
0xLeo258 wants to merge 1 commit into
masterfrom
leo
Open

Add sync.once for Init()#9
0xLeo258 wants to merge 1 commit into
masterfrom
leo

Conversation

@0xLeo258
Copy link
Copy Markdown
Collaborator

@0xLeo258 0xLeo258 commented Sep 9, 2025

After deploying Velero 1.16 in our OpenStack clusters with item-block-worker-count=5, the plugin panicked when taking a batch of volume snapshots.

message: /Error getting volume snapshotter for volume snapshot location error: /rpc error: code = Aborted desc = plugin panicked: runtime error: invalid memory address or nil pointer dereference, stack trace: goroutine 90 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:26 +0x5e github.com/vmware-tanzu/velero/pkg/plugin/framework/common.HandlePanic({0x147b1e0?, 0x2380950}) /go/pkg/mod/github.com/vmware-tanzu/velero@v1.11.1/pkg/plugin/framework/common/handle_panic.go:43 +0x13b github.com/vmware-tanzu/velero/pkg/plugin/framework.(*VolumeSnapshotterGRPCServer).Init.func1() /go/pkg/mod/github.com/vmware-tanzu/velero@v1.11.1/pkg/plugin/framework/volume_snapshotter_server.go:56 +0x2a panic({0x147b1e0?, 0x2380950?}) /usr/local/go/src/runtime/panic.go:792 +0x132

What did you expect to happen:
The Init() function of plugin should be called only once per process.

**Fix Implementation **:
This appears to be a race condition where the volume snapshot plugin's Init() function is called concurrently. I add a sync.once to protect the Init() function in this plugin repo and it works fine.

@0xLeo258 0xLeo258 self-assigned this Sep 9, 2025
@0xLeo258 0xLeo258 added the bug Something isn't working label Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant