question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RegularChainSyncer crashes when block importing fails

See original GitHub issue

So, validate_rlp_equal() is raising a TypeError even though the diff between the imported block and the original one is empty and they seem to be instances of the same class, and that is causing RegularChainSyncer to crash:

   DEBUG  09-25 17:02:51           ByzantiumVM  BLOCK REWARD: 3000000000000000000 -> b'\x1b\xc1\xeet\x1b= GT?Yq\xadu4\x074\xc1D\x13'
   DEBUG  09-25 17:02:51    RegularChainSyncer  <coroutine object RegularChainSyncer._import_ready_blocks at 0x7fd3147e72b0> finished while <trinity.sync.full.chain.           RegularChainSyncer object at 0x7fd3179ac940> is still running, terminating as well
 WARNING  09-25 17:02:51    RegularChainSyncer  Task <coroutine object RegularChainSyncer._import_ready_blocks at 0x7fd3147e7308> finished unexpectedly: block                  (<ByzantiumBlock(#Block #4111023)>) != imported block (<ByzantiumBlock(#Block #4111023)>) but got an empty diff
   DEBUG  09-25 17:02:51    RegularChainSyncer  Task failure traceback
trinity.chains.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/home/salgado/src/py-evm/trinity/chains/__init__.py", line 184, in wrapper
    return attr(*args, **kwargs)
  File "/home/salgado/src/py-evm/eth/chains/base.py", line 646, in import_block
    validate_imported_block_unchanged(imported_block, block)
  File "cytoolz/functoolz.pyx", line 236, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/home/salgado/src/py-evm/eth/utils/rlp.py", line 65, in validate_rlp_equal
    obj_b,
TypeError: block (<ByzantiumBlock(#Block #4111023)>) != imported block (<ByzantiumBlock(#Block #4111023)>) but got an empty diff
"""

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gsalgadocommented, Sep 26, 2018

And the above happens because the original block (the one we want to import) is pickled (with its ._hash_cache) and sent to a different process, but python’s hash() builtin is not stable across processes.

This wasn’t a problem in the past because it was only recently that validate_rlp_equal() was modified to raise a TypeError when the objects don’t compare equally but the diff is empty

I can see a few alternatives to fix this:

  1. Get rid of ._hash_cache from rlp.Serializable
  2. Add a __getstate__() method to rlp.Serializable so we don’t pickle the ._hash_cache attribute
  3. Use a stable hashing implementation (e.g. hashlib) instead of the builtin hash()

I’d be in favour of 1 as I’m not sure caching the hash of rlp.Serializables provides a significant performance improvement anywhere

0reactions
pipermerriamcommented, Sep 27, 2018

This issue can be closed once the rlp dependency has been bumped to >=1.0.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Delay, freeze, or crash, when inserting a block or drawing in ...
Issue: When trying to insert a drawing or block into a drawing in AutoCAD, the program shows a delay, freezes, or crashes.
Read more >
Errors or crashes when importing from or exporting to Excel ...
Problem. When importing from Microsoft Office files or export to them, sometimes you encounter a generic "Application Error". This article lists ...
Read more >
Can import cause crash/error after compilation? - Stack Overflow
Example: I have program with 3 classes: Server, Client, Main. Main has 2 imports - Server and Client. Depending on in what mode...
Read more >
Kernel crashes · microsoft/vscode-jupyter Wiki - GitHub
Jupyter Kernels can crash for a number of reasons (incorrectly ... Failure to import modules, Kernel fails to start with Module not found ......
Read more >
Xcode 11 debugger crashes on break… - Apple Developer
Xcode 11 debugger crashes on breakpoint, can't find Foundation.h ... #import <Foundation/Foundation.h> ^ error: failed to import bridging header ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found