[muscle] Re: Java NIO bugs...

  • From: Bryan Varner <bryan@xxxxxxxxxxxxx>
  • To: muscle@xxxxxxxxxxxxx
  • Date: Wed, 3 Sep 2014 09:40:55 -0400

It would probably be easier (at least for me) if I fork 
https://github.com/jfriesne/muscle and send you a pull request on github. :-)



On Sep 2, 2014, at 2:06 PM, Jeremy Friesner <jfriesne@xxxxxxxxx> wrote:

> 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: