Cura: Zeroconf 0.17.6 cannot handle service names with periods

Created on 28 Jan 2019  路  17Comments  路  Source: Ultimaker/Cura

Application Version
Up to 4.0

Platform
any

Printer
any, OctoPrint

Steps to Reproduce
In OctoPrint, preferences, appearance, set the instance name to "Test.test". Restart the OctoPrint instance

Actual Results
The instance will no longer be discoverable because the zeroconf ServiceBrowser chokes on the . in the servicename with a zeroconf.BadTypeInNameException exception.

Additional Information
I am working around this issue by including an updated zeroconf.py version with my plugin (0.21.3 instead of the version 0.17.6 that is included with official builds). This fixes the problem for OctoPrintPlugin, but it may become an issue for other plugins (or even UM3Networking) if there are ever dots in the UM3/UMS5/UMnext printer network names.

It would be nice if the included version of zeroconf were updated.

In Progress Bug

All 17 comments

Also see the upstream issue here: https://github.com/jstasiak/python-zeroconf/issues/74

@fieldOfView A tricky problem is that zeroconf > 0.17.6 seems to be extremely responsive to mDNS network activities. In a network with a lot of mDNS activities, the Cura python process can be constantly on high CPU usage, which makes Cura impossible to use. See this upstream issue for some details: https://github.com/jstasiak/python-zeroconf/issues/133

Ah, we're between a rock and a hard place then.

I was looking into https://github.com/hashicorp/mdns At some point, I would like to try building a separate process to replace zeroconf.

I would like to try building a separate process to replace zeroconf.

That sounds a bit like throwing out the baby with the bathwater. I should be having access to a university network with - I would guess - enough mDNS traffic to see if I can hunt down this issue.

Was zeroconf==0.17.7 tested? It fixes the . issue.

I am getting the same error with this ServiceInfo

info = ServiceInfo("worker._tcp.local.",
                       "_worker._tcp.local.",
                       socket.inet_aton("127.0.0.1"), 8010, 0, 0)

everything looks fine to me but still

File "/usr/local/lib/python3.6/dist-packages/zeroconf.py", line 1407, in __init__
    raise BadTypeInNameException
zeroconf.BadTypeInNameException

@tritone11 note that this issue queue is for Ultimaker Cura, which includes python-zeroconf 0.17.6. Unless you are running into this error when running Cura, I suggest you update your zeroconf install with pip install zeroconf==0.21.3

@fieldOfView I am running that exact version unfortunatly, but it doesn't accept even a simple service name like this

info = ServiceInfo("T._tcp.local.",
                       "_T._tcp.local.",
                       socket.inet_aton("0.0.0.0"), 8010, 0, 0)

Then you are not using it in Cura (because Cura uses a different version), so I suggest you visit the python-zeroconf issue queue instead:
https://github.com/jstasiak/python-zeroconf/issues

@fieldOfView Very sorry, wrong place to place my issue

Was zeroconf==0.17.7 tested? It fixes the . issue.

@fieldOfView I'm not sure, but I'll test with 0.17.7 in case it works. Thanks!

EDIT: I know that 0.18+ has the high CPU problem.

For dev, JIRA ticket: CURA-6163

@fieldOfView FYI, we decided to update zeroconf to 0.17.7 for master, but not for 4.0.

I am including a copy of zeroconf 0.17.7 with the new version of OctoPrintPlugin, so the fix should work for the OctoPrint connection in Cura 3.5 - Cura 4.0.

@fieldOfView FYI, I just did a performance test on Mac OS X with zeroconf 0.17.7. See screenshot below:
image

Both tests are done on Mac OS X with Cura running idle.

  • Left is the current master (zeroconf 0.17.6), around 4% CPU. Ignore the spike because I was adding a machine there.
  • Right is with zeroconf 0.17.7, around 40%.

So we can't directly upgrade zeroconf to 0.17.7. Sorry...

Aww, thanks for testing.
I'll see if I can cherry pick the changes I need to handle service names with periods in the version of zeroconf that I ship with the OctoPrint plugin.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DmitryBychkov picture DmitryBychkov  路  3Comments

jellewie picture jellewie  路  3Comments

JRRN picture JRRN  路  3Comments

probonopd picture probonopd  路  3Comments

mnswamp1 picture mnswamp1  路  3Comments