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

Creating a process and never running it causes an error when the process is deleted. #759

Open
tim-shea opened this issue Aug 1, 2023 · 0 comments
Labels
0-needs-review For all new issues 1-bug Something isn't working

Comments

@tim-shea
Copy link
Contributor

tim-shea commented Aug 1, 2023

Describe the bug
When I create an object that derives from AbstractProcess and never call run, it should not invoke stop during garbage collection.

To reproduce current behavior

from lava.magma.core.process.process import AbstractProcess

class ClientProcess(AbstractProcess):
    def __init__(self):
        pass

if __name__ == '__main__':
    client = ClientProcess()
  1. I get this error ...
Traceback (most recent call last):
  File "/Users/tshea/Documents/ronan/remote_loihi_poc/snippets/echo_client.py", line 37, in <module>
    client = ClientProcess()
             ^^^^^^^^^^^^^^^
  File "/Users/tshea/Documents/ronan/lava/src/lava/magma/core/process/process.py", line 33, in __call__
    getattr(obj, "_post_init")()
  File "/Users/tshea/Documents/ronan/lava/src/lava/magma/core/process/process.py", line 239, in _post_init
    attrs = self._find_attr_by_type(OutPort)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tshea/Documents/ronan/lava/src/lava/magma/core/process/process.py", line 260, in _find_attr_by_type
    attr = getattr(self, attr_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tshea/Documents/ronan/lava/src/lava/magma/core/process/process.py", line 445, in is_compiled
    return self._is_compiled
           ^^^^^^^^^^^^^^^^^
AttributeError: 'ClientProcess' object has no attribute '_is_compiled'. Did you mean: 'is_compiled'?
Exception ignored in: <function AbstractProcess.__del__ at 0x107d36d40>
Traceback (most recent call last):
  File "/Users/tshea/Documents/ronan/lava/src/lava/magma/core/process/process.py", line 221, in __del__
    self.stop()
  File "/Users/tshea/Documents/ronan/lava/src/lava/magma/core/process/process.py", line 414, in stop
    if self.runtime:
       ^^^^^^^^^^^^
  File "/Users/tshea/Documents/ronan/lava/src/lava/magma/core/process/process.py", line 275, in runtime
    return self._runtime
           ^^^^^^^^^^^^^
AttributeError: 'ClientProcess' object has no attribute '_runtime'

Expected behavior
No error should be produced.

Environment (please complete the following information):

  • Device: Laptop
  • OS: Mac
  • Lava version 0.8
@tim-shea tim-shea added the 1-bug Something isn't working label Aug 1, 2023
@github-actions github-actions bot added the 0-needs-review For all new issues label Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-needs-review For all new issues 1-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant