Skip to content

fix: nil pointer panic in AWS ALB provider crashes process#743

Merged
ehsandeep merged 8 commits intodevfrom
fix/alb-nil-pointer-panic
Apr 3, 2026
Merged

fix: nil pointer panic in AWS ALB provider crashes process#743
ehsandeep merged 8 commits intodevfrom
fix/alb-nil-pointer-panic

Conversation

@knakul853
Copy link
Copy Markdown
Contributor

@knakul853 knakul853 commented Apr 2, 2026

Summary

  • Fix nil pointer dereference in ALB provider (alb.go:66) that crashes the entire process when lb.DNSName is nil
  • Fix same pattern in Classic ELB provider (elb.go:66)
  • Add panic recovery to worker() function and all 10 AWS provider goroutines — a panic in any nested goroutine no longer kills the process

Root Cause

Group1001 customer (user 349180) had ~55 cloud discoveries stuck in queued state for months. Investigation traced to:

  1. alb.go:66*lb.DNSName dereferences nil for internal/failed ALBs
  2. This panics inside a goroutine spawned by GetResource (line 42)
  3. No panic recovery exists → crashes the entire Aurora pod
  4. Pod restarts → scheduling goroutine dies → enumeration status stays queued permanently

Prod crash log:

panic: runtime error: invalid memory address or nil pointer dereference
goroutine 4511917 [running]:
cloudlist/pkg/providers/aws.(*elbV2Provider).listELBV2Resources(...)
    alb.go:66

Changes

  1. alb.go — nil check for lb.DNSName, lb.LoadBalancerName, target.Target.Id
  2. elb.go — nil check for lb.DNSName, lb.LoadBalancerName, instance.InstanceId
  3. aws.go — panic recovery in worker() function (returns error instead of crashing)
  4. All 10 provider filesdefer recover() in every GetResource goroutine
  5. Tests: alb_test.go, elb_test.go, recovery_test.go — 9 tests covering nil safety and panic recovery

Test plan

  • go test ./pkg/providers/aws/ -v — 9/9 pass
  • go build ./pkg/providers/aws/ — clean
  • Verify with Group1001 customer config after merge

Summary by CodeRabbit

  • Bug Fixes

    • Added panic recovery across multiple AWS providers to prevent crashes and return aggregated errors when workers fail.
    • Improved null-safety when processing load balancers, targets and instances to skip invalid entries and avoid panics.
  • Tests

    • Added unit tests covering panic recovery and null-safety behaviors.
  • Chores

    • Updated ignore rules to exclude a new docs directory.

lb.DNSName and target.Target.Id can be nil for internal/failed ALBs.
Dereferencing without check at alb.go:66 panics in a nested goroutine,
crashing the entire Aurora pod and leaving enumerations stuck in queued.

Confirmed via prod crash log: goroutine 4511917 panicked in
listELBV2Resources at alb.go:66 for Group1001 customer (user 349180).
Same pattern as ALB — lb.DNSName and instance.InstanceId can be nil.
A panic in any nested goroutine (e.g., nil pointer from unexpected AWS
API response) crashes the entire process. Add defer/recover to worker()
and all GetResource goroutines so panics are logged but don't kill the
process.

Root cause of Group1001 incident: alb.go goroutine panicked, no
recovery existed, Aurora pod crashed, enumeration stuck in queued.
Remove [cloudlist-debug] prints from aws.go and instances.go,
clean up debug variables (workerCount, totalGoroutines) added
during Group1001 incident investigation.
Remove [cloudlist-debug] prints from aws.go and instances.go,
clean up debug variables (workerCount, totalGoroutines) added
during Group1001 incident investigation.
@neo-by-projectdiscovery-dev
Copy link
Copy Markdown

neo-by-projectdiscovery-dev bot commented Apr 2, 2026

Neo - PR Security Review

Caution

Review could not be completed

Task aborted before completion

Suggestion: Try again with @pdneo review.

Comment @pdneo help for available commands.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

Walkthrough

Adds panic-recovery around many AWS provider goroutines and the core worker, introduces nil-safety guards in ELB/ALB listing logic to avoid nil dereferences, adds unit tests for recovery and nil-handling, and updates .gitignore to ignore docs/superpowers/.

Changes

Cohort / File(s) Summary
Repo config
\.gitignore
Added docs/superpowers/ to ignore patterns.
Core worker & tests
pkg/providers/aws/aws.go, pkg/providers/aws/recovery_test.go
worker now recovers panics and returns formatted errors via results channel; tests added to verify panic recovery, normal returns, and error propagation.
ALB provider & tests
pkg/providers/aws/alb.go, pkg/providers/aws/alb_test.go
Per-worker goroutines now recover panics into a shared errs slice; listELBV2Resources defensively skips LBs/targets with nil DNSName, LoadBalancerName, or Target.Id; tests for nil and valid cases added.
ELB provider & tests
pkg/providers/aws/elb.go, pkg/providers/aws/elb_test.go
Per-worker goroutines recover panics into errs; listELBResources skips LBs/instances with nil DNSName, LoadBalancerName, or InstanceId; test coverage added.
EC2 instances provider
pkg/providers/aws/instances.go
Worker goroutines recover panics into shared errs; GetResource returns aggregated error when all workers fail and no items produced.
S3 provider
pkg/providers/aws/s3.go
Wrapped per-client goroutines with defer recover() and aggregated errs; returns aggregated error if all workers failed and no resources produced.
CloudFront provider
pkg/providers/aws/cloudfront.go
Added panic recovery per worker, collect errs, and conditional aggregated error when no resources.
ECS provider
pkg/providers/aws/ecs.go
Added per-worker panic recovery and shared errs; aggregated error when all workers fail and no resources.
EKS provider
pkg/providers/aws/eks.go
Added per-worker panic recovery and shared errs; aggregated error when all workers fail and no resources.
Lambda & API Gateway provider
pkg/providers/aws/lambda-api-gateway.go
Added per-worker panic recovery and shared errs; aggregated error when all workers fail and no resources.
Lightsail provider
pkg/providers/aws/lightsail.go
Added per-worker panic recovery and shared errs; aggregated error when all workers fail and no resources.
Route53 provider
pkg/providers/aws/route53.go
Added per-worker panic recovery and shared errs; aggregated error when all workers fail and no resources.

Sequence Diagram(s)

sequenceDiagram
    participant Coordinator as Coordinator
    participant WorkerFunc as worker()
    participant RegionGoroutine as Region Goroutine
    participant ResultsCh as Results Channel
    participant Aggregator as Aggregator / Merge

    Coordinator->>WorkerFunc: spawn worker per region/client
    WorkerFunc->>RegionGoroutine: invoke getResourcesFunc()
    Note right of RegionGoroutine: defer recover() installed
    alt getResourcesFunc panics
        RegionGoroutine-->>ResultsCh: send result{resources: nil, err: "panic..."}
    else success or error
        RegionGoroutine-->>ResultsCh: send result{resources:*, err:nil/err}
    end
    Aggregator->>ResultsCh: read results, merge successful resources, collect errs
    Aggregator->>Coordinator: return merged resources or aggregated "all workers failed" error
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through goroutines, soft and spry,
Defer caught panics before they could fly,
Nil noses checked with a careful sniff,
Tests clap their paws—no more abrupt cliff,
Safe concurrency, a carrot-filled sky.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main fix: addressing nil pointer panics in the AWS ALB provider that crash the process.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/alb-nil-pointer-panic

Comment @coderabbitai help to get the list of available commands and usage tips.

@neo-by-projectdiscovery-dev
Copy link
Copy Markdown

neo-by-projectdiscovery-dev bot commented Apr 2, 2026

Neo - PR Security Review

No security issues found

Comment @pdneo help for available commands. · Open in Neo

