smart-contracts icon indicating copy to clipboard operation
smart-contracts copied to clipboard

How to increase timeout duration?

Open namanyayg opened this issue 7 years ago • 10 comments

Hi, often facing this error in various steps of my deployment script:

Starting CrowdsaleToken deployment, with arguments  {'_decimals': 18, '_initialSupply': 300000000000000000000000000, '_symbol': '', '_name': ''}
Traceback (most recent call last):
  File "/home/work/ico/deploy.py", line 66, in deploy_contract
    contract, txhash = chain.provider.deploy_contract(contract_name, deploy_transaction=transaction, deploy_kwargs=kwargs)
  File "/home/work/venv/lib/python3.5/site-packages/populus/contracts/provider.py", line 123, in deploy_contract
    contract_address = self.chain.wait.for_contract_address(deploy_transaction_hash)
  File "/home/work/venv/lib/python3.5/site-packages/populus/wait.py", line 33, in for_contract_address
    txn_receipt = self.for_receipt(txn_hash, **kwargs)
  File "/home/work/venv/lib/python3.5/site-packages/populus/wait.py", line 47, in for_receipt
    return wait_for_transaction_receipt(self.web3, txn_hash, **kwargs)
  File "/home/work/venv/lib/python3.5/site-packages/populus/utils/wait.py", line 34, in wait_for_transaction_receipt
    poll_interval_fn=lambda: poll_interval if poll_interval is not None else random.random(),
  File "/home/work/venv/lib/python3.5/site-packages/populus/utils/wait.py", line 22, in poll_until
    _timeout.sleep(poll_interval_fn())
  File "/home/work/venv/lib/python3.5/site-packages/populus/utils/compat/compat_stdlib.py", line 74, in sleep
    self.check()
  File "/home/work/venv/lib/python3.5/site-packages/populus/utils/compat/compat_stdlib.py", line 67, in check
    raise self
populus.utils.compat.compat_stdlib.Timeout: 120 seconds

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/work/venv/bin/deploy-contracts", line 11, in <module>
    load_entry_point('ico', 'console_scripts', 'deploy-contracts')()
  File "/home/work/venv/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/work/venv/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/work/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/work/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/work/ico/cmd/deploycontracts.py", line 31, in main
    deploy_crowdsale_from_file(project, deployment_file, deployment_name, address)
  File "/home/work/ico/deploy.py", line 288, in deploy_crowdsale_from_file
    return _deploy_contracts(project, chain, web3, yaml_filename, chain_data, deploy_address)
  File "/home/work/ico/deploy.py", line 272, in _deploy_contracts
    runtime_data, statistics, contracts = deploy_crowdsale(project, chain, yaml_filename, chain_data, deploy_address)
  File "/home/work/ico/deploy.py", line 133, in deploy_crowdsale
    contracts[name] = deploy_contract(project, chain, deploy_address, expanded_contract_def, chain_name, need_unlock=need_unlock)
  File "/home/work/ico/deploy.py", line 68, in deploy_contract
    raise RuntimeError("Could not deploy contract {}, constructor arguments {}".format(contract_name, kwargs)) from e
RuntimeError: Could not deploy contract CrowdsaleToken, constructor arguments {'_decimals': 18, '_initialSupply': 300000000000000000000000000, '_symbol': '', '_name': ''}

What is the reason for this error? I'm running my client in a VirtualBox so my options regarding hardware are slightly limited. Is there some way to perhaps increase the timeout duration?

For reference, I'm running parity using the command parity --unlock="0x0foo" --password="y" --mode active --tracing off --pruning fast --db-compaction ssd --cache-size 4096 --force-ui ui and this is what htop reads like during normal syncing of the mainnet chain.

namanyayg avatar Oct 15 '17 23:10 namanyayg

I'm facing the same issue guys. Token Market team, can you give us a hint or something?

AlexanderC avatar Nov 01 '17 16:11 AlexanderC

@namanyayg check this out:


def tweak_chain(project, deployment_name):
    with project.get_chain(deployment_name) as chain:
        chain.wait.timeout = 9999

# in deploy contracts.py -> def main(deployment_file, deployment_name, address):

project = Project()

tweak_chain(project, deployment_name) # <-- here we go!

AlexanderC avatar Nov 02 '17 08:11 AlexanderC

@AlexanderC Thanks! Looks like this would work -- I managed to deploy all my contracts soon after Byzantium when my timeouts stopped coming (due to faster mining times perhaps?)

Would appreciate an official update from TokenMarketNet team, but I think we can close this.

namanyayg avatar Nov 03 '17 16:11 namanyayg

i get these timeouts all the time.. do i really need to patch the code in this way as a workaround?

ryanmmmmm avatar Jun 15 '18 05:06 ryanmmmmm

The problem is that the current Populus version does not support setting timeout when deploying linked contracts (contracts having libraries in them that need to be deployed). So far we have fixed this by just hardcoding a different timeout in Populus. Last time I checked @petri and @voith might have a patch coming in.

miohtama avatar Jun 15 '18 09:06 miohtama

Yes, I'll be working on this today!

voith avatar Jun 15 '18 09:06 voith

I have opened https://github.com/ethereum/populus/pull/464 to fix this issue.

voith avatar Jun 15 '18 15:06 voith

Need #134 merged to fix this issue as the fix submitted upstream needs populus from the master branch. Once #134 is merged I'll submit a PR to increase the timeout in project.json.

voith avatar Jun 17 '18 22:06 voith

@AlexanderC mate this proposed solution does not solve the issue either, what else can be tried in the interim or is a solution released for it ? thanks

also note this will only even execute if the deployment_name is same as the chain name

def tweak_chain(project, deployment_name):
    with project.get_chain(deployment_name) as chain:
        chain.wait.timeout = 9999

in deploy contracts.py -> def main(deployment_file, deployment_name, address):

project = Project()

tweak_chain(project, deployment_name) # <-- here we go!

ghost avatar Jul 05 '18 02:07 ghost

in the interim the workaround was to change the timeout values in the following files /usr/local/lib/python3.5/dist-packages/populus/wait.py /usr/local/lib/python3.5/dist-packages/populus/utils/wait.py

ghost avatar Jul 05 '18 05:07 ghost