morph: Fix panic when closing morph client #760

Merged
fyrchik merged 1 commit from acid-ant/frostfs-node:bugfix/749-morph-client-panic into master 2023-11-01 10:48:15 +00:00
Member

Close #749

Signed-off-by: Anton Nikiforov an.nikiforov@yadro.com

Close #749 Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
fyrchik approved these changes 2023-10-27 13:45:07 +00:00
@ -172,6 +178,8 @@ func (l *listener) listen(ctx context.Context, intError chan<- error) error {
}
func (l *listener) subscribe(errCh chan error) {
l.wg.Add(1)
Owner

It it not a goroutine, do we need wg here?

It it not a goroutine, do we need wg here?
Author
Member
It is routine https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/6f60884bb49dc7c63633855926520f14804a505b/pkg/morph/event/listener.go#L173
fyrchik marked this conversation as resolved
@ -235,7 +255,7 @@ loop:
if !ok {
l.log.Warn(logs.EventStopEventListenerByNotificationChannel)
if intErr != nil {
Owner

May be also move if intErr != nil logic in function?

May be also move `if intErr != nil` logic in function?
Author
Member

The idea was to avoid allocation of error to pass it to the function which should send it. How about to pass string only and allocate error inside the function?

The idea was to avoid allocation of error to pass it to the function which should send it. How about to pass string only and allocate error inside the function?
Owner

Ah, yeah, missed that.
But the error could easily be moved to a global varable, it is always the same.

Ah, yeah, missed that. But the error could easily be moved to a global varable, it is always the same.
fyrchik marked this conversation as resolved
acid-ant requested review from storage-core-committers 2023-10-27 15:01:12 +00:00
acid-ant requested review from storage-core-developers 2023-10-27 15:01:13 +00:00
acid-ant force-pushed bugfix/749-morph-client-panic from 6f60884bb4 to 84c2453710 2023-10-27 17:56:10 +00:00 Compare
fyrchik approved these changes 2023-10-30 06:59:07 +00:00
fyrchik added this to the v0.38.0 milestone 2023-10-30 07:03:43 +00:00
fyrchik reviewed 2023-10-31 10:03:34 +00:00
@ -213,2 +227,4 @@
}
func (l *listener) sendError(ctx context.Context, intErr chan<- error, err error) bool {
if intErr != nil {
Owner

nitpick, mut maybe if intErr == nil { return false } and reduce indentation for other code?

nitpick, mut maybe `if intErr == nil { return false }` and reduce indentation for other code?
Author
Member

Agree, updated.

Agree, updated.
fyrchik marked this conversation as resolved
acid-ant force-pushed bugfix/749-morph-client-panic from 84c2453710 to e74b2cd5c3 2023-10-31 10:14:17 +00:00 Compare
dstepanov-yadro approved these changes 2023-10-31 14:30:14 +00:00
acid-ant force-pushed bugfix/749-morph-client-panic from e74b2cd5c3 to 7217394620 2023-11-01 05:48:38 +00:00 Compare
fyrchik merged commit a26483fc30 into master 2023-11-01 10:48:15 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
3 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-node#760
No description provided.