Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Fix possible goroutine leak
Browse files Browse the repository at this point in the history
Using unbuffered channels to receive in a select block might lead to a
goroutine leak if another branch of the select is selected instead.

By using a buffered channel the writer doesn't have to wait for another
goroutine to unblock it with a read. Instead it just uses the buffered
space to send the message and continue its execution.
  • Loading branch information
alejandrodnm committed Sep 7, 2022
1 parent 546529f commit 47f0a96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ We use the following categories for changes:
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [Unreleased]

### Added
- prom-migrator: Support for passing custom HTTP headers via command line arguments for both
reader and writer [#1020].
- Run timescaledb-tune with the promscale profile [#1615]

### Fixed
- Fix broken cache eviction in clockcache [#1603]
- Possible goroutine leak due to unbuffered channel in select block [#1604]

## [0.14.0] - 2022-08-30

Expand Down
2 changes: 1 addition & 1 deletion pkg/jaeger/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func New(config ProxyConfig, logger hclog.Logger) (*Proxy, error) {
}

func (p *Proxy) Close(ctx context.Context, _ *storage_v1.CloseWriterRequest) (*storage_v1.CloseWriterResponse, error) {
errChan := make(chan error)
errChan := make(chan error, 1)
go func() {
errChan <- p.conn.Close()
close(errChan)
Expand Down

0 comments on commit 47f0a96

Please sign in to comment.