Skip to content

Fix double call of session destroy. - #3352

Merged
tomasmik merged 2 commits into
masterfrom
fix-double-cleanup
May 5, 2021
Merged

Fix double call of session destroy.#3352
tomasmik merged 2 commits into
masterfrom
fix-double-cleanup

Conversation

@tomasmik

@tomasmik tomasmik commented May 4, 2021

Copy link
Copy Markdown
Contributor

The scenario goes like this:

  • destroy func is included in sessionCleanup and returned to the session manager
  • If (m *Manager) Stop() .. is called first then the SessionManager still holds the function
  • If SessionManager starts to cleanup session it calls the destroy func which was already called

And we get a close of a closed channel bringing the node down.

To fix this we now:

  • Check if the session hasn't been cleaned up, if so function call does nothing.
  • Wrap close in sync.Once just for good measure.

Closes: #3351
Closes: #3310

The scenario goes like this:
* `destroy` func is included in `sessionCleanup` and returned to the session manager
* If `(m *Manager) Stop() ..` is called first then the `SessionManager` still holds the function
* If `SessionManager` starts to cleanup session it calls the destroy func which was already called

And we get a close of a closed channel bringing the node down.

To fix this we now:
* Check if the session hasn't been cleaned up, if so function call does nothing.
* Wrap `close` in sync.Once just for good measure.
@tomasmik
tomasmik merged commit 288190e into master May 5, 2021
@tomasmik
tomasmik deleted the fix-double-cleanup branch May 5, 2021 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Payment engine error Panic crashed the docker container

3 participants