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

CI sporadic fail: test_timestrToBlock_eth_1(); can't see the chain #546

Closed
trentmc opened this issue May 8, 2023 · 1 comment
Closed
Labels
Type: Bug Something isn't working

Comments

@trentmc
Copy link
Member

trentmc commented May 8, 2023

Background

I did a commit that only had trivial changes (removed some whitespace). Yet it failed.

This is a sporadic failure. I've been doing other commits today, and CI passes.

Traceback summary: (details below)

util/blocktime.py:146: in ethTimestamptoBlock
    current_block = chain[-1].number
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/web3/eth.py:690: in get_block
    return self._get_block(block_identifier, full_transactions)
 ...
    
>       raise BlockNotFound(message)
E       web3.exceptions.BlockNotFound: Block with id: '0x106a493' not found.

Another clue: there were many warnings. They hinted that it can't actually find the chain (ganache) at all.

=============================== warnings summary ===============================
util/test/test_query.py:38
  /home/runner/work/df-py/df-py/util/test/test_query.py:38: PytestUnknownMarkWarning: Unknown pytest.mark.timeout - is this a typo?  
...

util/test/test_DFRewards_allocate_gas.py::test_1250_addresses
  /opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/_pytest/threadexception.py:75: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-179
  
  Traceback (most recent call last):
    File "/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/brownie/network/rpc/ganache.py", line 125, in _request
      response = web3.provider.make_request(method, args)  # type: ignore
  AttributeError: 'NoneType' object has no attribute 'make_request'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
...
    File "/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/brownie/network/rpc/ganache.py", line 134, in sleep
      return _request("evm_increaseTime", [seconds])
    File "/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/brownie/network/rpc/ganache.py", line 129, in _request
      raise RPCRequestError("Web3 is not connected.")
  brownie.exceptions.RPCRequestError: Web3 is not connected.

And

====== 1 failed, 256 passed, 4 skipped, 248 warnings in 369.52s (0:06:09) ======

Full log

Here.

Traceback

=================================== FAILURES ===================================
__________________________ test_timestrToBlock_eth_1 ___________________________

    def test_timestrToBlock_eth_1():
        ts = chain[-5000].timestamp
        block = chain[-5000].number
    
        # convert ts to YYYY-MM-DD_HH:MM
        dt = datetime.fromtimestamp(ts)
        dt_str = dt.strftime("%Y-%m-%d_%H:%M:%S")
    
>       guess = timestrToBlock(chain, dt_str, True)

util/test/test_blocktime_eth_mainnet.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/enforce_typing/decorator.py:29: in wrapper
    return func(*args, **kwargs)
util/blocktime.py:45: in timestrToBlock
    block = ethTimestamptoBlock(chain, timestamp)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/enforce_typing/decorator.py:29: in wrapper
    return func(*args, **kwargs)
util/blocktime.py:146: in ethTimestamptoBlock
    current_block = chain[-1].number
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/web3/eth.py:690: in get_block
    return self._get_block(block_identifier, full_transactions)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/web3/module.py:57: in caller
    result = w3.manager.request_blocking(method_str,
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/web3/manager.py:198: in request_blocking
    return self.formatted_response(response,
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/web3/manager.py:177: in formatted_response
    apply_null_result_formatters(null_result_formatters, response, params)
/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/web3/manager.py:82: in apply_null_result_formatters
    formatted_resp = pipe(params, null_result_formatters)
cytoolz/functoolz.pyx:666: in cytoolz.functoolz.pipe
    ???
cytoolz/functoolz.pyx:641: in cytoolz.functoolz.c_pipe
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

params = ('0x106a493', False)

    def raise_block_not_found(params: Tuple[BlockIdentifier, bool]) -> NoReturn:
        try:
            block_identifier = params[0]
            message = f"Block with id: {block_identifier!r} not found."
        except IndexError:
            message = "Unknown block identifier"
    
>       raise BlockNotFound(message)
E       web3.exceptions.BlockNotFound: Block with id: '0x106a493' not found.

/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/web3/_utils/method_formatters.py:630: BlockNotFound
@trentmc trentmc added the Type: Bug Something isn't working label May 8, 2023
@trentmc trentmc changed the title CI test fails: test_timestrToBlock_eth_1. Can it even see the chain? CI test fails: test_timestrToBlock_eth_1. Can CI even see the chain? May 8, 2023
@trentmc trentmc changed the title CI test fails: test_timestrToBlock_eth_1. Can CI even see the chain? test_timestrToBlock_eth_1 fails. Can CI even see the chain? May 8, 2023
@trentmc trentmc changed the title test_timestrToBlock_eth_1 fails. Can CI even see the chain? Sporadic failure of test_timestrToBlock_eth_1. CI can't see the chain May 8, 2023
@trentmc trentmc changed the title Sporadic failure of test_timestrToBlock_eth_1. CI can't see the chain CI sporadic failure, can't see chain 1: test_timestrToBlock_eth_1() May 8, 2023
@trentmc trentmc changed the title CI sporadic failure, can't see chain 1: test_timestrToBlock_eth_1() CI sporadic fail: test_timestrToBlock_eth_1(); can't see the chain May 8, 2023
@trentmc
Copy link
Member Author

trentmc commented May 11, 2023

In commit 11b6c2f, Alex rearranged how df-py waits for barge on startup. Because of that, whatever errors there were previously wrt waiting for barge are now obsolete. That includes this issue. Closing.

We can reopen a new issue if other problems emerge.

@trentmc trentmc closed this as completed May 11, 2023
trentmc added a commit that referenced this issue May 11, 2023
We often hit errors wrt not being able to see ganache in barge. Like in #546. Which is this line. However this line does two things: get the network_name, then try to connect. This hurts debuggability.

To improve debuggability: split the two actions into two separate lines.
trentmc added a commit that referenced this issue May 11, 2023
Issues #546, #562 and more had issues related to cleanup of the cache. There are tactics to try to address this. This commit lists those tactics, to streamline handling similar issues in the future, which we will inevitably encounter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant