Ultimaker / Cura

3D printer / slicing GUI built on top of the Uranium framework
GNU Lesser General Public License v3.0
6.04k stars 2.06k forks source link

[4.0.0] Cura takes a long time to load models when USB-to-RS232 devices are plugged in #5600

Open petemate opened 5 years ago

petemate commented 5 years ago

Hi, I have several RS232 devices connected to my computer using HL-340 USB-to-RS232 converters. However, Cura is extremely slow when loading models(STL files) if these converters are plugged in when Cura starts. If I unplug the converters before starting Cura, I can re-plug the converters and Cura will continue to load models just fine. From the stderr.log, it appears that Cura is just continuously running AutoDetectBaudJob on all ports. After some time, the model loads.

In the attached log file, I open cura at 00:32:00 and open a model at 00:32:20(thats when I click the "Open" button in the dialog box). But the model doesn't appear until approx 00:35:35, which matches with the timestamp 00:35:34,162 from the log file.

Application Version Cura 4.0.0 App image

Platform Linux 3.16.0-8-amd64 #1 SMP Debian 3.16.64-2 (2019-04-01) x86_64 GNU/Linux

Printer The printer selected is an Ender 3, but I doubt it has anything to do with this issue, so I haven't attached the project file.

Steps to Reproduce To reproduce, plug in a HL-230 USB-to-RS232 converter, start Cura and load a model.

Actual Results After approx. 3 minutes, the model loads. This coincides with the end of AutoDetectBaudJob,

Expected results The model should load immediately, as if the USB-to-RS232 converters were not plugged in.

Additional Information None.

stderr.log

rburema commented 5 years ago

Cura is trying to see if there are printers/devices connected to those ports, so in a way this is expected behaviour. I remember that we had a discussion about something similar with the team before, so just to get it clear I'll ask again.

petemate commented 5 years ago

Yeah, its just "too persistent" when searching for other devices. Thats the problem :)

rburema commented 5 years ago

Yeah I got that, just trying to wreck my brain on what was the problem last time this (or something suspiciously similar) came up :-) (Hence the ask around statement.)

Ghostkeeper commented 5 years ago

I see what's happening here. When rburema described it to me in person, I thought this was about the boot time but it's actually about loading a file.

The problem here is that the USB printer detection is a separate asynchronous "job" which gets executed on a separate thread in Uranium. However Uranium has a queue of jobs to execute and won't start the next job until the previous one is completed. While it's properly multithreading alongside the GUI and the main thread, it's not multithreading alongside other jobs.

rednaz1337 commented 3 years ago

Same problem here on a ThinkPad W500 but without any USB to Serial adapters plugged in. Some internal devices on this Laptop have a /dev/ttyACMx device file. Cura probably thinks these are printers. In reality, they are modems.

ant-7802 commented 2 months ago

please fix this :pray: