apache / apache/rocketmq-client-go

`RequestResponseFutureMap` is not loaded lazily and creates a goroutine just by importing this package

Open
#1,068 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Go
Stars
1.4k
Forks
445
PR merge metrics
No merged PRs in 30d

Description

**BUG REPORT**

This is an issue we've discovered in Dapr because we offer support for RocketMQ.

1. Please describe the issue you observed:

- **What did you do (The steps to reproduce)?** Import the rocketmq-client-go library, even if no client is initialized

- **What did you expect to see?** Nothing should happen - the library should not initialize objects just because it's imported. All caches should be loaded lazily.

- **What did you see instead?** [This line](https://github.com/apache/rocketmq-client-go/blob/2a8172bb9174d82173ca51488ddb253bdbc22cb5/internal/request_response_future.go#L33) causes `RequestResponseFutureMap` to be initialized as a global variable, which allocates a `requestResponseFutureCache` and spawns a goroutine

2. Please tell us about your environment:

- **What is your OS?** Linux/amd64

- **What is your client version?** 2.1.2

- **What is your RocketMQ version?** N/A

3. Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.