{"action":"created","issue":{"url":"https://api.github.com/repos/NiklasRosenstein/myo-python/issues/18","labels_url":"https://api.github.com/repos/NiklasRosenstein/myo-python/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/NiklasRosenstein/myo-python/issues/18/comments","events_url":"https://api.github.com/repos/NiklasRosenstein/myo-python/issues/18/events","html_url":"https://github.com/NiklasRosenstein/myo-python/issues/18","id":77719046,"number":18,"title":"Myo Connect unresponsive/crash after starting and shutting down hub multiple times","user":{"login":"maartendruwe","id":9988588,"avatar_url":"https://avatars.githubusercontent.com/u/9988588?v=3","gravatar_id":"","url":"https://api.github.com/users/maartendruwe","html_url":"https://github.com/maartendruwe","followers_url":"https://api.github.com/users/maartendruwe/followers","following_url":"https://api.github.com/users/maartendruwe/following{/other_user}","gists_url":"https://api.github.com/users/maartendruwe/gists{/gist_id}","starred_url":"https://api.github.com/users/maartendruwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maartendruwe/subscriptions","organizations_url":"https://api.github.com/users/maartendruwe/orgs","repos_url":"https://api.github.com/users/maartendruwe/repos","events_url":"https://api.github.com/users/maartendruwe/events{/privacy}","received_events_url":"https://api.github.com/users/maartendruwe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NiklasRosenstein/myo-python/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":{"login":"NiklasRosenstein","id":1318438,"avatar_url":"https://avatars.githubusercontent.com/u/1318438?v=3","gravatar_id":"","url":"https://api.github.com/users/NiklasRosenstein","html_url":"https://github.com/NiklasRosenstein","followers_url":"https://api.github.com/users/NiklasRosenstein/followers","following_url":"https://api.github.com/users/NiklasRosenstein/following{/other_user}","gists_url":"https://api.github.com/users/NiklasRosenstein/gists{/gist_id}","starred_url":"https://api.github.com/users/NiklasRosenstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiklasRosenstein/subscriptions","organizations_url":"https://api.github.com/users/NiklasRosenstein/orgs","repos_url":"https://api.github.com/users/NiklasRosenstein/repos","events_url":"https://api.github.com/users/NiklasRosenstein/events{/privacy}","received_events_url":"https://api.github.com/users/NiklasRosenstein/received_events","type":"User","site_admin":false},"milestone":null,"comments":18,"created_at":"2015-05-18T16:32:51Z","updated_at":"2015-10-08T17:10:07Z","closed_at":null,"body":"Hi\r\n\r\nWhile using this binding to interact with the Myo, I encountered an annoying problem.\r\n\r\nAfter creating a Myo Hub, and subsequently shutting it down, several times, Myo connect becomes unresponsive and crashes. This obliges me to end the Myo Connect task via the Windows Task Manager and restart the program.\r\n\r\nOn average, it takes between 6 and 10 times of creating and shutting down hubs, before this happens.\r\n\r\nDo you know what could be the cause of this? Is it a computer specific problem? A problem with Myo Connect? Or maybe with the bindings?\r\n\r\nThank you very much!"},"comment":{"url":"https://api.github.com/repos/NiklasRosenstein/myo-python/issues/comments/146626441","html_url":"https://github.com/NiklasRosenstein/myo-python/issues/18#issuecomment-146626441","issue_url":"https://api.github.com/repos/NiklasRosenstein/myo-python/issues/18","id":146626441,"user":{"login":"NiklasRosenstein","id":1318438,"avatar_url":"https://avatars.githubusercontent.com/u/1318438?v=3","gravatar_id":"","url":"https://api.github.com/users/NiklasRosenstein","html_url":"https://github.com/NiklasRosenstein","followers_url":"https://api.github.com/users/NiklasRosenstein/followers","following_url":"https://api.github.com/users/NiklasRosenstein/following{/other_user}","gists_url":"https://api.github.com/users/NiklasRosenstein/gists{/gist_id}","starred_url":"https://api.github.com/users/NiklasRosenstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NiklasRosenstein/subscriptions","organizations_url":"https://api.github.com/users/NiklasRosenstein/orgs","repos_url":"https://api.github.com/users/NiklasRosenstein/repos","events_url":"https://api.github.com/users/NiklasRosenstein/events{/privacy}","received_events_url":"https://api.github.com/users/NiklasRosenstein/received_events","type":"User","site_admin":false},"created_at":"2015-10-08T17:10:07Z","updated_at":"2015-10-08T17:10:07Z","body":"When I take the `hello_myo.py` example and change it to\r\n\r\n```python\r\n    hub.set_locking_policy(libmyo.LockingPolicy.none)\r\n    hub.run(1000, Listener())\r\n\r\n    while True:\r\n        time.sleep(1.0)\r\n        hub.shutdown()\r\n        print(\"\\nRestarting hub...\")\r\n        hub.run(1000, Listener())\r\n```\r\n\r\nI get \r\n\r\n```\r\nConnecting to Myo ... Use CTRL^C to exit.\r\n[0.9288330078125][-0.0797119140625][-0.14874267578125][-0.329833984375][<Pose: rest>][ ][ ][-54]54]\r\nRestarting hub...\r\nTraceback (most recent call last):\r\n  File \"myo-python\\examples\\hello_myo.py\", line 161, in <module>\r\n    main()\r\n  File \"myo-python\\examples\\hello_myo.py\", line 144, in main\r\n    hub.shutdown()\r\n  File \"c:\\users\\niklas\\repos\\niklasrosenstein\\myo-python\\myo-python\\myo\\__init__.py\", line 283, in shutdown\r\n    self._hub.shutdown()\r\n  File \"c:\\users\\niklas\\repos\\niklasrosenstein\\myo-python\\myo-python\\myo\\lowlevel\\ctyping.py\", line 328, in shutdown\r\n    self._notnull()\r\n  File \"c:\\users\\niklas\\repos\\niklasrosenstein\\myo-python\\myo-python\\myo\\lowlevel\\ctyping.py\", line 168, in _notnull\r\n    raise RuntimeError(message)\r\nRuntimeError: Hub object is nullptr\r\n```\r\nBut not the behaviour @maartendruwe described. Looking into `myo.lowlevel.ctyping.Hub.shutdown()`, we can find\r\n\r\n```python\r\n    def shutdown(self):\r\n        \"\"\"\r\n        Shuts the Hub down if it is running. The object is not usable\r\n        after calling this function.\r\n        \"\"\"\r\n\r\n        self._notnull()\r\n        error = ErrorDetails()\r\n        result = lib.shutdown_hub(self, byref(error))\r\n        self.value = None\r\n        error.raise_on_error()\r\n        return result\r\n```\r\n\r\nIf I remember correctly, it was documented in the Myo SDK that you can not re-use the hub once you shut it down (it's being deallocated). Creating a new lowlevel `Hub` object after the old has been shut down will fix this."}}