eclipse-cyclonedds / cyclonedds-python

Other
54 stars 44 forks source link

Cyclonedds ps exception in ps_discovery function #200

Closed hwoithe closed 11 months ago

hwoithe commented 11 months ago

The cyclonedds ps command occasionally encounters an exception.

Exception 1

$ cyclonedds ps
Exception in thread Thread-1 (ps_discovery):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.10/dist-packages/cyclonedds/tools/cli/discovery/main.py", line 214, in ps_discovery
    par = participants[pub.participant_key] = DParticipant(
TypeError: DParticipant.__init__() got an unexpected keyword argument 'name'

Installed version 0.10.2: https://github.com/eclipse-cyclonedds/cyclonedds-python/blob/9cec1189a3d5a1407851dfe1f40899dd4a67f52d/cyclonedds/tools/cli/discovery/main.py#L214

Current version: https://github.com/eclipse-cyclonedds/cyclonedds-python/blob/f228c5aba0286542059546d56d5117eb20827377/cyclonedds/tools/cli/discovery/main.py#L252

Exception 2

$ cyclonedds ps
Exception in thread Thread-1 (ps_discovery):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.10/dist-packages/cyclonedds/tools/cli/discovery/main.py", line 231, in ps_discovery
    par = participants[sub.participant_key] = DParticipant(
TypeError: DParticipant.__init__() got an unexpected keyword argument 'name'

Installed version 0.10.2: https://github.com/eclipse-cyclonedds/cyclonedds-python/blob/9cec1189a3d5a1407851dfe1f40899dd4a67f52d/cyclonedds/tools/cli/discovery/main.py#L231

Current verison: https://github.com/eclipse-cyclonedds/cyclonedds-python/blob/f228c5aba0286542059546d56d5117eb20827377/cyclonedds/tools/cli/discovery/main.py#L269

Additional information

The participants dictionary in ps_discovery is populated with instances of PParticipant earlier in the function. https://github.com/eclipse-cyclonedds/cyclonedds-python/blob/9cec1189a3d5a1407851dfe1f40899dd4a67f52d/cyclonedds/tools/cli/discovery/main.py#L190

I am wondering if the intention was to use PParticipant instead of DParticipant within the ps_discovery function.

Software:

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy
$ pip show cyclonedds
Name: cyclonedds
Version: 0.10.2
Summary: Eclipse Cyclone DDS Python binding
Home-page: https://cyclonedds.io
Author: Eclipse Cyclone DDS Committers
Author-email:
License: EPL-2.0, BSD-3-Clause
Location: /usr/local/lib/python3.10/dist-packages
Requires: rich-click
Required-by:
eboasson commented 11 months ago

Thanks @hwoithe! I think you're right, both from looking at the code and from trying it out.

I'm always hoping for contributions from users, so would you be willing to do make a PR with this fix? (Otherwise I'll do it, I suppose.)

hwoithe commented 11 months ago

Thank you for the fix!