Infinite loop in libcppnetlib-uri.so causing 100% CPU usage

Thanks Mike, that makes sense, and sorry for the terseness/tone of my previous replies. As you’ve likely figured out, this is a long running issue that a number of users have gotten pretty fed up with. You’ve stumbled into it and you don’t deserve our ire, sorry :pleading_face:

When I said that replacing the library didn’t fix it, I misspoke. Following some digging, with chuckpa’s help, we couldn’t narrow it down to a specific version of cpp-netlib causing the problem (as the library wasn’t even present on some platforms), but more that the behaviour manifested only when PMS first started using cpp-netlib’s uri parsing functionality in version 1.14.1.5488, and that it’s remained ever since on all platforms it was previously seen on.

Here’s the first mention we found specifically tying it to cpp-netlib on a Windows machine:

The correlation isn’t unique to users with routers running OpenWrt, although this is by far the majority (users with Amplifi, Bitdefender and Gargoyle based systems, also running miniupnpd, have all reported the issue). The correlation is with the minupnpd software (http://miniupnp.free.fr / [OpenWrt Wiki] packages:pkgdata:miniupnpd) that OpenWrt uses for UPnP functionality. I say this as we had one user who was operating a hand-rolled router with the miniupnpd software on it and observing the same issue.

miniupnpd has had some minor updates recently but is broadly up to date (2.1.20190408-2, one release behind current) on OpenWrt 18.06.02 (current stable release) and has received updates since PMS first began exhibiting this behaviour (December 2018).

I suggested that the Plex developers reach out to the miniupnd developer and/or cpp-netlib team to investigate further or even simply register an issue on GitHub, rather than waiting for a new release and hoping for the best, but nothing appears to have been done about this.

I note that @realdeuce mentions building a 0.13.0 release of cpp-netlib and using that on his freebsd machine seems to fix the issue for him. 0.13.0 has been out since July last year, so I wonder what version Plex are using for their statically compiled binary releases? :thinking: (the cpp-netlib libraries are not found on all platforms suffering the issue, so I’m guessing that Plex statically compile the libs in to these platforms?).

FYI, this has nothing to do with PMS announcing its services via UPnP, or finding other media devices. You can completely disable UPnP within PMS and it still occurs. It seems to be PMS querying the IGD that’s announced by miniupnpd for the network and running some tests to ensure that remote access will operate correctly (specifically, I think it’s checking for double-NAT). PMS started using cpp-netlib’s URI component to do this in version 1.14.1.5488. It doesn’t seem to like the output it receives from some instances of miniupnpd and gets into a loop.