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

Revive/support Python binding #766

Open
dalbani opened this issue Nov 26, 2019 · 2 comments
Open

Revive/support Python binding #766

dalbani opened this issue Nov 26, 2019 · 2 comments
Milestone

Comments

@dalbani
Copy link

dalbani commented Nov 26, 2019

While looking for an alternative to the native Python client due to a "limitation" (eclipse-paho/paho.mqtt.python#348), I stumbled upon the hidden Python (2.7) module in https://github.com/eclipse/paho.mqtt.c/tree/master/test/python.
As far as I could test, it seems to (still) work.
Actually, kind of, there appears to be an issue with memory management.
But it behaves differently between running in Debian and in Alpine?!?
I've made a quick demo in https://github.com/dalbani/paho-mqtt-c-python-binding to show what I'm talking about.
My findings are so far the following when publishing messages:

  • with the Alpine image, the heap keeps growing
  • with the Debian image, it doesn't go so far and fails quickly (free(): invalid pointer)

Independently from these issues, what's the status of this module?
In any case, wouldn't there be a use for such a Python binding of the C library?

@icraggs
Copy link
Contributor

icraggs commented Nov 29, 2019

I haven't looked at it for a long time, partly because of the existence of the Python client and I was told that it wouldn't be useful due to the overhead of maintenance for multiple versions of Python. There undoubtedly will be issues as it was a prototype to show the basic principles. I had contemplated using SWIG (http://www.swig.org/) rather than a hand cranked Python interface, but it has got no further than being an idea so far.

@dalbani
Copy link
Author

dalbani commented Dec 6, 2019

Thanks for your response!
I suppose that using SWIG would indeed bring the full API to Python. But I personally have no time / knowledge on how to do it.
In the meantime, I've managed to produce a Docker image where no memory-related errors are generated.
For those curious/interested, see https://github.com/dalbani/paho-mqtt-c-python-binding.
Works fine in Debian and Alpine, with no memory leak and such as far as I am aware.

@icraggs icraggs added this to the Backlog milestone Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants