pingcap / pingcap/tidb-binlog

Oracle syncer potential deadlock problems

Open
#1,201 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

affects-6.1 affects-8.5 severity/major type/bug
Dominant language
Go
Stars
291
Forks
131
Avg merge
5m
Merged PRs (30d)
2

Description

Bug Report

  1. syncer.go line 279 calls OracleCheckPoint's Save method, then executes _, err = sp.db.Exec(sql) and keeps blocking on a call to cgo. This function gets a write lock on OracleCheckPoint. It blocks the syncer's Run main process.

  2. server.go line 437 calls Syncer's updateStatus method, and then it also calls OracleCheckPoint's TS function, which wants to get OracleCheckPoint's read lock, but can't get the lock because of the above stuck problem, so it leads to deadlock.

Because the lock is not released, the server will not be able to call updateStatus, so it seems to be stuck and not advancing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing syncer.go line 279 through OracleCheckPoint.Save and the following sp.db.Exec(sql) call, then inspect server.go line 437 and Syncer.updateStatus. Reproduce or instrument the blocking path to confirm how the OracleCheckPoint lock interacts with the cgo call and TS read, and consider the issue done when the syncer and server can progress without deadlocking.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.