@knakul853 knakul853 requested review from ehsandeep and mkrs2404 April 2, 2026 18:45
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/providers/aws/elb.go (1)

93-95: ⚠️ Potential issue | 🟠 Major

Potential bug: checking wrong client variable.

Line 93 checks ep.elbClient == nil, but the goroutine uses ec2Client (passed as parameter) at line 102. This check should verify ec2Client instead, otherwise a nil ec2Client would cause a panic when ep.elbClient is non-nil.

Proposed fix
-		if ep.elbClient == nil {
+		if ec2Client == nil {
 			continue
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/providers/aws/elb.go` around lines 93 - 95, The nil-check is using
ep.elbClient but the goroutine uses the ec2Client parameter, so replace or
augment that check to verify ec2Client (and ideally both) before launching the
goroutine; update the conditional that currently references ep.elbClient to
check ec2Client != nil (or both ep.elbClient != nil && ec2Client != nil) to
prevent a nil ec2Client panic when the goroutine runs.
🧹 Nitpick comments (1)
pkg/providers/aws/recovery_test.go (1)

11-57: Good test coverage for worker panic recovery.

The tests appropriately cover the three key scenarios: panic recovery, normal operation, and error propagation. Consider adding t.Parallel() to each test for consistency with the ALB and ELB test files.

Optional: Add t.Parallel() for consistency
 func TestWorkerPanicRecovery(t *testing.T) {
+	t.Parallel()
 	results := make(chan result, 1)
 func TestWorkerNormalOperation(t *testing.T) {
+	t.Parallel()
 	results := make(chan result, 1)
 func TestWorkerErrorPropagation(t *testing.T) {
+	t.Parallel()
 	results := make(chan result, 1)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/providers/aws/recovery_test.go` around lines 11 - 57, Add t.Parallel() as
the first statement in each test function (TestWorkerPanicRecovery,
TestWorkerNormalOperation, TestWorkerErrorPropagation) so they run concurrently
like the ALB/ELB tests; insert t.Parallel() at the top of each test body right
after the function signature to enable parallel test execution and ensure
consistent test behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/providers/aws/aws.go`:
- Around line 438-440: The panic recovered in worker() is being sent back as
result.err but Provider.Resources() currently swallows non-nil errors (it does
`continue`) and returns nil, so callers never see worker panics; update
Provider.Resources() to handle result.err by returning the error (or aggregating
errors) instead of continuing—e.g., when reading from the channel in
Provider.Resources(), if res.err != nil then return nil, res.err (or append to
an error slice and return a combined error) so panic-derived errors from
worker() are propagated to callers.

In `@pkg/providers/aws/instances.go`:
- Around line 42-46: The local defer with recover() inside GetResource()
swallows child-goroutine panics and still returns nil, causing partial
successes; change it so panics are propagated or translated into returned
errors: remove the local defer that calls recover() in GetResource() (or replace
it with a panic-to-error handler that sends the recovered value into an error
channel), ensure goroutine workers report errors into a shared errs channel (or
set a named error return), wait for all goroutines to finish, and if any
panic/error was received return a non-nil error from GetResource() instead of
nil; apply the same pattern for the other providers (s3.go, route53.go,
lightsail.go, lambda-api-gateway.go, elb.go, eks.go, ecs.go, cloudfront.go,
alb.go) so the worker-level recovery in pkg/providers/aws/aws.go can handle
panics consistently.

---

Outside diff comments:
In `@pkg/providers/aws/elb.go`:
- Around line 93-95: The nil-check is using ep.elbClient but the goroutine uses
the ec2Client parameter, so replace or augment that check to verify ec2Client
(and ideally both) before launching the goroutine; update the conditional that
currently references ep.elbClient to check ec2Client != nil (or both
ep.elbClient != nil && ec2Client != nil) to prevent a nil ec2Client panic when
the goroutine runs.

---

Nitpick comments:
In `@pkg/providers/aws/recovery_test.go`:
- Around line 11-57: Add t.Parallel() as the first statement in each test
function (TestWorkerPanicRecovery, TestWorkerNormalOperation,
TestWorkerErrorPropagation) so they run concurrently like the ALB/ELB tests;
insert t.Parallel() at the top of each test body right after the function
signature to enable parallel test execution and ensure consistent test behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fbfef235-cadd-4a38-a659-68a00e7044cb

📥 Commits

Reviewing files that changed from the base of the PR and between 83a3b71 and 36e43eb.

📒 Files selected for processing (15)
  • .gitignore
  • pkg/providers/aws/alb.go
  • pkg/providers/aws/alb_test.go
  • pkg/providers/aws/aws.go
  • pkg/providers/aws/cloudfront.go
  • pkg/providers/aws/ecs.go
  • pkg/providers/aws/eks.go
  • pkg/providers/aws/elb.go
  • pkg/providers/aws/elb_test.go
  • pkg/providers/aws/instances.go
  • pkg/providers/aws/lambda-api-gateway.go
  • pkg/providers/aws/lightsail.go
  • pkg/providers/aws/recovery_test.go
  • pkg/providers/aws/route53.go
  • pkg/providers/aws/s3.go

…heck

- Resources() now logs worker errors and returns error when all workers fail
  instead of silently swallowing panic-derived errors
- Inner GetResource goroutines collect panics into error slice instead of
  just logging — returns error if all goroutines failed
- elb.go: fix wrong nil check (ep.elbClient → ec2Client parameter)
- recovery_test.go: add t.Parallel() to all tests
@knakul853 knakul853 requested a review from Ice3man543 April 2, 2026 19:12
@knakul853 knakul853 self-assigned this Apr 2, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pkg/providers/aws/ecs.go (1)

45-63: ⚠️ Potential issue | 🟠 Major

Record worker errors and successes explicitly.

errs only grows on recovered panics. Ordinary listECSResources failures are still dropped by the if ... err == nil guard, so a full AccessDenied/throttling outage can return an empty list with nil. Also, len(list.Items) is not a reliable success signal because a worker can legitimately scan a region/account and find zero ECS resources. The same wrapper was copied into the sibling AWS providers in this PR.

🛠️ Minimal fix
 list := schema.NewResources()
 var wg sync.WaitGroup
 var mu sync.Mutex
 var errs []error
+var successfulWorkers int
@@
-				if resources, err := ep.listECSResources(ecsClient, ec2Client); err == nil {
-					mu.Lock()
-					list.Merge(resources)
-					mu.Unlock()
-				}
+				resources, err := ep.listECSResources(ecsClient, ec2Client)
+				mu.Lock()
+				defer mu.Unlock()
+				if err != nil {
+					errs = append(errs, errors.Wrap(err, "ecs worker failed"))
+					return
+				}
+				successfulWorkers++
+				list.Merge(resources)
@@
-if len(errs) > 0 && len(list.Items) == 0 {
+if len(errs) > 0 && successfulWorkers == 0 {
 	return nil, fmt.Errorf("ecs: all workers failed: %v", errs)
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/providers/aws/ecs.go` around lines 45 - 63, The code currently only
records panics into errs and ignores non-panic errors from listECSResources;
change the goroutine body so that when listECSResources returns an error you
append that error to errs (with mu locked), and when it succeeds you merge into
list (as currently done); after wg.Wait, determine failure by comparing
len(errs) to the total number of workers (e.g., len(ecsClients) or the iteration
count) rather than checking list.Items, and return an aggregated error only if
all workers errored. Keep the existing panic recover block, but add explicit
error appends for the listECSResources call and use a worker-count check to
decide "all workers failed."
pkg/providers/aws/alb.go (1)

45-56: ⚠️ Potential issue | 🔴 Critical

Fix the mutex deadlock in panic recovery.

A panic during list.Merge() while mu is locked will cause the deferred panic handler to deadlock when it tries mu.Lock() on the same goroutine that already holds the mutex. Go's sync.Mutex is not reentrant.

Use a nested anonymous function with defer mu.Unlock() to ensure the mutex is released before the outer panic handler runs:

Safer pattern
-				if resources, err := ep.listELBV2Resources(albClient, ec2Client); err == nil {
-					mu.Lock()
-					list.Merge(resources)
-					mu.Unlock()
-				}
+				if resources, err := ep.listELBV2Resources(albClient, ec2Client); err == nil {
+					func() {
+						mu.Lock()
+						defer mu.Unlock()
+						list.Merge(resources)
+					}()
+				}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/providers/aws/alb.go` around lines 45 - 56, The deferred panic handler
deadlocks if a panic occurs while mu is already locked around list.Merge; fix by
removing mu.Lock() from the panic handler and enclosing the mutex-protected work
in a nested anonymous function that does mu.Lock() with defer mu.Unlock() before
calling list.Merge (i.e., call ep.listELBV2Resources(...), then if err==nil
invoke an inline func that does mu.Lock(); defer mu.Unlock();
list.Merge(resources)) so the mutex is always released before any outer panic
recovery runs and errs is appended safely.
🧹 Nitpick comments (1)
pkg/providers/aws/elb.go (1)

31-31: Consider using context for cancellation support in a follow-up.

The ctx parameter is received but not passed to AWS SDK calls (DescribeLoadBalancers, DescribeInstances). While this is pre-existing behavior and outside the scope of this panic-fix PR, the coding guidelines specify that context should be honored in long-running API calls. The AWS SDK v1 provides *WithContext variants for this purpose.

As per coding guidelines: "Always pass and honor context.Context in Resources() and long-running API calls to support cancellation"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/providers/aws/elb.go` at line 31, GetResource currently accepts ctx but
does not pass it to AWS SDK calls; update elbProvider.GetResource to use the
context-aware SDK variants (e.g., call DescribeLoadBalancersWithContext and
DescribeInstancesWithContext) and propagate ctx into any subsequent AWS API
invocations so those long-running calls honor cancellation; locate calls to
DescribeLoadBalancers and DescribeInstances in GetResource and replace them with
their *WithContext counterparts, forwarding the ctx and preserving existing
request/input parameters and error handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pkg/providers/aws/aws.go`:
- Around line 511-521: The code currently infers any successful worker by
checking finalResources.Items length, which is wrong because a successful worker
may return an empty *schema.Resources; change the loop over results to track
successful workers explicitly (e.g., introduce a successCount and increment it
when result.err == nil, alongside calling
finalResources.Merge(result.resources)), then replace the condition `if
len(errs) > 0 && len(finalResources.Items) == 0` with `if len(errs) > 0 &&
successCount == 0` (and update the error message if needed) so failures are
reported only when no worker actually succeeded; reference the results loop,
result.err, finalResources.Merge, finalResources.Items, and errs to locate where
to add successCount.

---

Outside diff comments:
In `@pkg/providers/aws/alb.go`:
- Around line 45-56: The deferred panic handler deadlocks if a panic occurs
while mu is already locked around list.Merge; fix by removing mu.Lock() from the
panic handler and enclosing the mutex-protected work in a nested anonymous
function that does mu.Lock() with defer mu.Unlock() before calling list.Merge
(i.e., call ep.listELBV2Resources(...), then if err==nil invoke an inline func
that does mu.Lock(); defer mu.Unlock(); list.Merge(resources)) so the mutex is
always released before any outer panic recovery runs and errs is appended
safely.

In `@pkg/providers/aws/ecs.go`:
- Around line 45-63: The code currently only records panics into errs and
ignores non-panic errors from listECSResources; change the goroutine body so
that when listECSResources returns an error you append that error to errs (with
mu locked), and when it succeeds you merge into list (as currently done); after
wg.Wait, determine failure by comparing len(errs) to the total number of workers
(e.g., len(ecsClients) or the iteration count) rather than checking list.Items,
and return an aggregated error only if all workers errored. Keep the existing
panic recover block, but add explicit error appends for the listECSResources
call and use a worker-count check to decide "all workers failed."

---

Nitpick comments:
In `@pkg/providers/aws/elb.go`:
- Line 31: GetResource currently accepts ctx but does not pass it to AWS SDK
calls; update elbProvider.GetResource to use the context-aware SDK variants
(e.g., call DescribeLoadBalancersWithContext and DescribeInstancesWithContext)
and propagate ctx into any subsequent AWS API invocations so those long-running
calls honor cancellation; locate calls to DescribeLoadBalancers and
DescribeInstances in GetResource and replace them with their *WithContext
counterparts, forwarding the ctx and preserving existing request/input
parameters and error handling.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85278d54-811c-404f-bb80-1a9341584bcd

📥 Commits

Reviewing files that changed from the base of the PR and between 36e43eb and 68cb03d.

📒 Files selected for processing (12)
  • pkg/providers/aws/alb.go
  • pkg/providers/aws/aws.go
  • pkg/providers/aws/cloudfront.go
  • pkg/providers/aws/ecs.go
  • pkg/providers/aws/eks.go
  • pkg/providers/aws/elb.go
  • pkg/providers/aws/instances.go
  • pkg/providers/aws/lambda-api-gateway.go
  • pkg/providers/aws/lightsail.go
  • pkg/providers/aws/recovery_test.go
  • pkg/providers/aws/route53.go
  • pkg/providers/aws/s3.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • pkg/providers/aws/recovery_test.go
  • pkg/providers/aws/lambda-api-gateway.go
  • pkg/providers/aws/cloudfront.go

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/providers/aws/aws.go (1)

438-442: Consider capturing stack trace for better panic diagnostics.

The panic recovery correctly prevents process crashes, but %v on the recovered value loses the stack trace. For production incidents like the one mentioned in the PR (Group1001), having the full stack trace would significantly aid debugging.

Capture stack trace in panic error
+import "runtime/debug"
+
 func worker(ctx context.Context, fn getResourcesFunc, ch chan<- result) {
 	defer func() {
 		if r := recover(); r != nil {
-			ch <- result{resources: nil, err: fmt.Errorf("panic in provider worker: %v", r)}
+			ch <- result{resources: nil, err: fmt.Errorf("panic in provider worker: %v\n%s", r, debug.Stack())}
 		}
 	}()
 	resources, err := fn(ctx)
 	ch <- result{resources, err}
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/providers/aws/aws.go` around lines 438 - 442, The defer recover block in
the provider worker currently sends only the recovered value (r) over ch via
fmt.Errorf, losing the stack trace; update the deferred func (the recover block
that sends result on ch) to capture the goroutine stack (e.g.,
runtime/debug.Stack() or runtime.Stack) and include it in the error passed to ch
so the sent error contains both the panic value and full stack trace (ensure you
add the required import for runtime/debug and format the error like "panic in
provider worker: %v\n%s" combining r and the stack).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/providers/aws/aws.go`:
- Around line 438-442: The defer recover block in the provider worker currently
sends only the recovered value (r) over ch via fmt.Errorf, losing the stack
trace; update the deferred func (the recover block that sends result on ch) to
capture the goroutine stack (e.g., runtime/debug.Stack() or runtime.Stack) and
include it in the error passed to ch so the sent error contains both the panic
value and full stack trace (ensure you add the required import for runtime/debug
and format the error like "panic in provider worker: %v\n%s" combining r and the
stack).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bc52823c-d75a-447d-92e7-5849ef114e44

📥 Commits

Reviewing files that changed from the base of the PR and between 68cb03d and 6f023bf.

📒 Files selected for processing (1)
  • pkg/providers/aws/aws.go

@ehsandeep ehsandeep merged commit da6b66e into dev Apr 3, 2026
10 checks passed
@ehsandeep ehsandeep deleted the fix/alb-nil-pointer-panic branch April 3, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants