rpc: Fix mem leak again #327

Merged
dstepanov-yadro merged 1 commit from dstepanov-yadro/frostfs-sdk-go:fix/mem_leak_step2 into master 2025-01-30 11:02:44 +00:00

TBD

TBD
dstepanov-yadro added 1 commit 2025-01-30 07:50:18 +00:00
[#9999] rpc: Fix mem leak again
All checks were successful
DCO / DCO (pull_request) Successful in 27s
Code generation / Generate proto (pull_request) Successful in 33s
Tests and linters / Tests (pull_request) Successful in 44s
Tests and linters / Lint (pull_request) Successful in 1m53s
7f7539c895
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
requested reviews from storage-core-committers, storage-core-developers, storage-services-committers, storage-services-developers 2025-01-30 07:50:18 +00:00
fyrchik approved these changes 2025-01-30 07:53:27 +00:00
Dismissed
@ -36,1 +38,4 @@
func (w *streamWrapper) closeSend() error {
var err error
w.closeSendOnce.Do(
Owner

Why do we need once here?

Why do we need once here?
Author
Member

Checked: grpc package already has call more than once protection, so dropped.

Checked: grpc package already has call more than once protection, so dropped.
@ -37,2 +49,3 @@
func (w *streamWrapper) Close() error {
return w.withTimeout(w.ClientStream.CloseSend)
err := w.closeSend()
w.cancel()
Owner

I think we should call cancel explicitly in the clientStreamWriterCloser.Close() -- this is why using concrete type helps.

I think we should call cancel explicitly in the `clientStreamWriterCloser.Close()` -- this is why using concrete type helps.
Owner

But this cancel is still needed -- we can Close() on error outside this package

But this cancel is still needed -- we can `Close()` on error outside this package
dstepanov-yadro force-pushed fix/mem_leak_step2 from 7f7539c895 to 3ed8039f60 2025-01-30 07:59:05 +00:00 Compare
dstepanov-yadro dismissed fyrchik's review 2025-01-30 07:59:06 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

aarifullin approved these changes 2025-01-30 08:08:35 +00:00
Dismissed
aarifullin left a comment
Member

Perfect

Perfect
acid-ant approved these changes 2025-01-30 08:12:26 +00:00
Dismissed
fyrchik reviewed 2025-01-30 08:18:47 +00:00
@ -46,2 +49,3 @@
func (c *clientStreamWriterCloser) Close() error {
err := c.MessageReadWriter.Close()
err := c.sw.closeSend()
Owner

if err != nil, we probably should call cancel too.

`if err != nil`, we probably should call `cancel` too.
Author
Member
	// CloseSend closes the send direction of the stream. It closes the stream <------
	// when non-nil error is met. It is also not safe to call CloseSend
	// concurrently with SendMsg.
	CloseSend() error
``` // CloseSend closes the send direction of the stream. It closes the stream <------ // when non-nil error is met. It is also not safe to call CloseSend // concurrently with SendMsg. CloseSend() error ```
Author
Member

fixed

fixed
fyrchik marked this conversation as resolved
@ -53,0 +57,4 @@
return err
}
return c.sw.Close()
Owner

We call Close() which calls closeSend() + cancel().
Why not just call cancel()?

We call `Close()` which calls `closeSend()` + `cancel()`. Why not just call `cancel()`?
Author
Member

ok, done

ok, done
fyrchik marked this conversation as resolved
Owner

The commit message is exquisite! (no).

The commit message is exquisite! (no).
dstepanov-yadro force-pushed fix/mem_leak_step2 from 3ed8039f60 to 3978bac499 2025-01-30 09:02:57 +00:00 Compare
dstepanov-yadro dismissed aarifullin's review 2025-01-30 09:02:57 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

dstepanov-yadro dismissed acid-ant's review 2025-01-30 09:02:58 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

dstepanov-yadro force-pushed fix/mem_leak_step2 from 3978bac499 to a114637e54 2025-01-30 09:05:04 +00:00 Compare
dstepanov-yadro force-pushed fix/mem_leak_step2 from a114637e54 to 12f64696df 2025-01-30 09:17:34 +00:00 Compare
dstepanov-yadro changed title from rpc: Fix mem leak again to WIP: rpc: Fix mem leak again 2025-01-30 09:22:36 +00:00
dstepanov-yadro force-pushed fix/mem_leak_step2 from 12f64696df to 593dd77d84 2025-01-30 09:54:42 +00:00 Compare
dstepanov-yadro changed title from WIP: rpc: Fix mem leak again to rpc: Fix mem leak again 2025-01-30 09:58:27 +00:00
requested reviews from storage-core-committers, storage-core-developers 2025-01-30 09:58:27 +00:00
aarifullin approved these changes 2025-01-30 10:02:09 +00:00
fyrchik approved these changes 2025-01-30 10:36:21 +00:00
dstepanov-yadro merged commit 593dd77d84 into master 2025-01-30 11:02:44 +00:00
dstepanov-yadro referenced this pull request from a commit 2025-01-30 11:02:46 +00:00
dstepanov-yadro deleted branch fix/mem_leak_step2 2025-01-30 11:02:46 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-services-committers
TrueCloudLab/storage-services-developers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-sdk-go#327
No description provided.