Skip to content

run.go: HTTP response body leak and potential goroutine deadlock #664

@jjpinto

Description

@jjpinto

The sendCountRequest function in
_examples/real-world-examples/exactly-once-delivery-counter/run.go
contains a critical resource leak that can cause the example to fail under load.

Problem

  1. HTTP response bodies are never closed
    => The current implementation calls http.Post in a tight loop but never closes resp.Body:

  2. Infinite retry loop without backoff
    => If the server returns any status code other than 204 No Content (e.g., 400 or 500), the function retries immediately in a tight loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions