[Click] minor Hub bug

Ian Rose ianrose at eecs.harvard.edu
Fri Jul 24 14:53:52 EDT 2009


Hello,

I have a simple Hub element bug to report, but I'm not sure what the 
proper avenue for that is...

Synposis: Hub will memory leak if used with only 1 input/output pair.

Here is a configuration that will demonstrate the problem:

> FromDump(<some big pcap file>, STOP true)
>     -> cnt::Counter
>     -> hub::Hub
>     -> Print("hub output 0 (should never happen)")
>     -> Discard;
> 
> DriverManager(pause,
>         read cnt.count,
>         print "exitting in 10s",
>         wait 10,
>         print "goodbye");

Once you see "exitting in 10s", go check the process' memory footprint 
and it should be quite large.  If you add a second input/output pair to 
the Hub element in this configuration, the problem should disappear. 
Here is a proposed patch:

> --- click-1.7.0rc1/elements/standard/hub.cc	2009-03-05 21:10:15.000000000 -0500
> +++ hub.cc	2009-07-24 14:44:41.236995000 -0400
> @@ -42,6 +42,8 @@
>  	if (q)
>  	    output(i).push(q);
>      }
> +
> +    if (n == 0) p->kill();
>  }
>  
>  CLICK_ENDDECLS

cheers,
Ian


More information about the click mailing list