- Fixed the locking bug that caused several orders yesterday to be filled twice. (or more) This one was hard to track down. The locking only got screwed up when someone placed an order they could not afford. When a user did that, it cleared the lock as it exited, even though it was not the process that had taken out the lock in the first place. Ugh.
What are the consequences here? That sounds like a horrible bug. For one my trade summary is screwed up, but how did you solve the resulting deviance in balance and stock count?
I think I posted this a couple pages back, but here's the summary:
There were several users that this bug caused to go negative share balance on. For example, if they had 500 shares, an ask up for all 500 shares, and the ask got filled multiple times, they might have ended up with a balance of -1000 shares. The trades might look like:
userA, 500 sold to userB for 0.0025
userA, 500 sold to userC for 0.0025
userA, 500 sold to userD for 0.0025
All in very rapid succession.
Rather than screwing over userC and userD, who both think they've made a fair trade, I substituted my personal account for userC and userD when unwinding the trade. Thus to unwind it I did:
burnside, 500 sold to userA for 0.0025
burnside, 500 sold to userA for 0.0025
This would show up in userA's account simply as a share transfer from me, because I moved the coins manually on the command line. In each share transfer I set the value of the trade that I was unwinding.
Definitely ugly. It took me hours to manually unwind and I lost a pretty good amount of BTC because some users had already transferred their BTC off the exchange from the double/triple sale.
(One user did respond to my email request to send the coins back! That was encouraging.)
I think this bug more or less cost me around the same amount the initial IPO brought in. It sucks, but "stuff happens".
Hey burnside.. still getting the excessive locking tim error while placing orders.. been an hour of constant tries but no good?? any problems??
What asset? I'll see if I can dig anything up in the logs.
One thing I noticed late last night is that the bots placing lots of orders may be causing extended lock times. When an order is placed the process is:
- lock asset
- query db for orders on the book that might fill this incoming request
- unlock asset
- insert order and related processing
Lots of bots trying to place orders at once could potentially cause a backup. I need to put some debug code into the process to figure it out.
Cheers.