Skip to content

SO: cancel dust order + increase opposite = race condition #587

@bitphage

Description

@bitphage

Because of ops bundling the strategy tries to cancel an order while allocate_asset('base') and tries to increase the same order when running allocate_asset('quote'). This is a rare condition, but still possible, good solution would be prevent it.

2019-05-12 18:31:17,992 (staggered_orders:825) - worker4 - INFO - Cancelling dust order at opposite side, placing closer buy order
2019-05-12 18:31:19,363 (staggered_orders:1439) - worker4 - INFO - Placing closer buy order
2019-05-12 18:31:19,363 (base:1126) - worker4 - INFO - Placing a buy order with 0.00012990 RUDEX.BTC @ 0.00000046
2019-05-12 18:31:19,634 (staggered_orders:916) - worker4 - INFO - Increasing sell order at price 0.00000052 from 248.536 to 285.816 RUDEX.GOLOS
2019-05-12 18:31:19,904 (base:1182) - worker4 - INFO - Placing a sell order with 285.816 RUDEX.GOLOS @ 0.00000052
2019-05-12 18:31:20,716 (staggered_orders:241) - worker4 - ERROR - Got exception during broadcasting trx:
Traceback (most recent call last):
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.6/site-packages/grapheneapi/api.py", line 168, in func
    r = func(*args, **kwargs)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.6/site-packages/grapheneapi/rpc.py", line 136, in method
    message = self.parse_response(r)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.6/site-packages/grapheneapi/rpc.py", line 104, in parse_response
    raise RPCError(ret["error"]["message"])
grapheneapi.exceptions.RPCError: Assert Exception: maybe_found != nullptr: Unable to find Object 1.7.358450585

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vvk/devel/DEXBot-prod/dexbot/strategies/staggered_orders.py", line 236, in maintain_strategy
    self.execute()
  File "/home/vvk/devel/DEXBot-prod/dexbot/strategies/base.py", line 987, in execute
    r = self.bitshares.txbuffer.broadcast()
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.6/site-packages/bitshares-0.2.1-py3.6.egg/bitshares/transactionbuilder.py", line 424, in broadcast
    raise e
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.6/site-packages/bitshares-0.2.1-py3.6.egg/bitshares/transactionbuilder.py", line 418, in broadcast
    ret, api="network_broadcast")
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.6/site-packages/grapheneapi/api.py", line 176, in func
    self.post_process_exception(e)
  File "/home/vvk/.local/share/virtualenvs/DEXBot-prod-N9mtHQyI/lib/python3.6/site-packages/bitshares-0.2.1-py3.6.egg/bitsharesapi/bitsharesnoderpc.py", line 19, in post_process_exception
    raise exceptions.UnhandledRPCError(msg)
bitsharesapi.exceptions.UnhandledRPCError: Assert Exception: maybe_found != nullptr: Unable to find Object 1.7.358450585

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions