Skip to content

[Bug] Scheduled webhook reports can hang forever without an HTTP timeout #391

Description

@DhruvalBhinsara1

Problem

Scheduled report delivery can block indefinitely when a webhook endpoint accepts the TCP connection but never sends a response.

Current Behavior

internal/scheduler/scheduler.go sends webhook reports with the package-level http.Post helper:

resp, err := http.Post(webhookURL, "application/json", bytes.NewBuffer(jsonData))

http.Post uses http.DefaultClient, which has no timeout. If the destination webhook stalls, the scheduled job goroutine can remain stuck forever and the scheduler cannot reliably finish, retry, or record the failed report delivery.

Why This Matters

This affects automated reporting reliability. A slow or malicious webhook receiver can pin a scheduled report job indefinitely, which is especially risky for daemon/scheduled usage where the user expects jobs to complete or fail within a bounded time.

Reproduction Evidence

  1. Configure a scheduled job with a webhook destination.
  2. Point the webhook URL to an endpoint that accepts the request and sleeps without responding.
  3. Run the scheduled export path.
  4. The call to sendToWebhook waits without a bounded deadline because the client has no timeout.

Proposed Solution

Use an HTTP client with an explicit timeout for webhook delivery and add a focused scheduler test that proves stalled webhooks return a timeout error instead of hanging.

Expected Outcome

Webhook report delivery should fail fast with a clear error when the receiver stalls, allowing the scheduled job to complete its failure path instead of blocking forever.

Duplicate Check

Checked existing issues/PRs for scheduled report webhook hangs, http.Post timeout, scheduled report webhook timeout http.Post, and webhook blocks scheduler. No matching open issue or PR was found.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions