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

RecursionError when initializing new SubstrateInterface #355

Open
DamianStraszak opened this issue Sep 24, 2023 · 0 comments
Open

RecursionError when initializing new SubstrateInterface #355

DamianStraszak opened this issue Sep 24, 2023 · 0 comments

Comments

@DamianStraszak
Copy link
Contributor

Version of library: 1.7.4

I face an issue, which looks quite random, and I cannot really pin down exact circumstances when this happens, but it's kind of weird. Roughly the scenario is as follows:

  1. I initialize one SubstrateInterface with endpoint MAINNET_WS = "wss://ws.azero.dev" (although I doubt it matters much)
  2. I do a lot of smart contract queries (reads) on different contracts
  3. I try to initialize another instrance of SubstrateInterface, with the same WS (sometimes the error happens, sometimes it doesn't) after which I get
File "[REDACTED]/updater.py", line 171, in mainnet
    return SubstrateInterface(MAINNET_WS)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[REDACTED]/lib/python3.11/site-packages/substrateinterface/base.py", line 101, in __init__
    runtime_config = RuntimeConfigurationObject()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[REDACTED]/lib/python3.11/site-packages/scalecodec/base.py", line 58, in __init__
    self.clear_type_registry()
  File "[REDACTED]/lib/python3.11/site-packages/scalecodec/base.py", line 205, in clear_type_registry
    cls.__name__.lower(): cls for cls in self.all_subclasses(ScaleDecoder)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[REDACTED]/lib/python3.11/site-packages/scalecodec/base.py", line 52, in all_subclasses
    [s for c in class_.__subclasses__() for s in cls.all_subclasses(c)])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "[REDACTED]/lib/python3.11/site-packages/scalecodec/base.py", line 52, in <listcomp>
    [s for c in class_.__subclasses__() for s in cls.all_subclasses(c)])
                                                 ^^^^^^^^^^^^^^^^^^^^^
  File "[REDACTED]/lib/python3.11/site-packages/scalecodec/base.py", line 52, in all_subclasses
    [s for c in class_.__subclasses__() for s in cls.all_subclasses(c)])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


... LOTS OF LINES ....


  File "[REDACTED]/lib/python3.11/site-packages/scalecodec/base.py", line 51, in all_subclasses
    return set(class_.__subclasses__()).union(
               ^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded while calling a Python object

I tried to create a minimal example when this happens, but it happens quite rarily, and somehow only when I run a large piece of code that does lots of stuff :/

@arjanz arjanz moved this to 📋 Backlog in Python libraries Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant