pupnp icon indicating copy to clipboard operation
pupnp copied to clipboard

too many jobstotal jobs = 100

Open G10h4ck opened this issue 5 years ago • 8 comments
trafficstars

In RetroShare we use libupnp for getting external IP address and to forward ports on NAT, we often receive reports of the log being flooded by messages like this one

too many jobstotal jobs = 100

Finally it happened to me too so I was able to track down it came from libupnp

https://github.com/pupnp/pupnp/blob/master/upnp/src/threadutil/ThreadPool.c#L825

Moreover it seems that the more UPnP enabled devices are in the same network the more it is likely for this to happen, I suppose that sadly log flooding is not the only consequence.

So first of all an easy fix so it less likely to mangle other messages is to add a \n at the end of the message. Also to make it easier to understand for others it comes from libupnp it would be nice to prefix the message with something like "libupnp ThreadPoolAdd". And finally then it would be really helpful to print a stacktrace when this happens, so one can get an indication if this problem is triggered by library user code, you can find snippets of how to print a stacktrace in C++ easily on the internet, you can even adapt the code from RetroShare

https://github.com/RetroShare/RetroShare/blob/master/libretroshare/src/util/stacktrace.h

Cheers, and thanks for caring of libupnp ♡

G10h4ck avatar Jun 02 '20 09:06 G10h4ck

First question of course is, which version of libupnp are you running, and can you confirm this behavour with the latest 1.12.1 version?

whyman avatar Jun 03 '20 07:06 whyman

It happened with a few versions of the 1.6.x series, now I am compiling with 1.12.1 from gentoo repository to see If I can reproduce the problem there, in any case I think the improvements on the message that could be eventually be printed should be done anyway, would you accept a pull request improving on that?

G10h4ck avatar Jun 03 '20 08:06 G10h4ck

There was some discussion in 2017 about this issue: #29

whyman avatar Jun 03 '20 08:06 whyman

There was some discussion in 2017 about this issue: #29

Yeah I read that before but seems it is not related to our case, I have been inspecting our code and it seems very unlikely that we are calling some Upnp* function in a loop.

G10h4ck avatar Jun 03 '20 08:06 G10h4ck

I can confirm this still happens with libupnp-1.12.1 after half an hour of running my log started being mangled with total jobs = 100, too many jobstotal jobs = 100, too many jobstotal jobs = 100, too many jobs

G10h4ck avatar Jun 03 '20 11:06 G10h4ck

I have opened a PR so at least the message is easier to track and avoid mangling other messages in the log https://github.com/pupnp/pupnp/pull/179

G10h4ck avatar Jun 03 '20 13:06 G10h4ck

Hi G10h4ck,

Can you try running configure with --disable-blocking_tcp_connections ?

Regards, Marcelo.

mrjimenez avatar Jun 03 '20 21:06 mrjimenez

Hi G10h4ck,

Can you try running configure with --disable-blocking_tcp_connections ?

Regards, Marcelo.

It is already compiled by default with that option on gentoo, and in installation it have this gentoo flags Installed versions: 1.12.1(10:16:41 AM 06/03/2020)(ipv6 reuseaddr -blocking-tcp -debug -doc -samples -static-libs)

In particular -blocking-tcp means --disable-blocking_tcp_connections

G10h4ck avatar Jun 03 '20 22:06 G10h4ck