Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: fix panic during defrag operation #7579

Merged
merged 2 commits into from
Mar 23, 2017
Merged

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Mar 22, 2017

When resetting bolt.Tx in defrag and batchTxBuffered.commit operation, we do not hold readTx lock, so the inflight range requests can trigger panic in mvcc.Range paths. This fixes by moving mutexes out and hold it while resetting the readTx.

The test case is added (fails in current master branch).

return tx
}

func (b *backend) unsafebegin(write bool) *bolt.Tx {
Copy link
Contributor

Choose a reason for hiding this comment

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

unsafeBegin?

t.unsafecommit(stop)
}

func (t *batchTxBuffered) unsafecommit(stop bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

unsafeCommit?

@heyitsanthony
Copy link
Contributor

@gyuho fix the patches? the test patch has backend changes

defer clus.Terminate(t)

cli := clus.RandClient()
kvc := toGRPC(cli).KV
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason not to use cli directly for Put() and Defragment()?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, the ./integration/ tests should use pure grpc interfaces when possible

Copy link
Member

Choose a reason for hiding this comment

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

got it, thanks.

Fix etcd-io#7526.

When resetting `bolt.Tx` in `defrag` and `batchTxBuffered.commit`
operation, we do not hold `readTx` lock, so the inflight range
requests can trigger panic in `mvcc.Range` paths. This fixes by
moving mutexes out and hold it while resetting the `readTx`.

Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
@xiang90
Copy link
Contributor

xiang90 commented Mar 23, 2017

@gyuho

this fixes #7526?

@gyuho
Copy link
Contributor Author

gyuho commented Mar 23, 2017

@xiang90 Yes. Will redeploy after merge.

@gyuho gyuho merged commit 161c7f6 into etcd-io:master Mar 23, 2017
@gyuho gyuho deleted the fix-defrage branch March 23, 2017 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants