Skip to content

Conversation

@rabbitstack
Copy link

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area plugins

/area registry

/area build

/area documentation

What this PR does / why we need it:

Which issue(s) this PR fixes:

If the specific container engine worker fails during initialization, the error is silently skipped, making it hard to troubleshoot the real problem. Instead, accumulate and bubble up all the errors to the async handler.

Special notes for your reviewer:

@poiana poiana added the size/M label Oct 13, 2025
@rabbitstack rabbitstack force-pushed the container-plugin-engine-initialization-error-handling branch from e56b8e9 to c7c0968 Compare October 13, 2025 13:06
@poiana poiana added size/XS and removed size/M labels Oct 13, 2025
@github-actions
Copy link

Rules files suggestions

@poiana
Copy link
Contributor

poiana commented Oct 13, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rabbitstack
Once this PR has been reviewed and has the lgtm label, please assign ekoops for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@poiana
Copy link
Contributor

poiana commented Oct 13, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rabbitstack
Once this PR has been reviewed and has the lgtm label, please assign ekoops for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

If the specific container engine worker fails
during initialization, the error is silently
skipped making it hard to troubleshoot the real problem. i
Instead, accumulate and bubble up all the errors to the async handler.

Signed-off-by: rabbitstack <[email protected]>
@rabbitstack rabbitstack force-pushed the container-plugin-engine-initialization-error-handling branch from 46c632c to 76943d2 Compare October 13, 2025 13:11
@github-actions
Copy link

Rules files suggestions

Comment on lines +73 to 78
errmsg := C.CString("")
ptr := StartWorker((*[0]byte)(C.echo_cb), cstr, &enabledSocks, &errmsg)
if ptr == nil {
fmt.Println("Failed to start worker; nothing configured?")
fmt.Println(fmt.Sprintf("Failed to start worker; nothing configured? %s", C.GoString(errmsg)))
os.Exit(1)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet introduces a memory leak, because C.Cstring("") allocates a C string on the heap, and the Go runtime will not garbage-collect it. We should add a call to defer C.free(...). but in order to be sure that this is called just after StartWorker(...) invocation, and regardless the fact that this function could panic, I would add a new wrapping function like the following:

func startWorker(...) unsafe.Pointer {
  errmsg := C.CString("")
  defer C.free(unsafe.Pointer(errmsg))
  return StartWorker((*[0]byte)(C.echo_cb), cstr, &enabledSocks, &errmsg)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants