[muscle] Re: Java NIO bugs...

  • From: Jeremy Friesner <jfriesne@xxxxxxxxx>
  • To: <muscle@xxxxxxxxxxxxx>
  • Date: Tue, 2 Sep 2014 11:06:49 -0700

Hi Bryan,

Just email me a .zip with the updated file(s) and I'll integrate it in for the 
next release.

Thanks!
Jeremy

On Sep 2, 2014, at 10:41 AM, Bryan Varner <bryan@xxxxxxxxxxxxx>
 wrote:

> I recently upgraded some very old java MUSCLE code to the interfaces using 
> the Java NIO byte buffers, and found some unexpected results.
> 
> Specifically, I was getting IOExceptions as if the remote end of the 
> connection had hung-up. After a lot of sleuthing, I found that the receive 
> buffer position wasn’t being set prior to throwing a NotEnoughDataException 
> during message unflattening, which was leaving the buffer in an inconsistent 
> state and basically reading random bits into bytes for message length and 
> encoding…
> 
> I ran across the root of the problem after noticing that the byte buffers 
> were being allocated per message received invocation, and were using indirect 
> byte buffers… 
> 
> I have a copy of the source with the issue fixed as well as a set of changes 
> which changes the scope of the byte buffer, allocated it as direct, and 
> dramatically reduced the amount of work the GC was doing in Java to clean up 
> all those byte buffer allocations.
> 
> What’s the process for submitting patches these days? :-)
> 
> Regards,
> -Bryan


Other related posts: