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

Mysql DeadLocks #18

Open
Kos-M opened this issue May 25, 2019 · 0 comments
Open

Mysql DeadLocks #18

Kos-M opened this issue May 25, 2019 · 0 comments

Comments

@Kos-M
Copy link

Kos-M commented May 25, 2019

Hey , i notice some deadlocks trigered by PoolService and PoolServer.
This happen when PoolServer._flushSharesToDb() run in same time with
PoolService._removeOldDbEntries() .

Mysql Details:

 LATEST DETECTED DEADLOCK
------------------------
<>
*** (1) TRANSACTION:
TRANSACTION <>, ACTIVE 0 sec fetching rows
mysql tables in use 2, locked 2
LOCK WAIT 5 lock struct(s), heap size 1184, 237 row lock(s), undo log entries 12
MySQL thread id <>, OS thread handle <>, query id <> 127.0.0.1 <SERVICE> Sending data
DELETE shares
            FROM shares
            LEFT JOIN block on shares.prev_block=block.id
            WHERE block.height < <>
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 3127 page no 3 n bits 400 index `PRIMARY` of table `pool`.`shares` trx table locks 2 total table locks 2  trx id <>lock_mode X waiting lock hold time 0 wait time before grant 0
*** (2) TRANSACTION:
TRANSACTION <>, ACTIVE 0 sec starting index read, thread declared inside InnoDB 4993
mysql tables in use 1, locked 1
4 lock struct(s), heap size 1184, 6 row lock(s), undo log entries 2
MySQL thread id 9, OS thread handle <>, query id <>127.0.0.1 <SERVER>update
INSERT INTO shares (user, device, prev_block, count, difficulty)
            VALUES (<>), (<>), (<>), (<>), (<>), (<>), (<>) ON DUPLICATE KEY UPDATE count=count+values(count), difficulty=difficulty+values(difficulty)
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 3127 page no 3 n bits 400 index `PRIMARY` of table `pool`.`shares` trx table locks 1 total table locks 2  trx id <> lock_mode X locks rec but not gap lock hold time 0 wait time before grant 0
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 3127 page no 3 n bits 400 index `PRIMARY` of table `pool`.`shares` trx table locks 1 total table locks 2  trx id <>lock_mode X locks rec but not gap waiting lock hold time 0 wait time before grant 0
*** WE ROLL BACK TRANSACTION (2)

Are conflict transactions re executed ? Or missing value data there ?
Any way to avoid deadlocks or at least workaround when this happening ?
P.S i removed some sensitive data where you see <>

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

No branches or pull requests

1 participant