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

failed cancel order requires restart to reconcile ? #3148

Open
norwnd opened this issue Jan 18, 2025 · 1 comment
Open

failed cancel order requires restart to reconcile ? #3148

norwnd opened this issue Jan 18, 2025 · 1 comment

Comments

@norwnd
Copy link
Contributor

norwnd commented Jan 18, 2025

I've been running MM bot and noticed it stopped placing orders at some point seemingly due to the following error:

2025-01-18 15:49:30.230 [TRC] MM[MM-dex.decred.org:7232-42-0]: mm bot (basic) is done calculating placements, buyOrdersCnt = 1, sellOrdersCnt = 0, err = <nil>
2025-01-18 15:49:30.230 [TRC] MM[MM-dex.decred.org:7232-42-0]: dex.decred.org:7232-42-0 cancel with order rate = 0.0001367, placement rate = 0.0001361, drift tolerance = 0.0000%
2025-01-18 15:49:30.414 [ERR] MM[MM-dex.decred.org:7232-42-0]: multiTrade: error canceling order 277c32638ca28dd8ab0eba72a921f265aa05faaf488175298fd91ff5c73dad3e: failed to submit cancel order targeting trade 277c32638ca28dd8ab0eba72a921f265aa05faaf488175298fd91ff5c73dad3e: rpc error: error code 33: target order not known: 277c32638ca28dd8ab0eba72a921f265aa05faaf488175298fd91ff5c73dad3e

in UI I saw this open order under "Active orders" section as if it exists, but there was no corresponding order in order-book (on markets page) and wallet funds have been locked (a sum corresponding to what's required for this order),

according to notifications there was a cancel attempt "that failed" (and then after I've restarted Bison wallet new notifications arrived "Order status update" and the issue was resolved):

Image

PS (on why cancel request failed): once cancel request has been sent to Server I can see in logs corresponding cancel-match has arrived but my Bison wallet rejected it due to some fee-checking code I've added; but it doesn't really matter what the reason of failure is - it could just as well be server not sending message, network dropping it, etc.

@norwnd
Copy link
Contributor Author

norwnd commented Jan 27, 2025

I've observed this issue in slightly different form (Bison wallet restart doesn't help, I guess I need to shut it down and wait until Server revokes my order for which "cancel" failed just needed to wait a bit after restart, turns out Server is aware of this order and it did eventually reconcile with updated from recorded status "booked" to new status "canceled"),

it has something to do with deleteStaleCancelOrder - namely from what I've gathered (I don't have the logs anymore but when I browsed through them I got the following picture):

  • MM bot had an open order
  • MM bot sent a cancel request, Server matched that cancel request against that open order
  • in parallel to that it seems Bison wallet decided it needs to deleteStaleCancelOrder because it took somewhere between 30-45 seconds for Match to happen after cancel-order has been issued (and it probably went ahead and deleted cancel-order, and I assume the Match couldn't proceed further on Bison Wallet side - so that aforementioned open order stayed open)
  • while server probably decided that Match happened (and succeeded? maybe it doesn't really verify cancel matches too strictly) and "forgot" my open order
  • and for any further attempts to cancel that open order Server says it doesn't know anything about this order

So I guess there is a race to resolve:

  • on one hand, we can/want to "retire" cancel order due to its age
  • on the other hand we shouldn't be "retiring" cancel order if it matched (and that match is being processed)

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

2 participants
@norwnd and others