dotandimet / Mojo-UserAgent-Role-Queued

A role for Mojo::UserAgent that processes non-blocking requests in a rate-limiting queue.
Other
3 stars 2 forks source link

Off by one in parallel #5

Open tyldum opened 6 years ago

tyldum commented 6 years ago

Seems to be one more active connection than the one specified in ->max_active().

This is minor and I might get to send you a PR, but right now I just had to document it as I hurry on in my project ;)

For most people this would simply mean that UA will keep opening and closing one additional connection if max_active is set equal to max_connections.

Neat tshark command to summarize this when testing: tshark -z endpoints,tcp,ip.addr==$serverip

dotandimet commented 5 years ago

off-by-one errors... :swears:

dotandimet commented 5 years ago

I wonder if this is a logic error or related to the memory leaks - something isn't releasing that extra connection.

tyldum commented 5 years ago

If "active" is initialized to 1 it corresponds if "max_active" > 1. However there are no connections if "active" is initialized to 1 and "max_active" is set to 1. Race condition on the first iteration? Okay for my current use-case, hope to get time to revisit later.

Edit: Still there for 1.14