Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use global HTTP connection to local CUPS
Before, a HTTP connection to the local CUPS was opened and kept in a global variable of http_t* during the whole session. Functions connecting to the local CUPS just used this connection. Later on multi-threading for time consuming actions like DNS-SD resolving and creating CUPS queues got introduced. Also the sub-threads for creating CUPS queues used the global HTTP connection. This could have cause drace conditions messing up the http_t data structure. Most probably this has caused to the "used" field of the data structure (number of bytes which are in use in the internal buffer, must be >= 0) getting negative nad this making the httpGets() function of libcups busy-looping, which caused cups-browsed taking 100% of one or two CPU cores and requiring SIGKILL to get terminated. Bug reports at Ubuntu: - cups-browsed running non-stop on two cores https://bugs.launchpad.net/bugs/2049315 - cups-browsed high-cpu usage https://bugs.launchpad.net/bugs/2067918 - cups-browsed delays shutdown for 90 s https://bugs.launchpad.net/bugs/2073504 Bug report on CUPS: - OpenPrinting/cups#879 This commit does away with the global connection. Each function which had used the global HTTP connection to the local CUPS creates an HTTP connection onits own now and closes it before returning.CUPS can accept several HTTP connections in parallel, therefore it is no problem if we have individual connections now and if they happen in parallel due to the sub-threads. Note that testing is needed to determine whether this change actually fixes the bug. The probability is high, butdue to the fact that the bug is not easily reproducable it will take some time.
- Loading branch information