> On 2012-03-28 23:58:37, Hari Shreedharan wrote:
> > flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java, line 
> > 438
> > <https://reviews.apache.org/r/4497/diff/2/?file=96931#file96931line438>
> >
> >     Don't we run the risk of buffer overflow here? I think reader would try 
> > to dump data using a put operation. If the buffer is full, there could be a 
> > BufferOverflowException here, right?
> 
> Mike Percy wrote:
>     Nope... see 
> http://docs.oracle.com/javase/6/docs/api/java/io/Reader.html#read%28java.nio.CharBuffer%29
> 
> Hari Shreedharan wrote:
>     It does say it is a put operation.A put operation can cause an overflow 
> exception, maybe the reader somehow handles it. Otherwise looks good!

Thanks for checking, Hari. Basically what it does it put as many characters as 
it can into the buffer, given what's available to take and the space available 
to put it in. It returns the number of characters actually buffered, which may 
be 0 if the buffer is full (position == limit).


- Mike


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/4497/#review6498
-----------------------------------------------------------


On 2012-03-29 01:25:26, Mike Percy wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/4497/
> -----------------------------------------------------------
> 
> (Updated 2012-03-29 01:25:26)
> 
> 
> Review request for Flume.
> 
> 
> Summary
> -------
> 
> The NetcatSource does not create one event per newline. Instead, it creates 
> one event per TCP session.
> 
> I have addressed multiple issues with NetcatSource in this patch:
> 
> 1. Properly process a new event per newline.
> 2. Enforce a maximum length per line, to ensure clients cannot run the server 
> out of memory. (This is now configurable; the default is 512 characters.)
> 3. Properly flush responses to the client.
> 4. Increment counters for successful processing and failure.
> 5. Use shutdownNow() when shutting down the server, otherwise an open client 
> connection will cause the server to hang on shutdown.
> 6. Made the inner classes of NetcatSource private; I believe making them 
> public was unintentional.
> 7. Corrected unit test so it now sends a newline with each request. Also now 
> checks for "OK" response from server.
> 8. Attempting to sneak in a minor fix for the EventHelper.dumpEvent() method 
> into this patch, since I'm testing with LoggerSink and it's bugging me when 
> it throws an exception on a zero-length body.
> 
> 
> This addresses bug FLUME-1037.
>     https://issues.apache.org/jira/browse/FLUME-1037
> 
> 
> Diffs
> -----
> 
>   flume-ng-core/src/main/java/org/apache/flume/source/NetcatSource.java 
> a841b0e 
>   flume-ng-core/src/main/java/org/apache/flume/event/EventHelper.java a326a70 
>   
> flume-ng-core/src/main/java/org/apache/flume/source/NetcatSourceConfigurationConstants.java
>  PRE-CREATION 
>   flume-ng-node/src/test/java/org/apache/flume/source/TestNetcatSource.java 
> fb2a960 
> 
> Diff: https://reviews.apache.org/r/4497/diff
> 
> 
> Testing
> -------
> 
> Unit tests pass. Did a bunch of manual testing using the nc tool with a 
> Netcat source and a Logger sink.
> 
> 
> Thanks,
> 
> Mike
> 
>

Reply via email to