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

Gracefully handle tx timeout on discovery #1230

Closed
pcppcp opened this Issue Jan 26, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@pcppcp
Contributor

pcppcp commented Jan 26, 2018

Problem Definition

If discovery contract registration fails due to tx not being mined during the timeout period, Raiden will terminate with a traceback. In my case it happend because of gas price being too low.

Tasklist

  • catch tx timeout exception
  • print an error message describing what went wrong to the user
Traceback (most recent call last):
  File "/home/xoza/src/raiden/raiden/network/rpc/client.py", line 822, in poll
    gevent.sleep(.5)
  File "/home/xoza/.pyenv/versions/test_360/lib/python3.6/site-packages/gevent/hub.py", line 169, in sleep
    hub.wait(loop.timer(seconds, ref=ref))
  File "/home/xoza/.pyenv/versions/test_360/lib/python3.6/site-packages/gevent/hub.py", line 651, in wait
    result = waiter.get()
  File "/home/xoza/.pyenv/versions/test_360/lib/python3.6/site-packages/gevent/hub.py", line 898, in get
    return self.hub.switch()
  File "/home/xoza/.pyenv/versions/test_360/lib/python3.6/site-packages/gevent/hub.py", line 630, in switch
    return RawGreenlet.switch(self)
gevent.timeout.Timeout: 180 seconds

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xoza/.pyenv/versions/test_360/lib/python3.6/site-packages/gevent/greenlet.py", line 536, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/xoza/src/raiden/raiden/network/discovery.py", line 98, in register
    self.discovery_proxy.register_endpoint(node_address, endpoint)
  File "/home/xoza/src/raiden/raiden/network/proxies/discovery.py", line 76, in register_endpoint
    timeout=self.poll_timeout,
  File "/home/xoza/src/raiden/raiden/network/rpc/client.py", line 836, in poll
    raise Exception('timeout when polling for transaction')
Exception: timeout when polling for transaction
Fri Jan 26 13:06:44 2018 <Greenlet at 0x7f1233c43e88: <bound method ContractDiscovery.register of <raiden.network.discovery.ContractDiscovery object at 0x7f1233075f98>>(b'\x00\xa3)\xc0d\x87i\xa7:\xfa\xc7\xf98\x1e\x08\xf, '95.91.212.26', 41731)> failed with Exception

CRITICAL:raiden.raiden_service	Endpoint registry failed: Exception('timeout when polling for transaction',). Ethereum RPC API might be unreachable.
@shigahi

This comment has been minimized.

shigahi commented Jan 28, 2018

I also tried to create a new custom token on console.
After 1 min waiting time, it returns timeout error. Is it a matter of Ropsten? Any way to rase gas to create contract?

I'm using plain vanilla installation with Parity on Ubuntu, and other console functions and webui work fine.

In [2]: token_address = tools.create_token(initial_alloc=1000, name="My Coin", symbol="MYC", decimals=2)
---------------------------------------------------------------------------
Timeout                                   Traceback (most recent call last)
/home/ubuntu/raiden/raiden/network/rpc/client.py in poll(self, transaction_hash, confirmations, timeout)
    821 
--> 822                 gevent.sleep(.5)
    823 

/usr/local/lib/python3.5/dist-packages/gevent/hub.py in sleep(seconds, ref)
    168     else:
--> 169         hub.wait(loop.timer(seconds, ref=ref))
    170 

/usr/local/lib/python3.5/dist-packages/gevent/hub.py in wait(self, watcher)
    650         try:
--> 651             result = waiter.get()
    652             if result is not unique:

/usr/local/lib/python3.5/dist-packages/gevent/hub.py in get(self)
    897             try:
--> 898                 return self.hub.switch()
    899             finally:

/usr/local/lib/python3.5/dist-packages/gevent/hub.py in switch(self)
    629             switch_out()
--> 630         return RawGreenlet.switch(self)
    631 

Timeout: 60 seconds

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
<ipython-input-2-9fe747a11d36> in <module>()
----> 1 token_address = tools.create_token(initial_alloc=1000, name="Metho Coin", symbol="MTC", decimals=2)

/home/ubuntu/raiden/raiden/ui/console.py in create_token(self, initial_alloc, name, symbol, decimals, timeout, gasprice, auto_register)
    333             contract_path=contract_path,
    334             gasprice=gasprice,
--> 335             timeout=timeout)
    336         token_address_hex = hexlify(token_proxy.contract_address)
    337         if auto_register:

/home/ubuntu/raiden/raiden/network/rpc/client.py in deploy_solidity_contract(self, sender, contract_name, all_contracts, libraries, constructor_parameters, contract_path, timeout, gasprice)
    415         transaction_hash = unhexlify(transaction_hash_hex)
    416 
--> 417         self.poll(transaction_hash, timeout=timeout)
    418         receipt = self.eth_getTransactionReceipt(transaction_hash)
    419         contract_address = receipt['contractAddress']

/home/ubuntu/raiden/raiden/network/rpc/client.py in poll(self, transaction_hash, confirmations, timeout)
    834 
    835         except gevent.Timeout:
--> 836             raise Exception('timeout when polling for transaction')
    837 
    838         finally:

Exception: timeout when polling for transaction
@LefterisJP

This comment has been minimized.

Collaborator

LefterisJP commented Jan 28, 2018

For the gas price issue I am making a PR which will allow for dynamic gas price set automatically by raiden depending on network conditions.

But right now you can set a specific gas price using the --gas-price argument.

@hackaugusto

This comment has been minimized.

Collaborator

hackaugusto commented Aug 24, 2018

The timeout was removed by 5b88ecc, and the exception handler was removed 1c11aed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment