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

Reorganize the stop sequence of modules #535

Merged
merged 1 commit into from
Jun 9, 2020
Merged

Conversation

aidan-kwon
Copy link
Member

@aidan-kwon aidan-kwon commented Jun 5, 2020

Proposed changes

When (*cn) Stop() is called, it stops blockchain and then stops chainDB.

s.blockchain.Stop()
// stop others
s.chainDB.Close()

However, blockchain still processes inserted block and tries to write data to chainDB.
Because of this, chainDB may closes databases during the data insertion and remains incomplete data in databases.

With this PR, protocolManger, which fetch blocks from other nodes, will be closed earlier than others.

Related PR: ethereum/go-ethereum#20695

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

joowon-byun
joowon-byun previously approved these changes Jun 5, 2020
Copy link
Contributor

@KimKyungup KimKyungup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Permanent lock is general way to for this case?
It means there is a goroutine never return even if process gets kill signal.
Is it ok?

@aidan-kwon aidan-kwon changed the title Permanently lock Blockchain when it is stopped Reorganize the stop sequence of modules Jun 8, 2020
@aidan-kwon
Copy link
Member Author

Permanent lock is general way to for this case?
It means there is a goroutine never return even if process gets kill signal.
Is it ok?

I revised this PR. PTAL

Copy link
Contributor

@KimKyungup KimKyungup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@aidan-kwon aidan-kwon merged commit c290389 into klaytn:dev Jun 9, 2020
@aidan-kwon aidan-kwon deleted the bcLock branch June 9, 2020 04:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants