shenghaoyang / pylcddc

Python LCDd client (LCDproc server client)
MIT License
9 stars 4 forks source link

CPU pegged running demo #5

Closed bedaro closed 3 years ago

bedaro commented 3 years ago

I'm running Ubuntu 20.04 with lcdproc 0.5.9 and scripts I write with pylcddc (including the demo_time.py one provided) max out the CPU (both threads). demo_time.py is missing a time.sleep() call inside the loop but adding one does not help; this makes me suspect there's something happening in the client IO thread to cause it.

I tested this on my LCD driver and the curses driver, and with the master branch of lcdproc as well as 0.5.9.

shenghaoyang commented 3 years ago

Hi bedaro,

Thanks for the report.

It seems the cause of the issue is due to the selector being registered for write availability on the LCDd socket.

As that socket is available for writes most of the time the select() call will return immediately and result in the CPU spinning in the iothread loop.

Will put in a fix in a bit.

shenghaoyang commented 3 years ago

Could you give #6 a try?

bedaro commented 3 years ago

It looks like the fix in that pull request works! Neither the demo nor the script I'm developing spin the CPU with that update.