Code Monkey home page Code Monkey logo

Comments (13)

octo47 avatar octo47 commented on July 17, 2024

fix for that. octo47@50b2a18

from asynchbase.

dingwa avatar dingwa commented on July 17, 2024

Perfect thanks for the quick response. Do you know when this fix will be merged back into main repository?

from asynchbase.

tsuna avatar tsuna commented on July 17, 2024

I tried to repro the bug (see the commit I just attached to this issue, tsuna/asynchbase@c4209af) but I'm not successful so far. Can you help me reproduce it please?

I'm also using netty-3.5.2.Final.jar so I'm not sure why @octo47's change would fix the problem. It's pretty late over here so maybe I'm missing something obvious.

from asynchbase.

octo47 avatar octo47 commented on July 17, 2024

netty fails to read from empty ChannleBuffer. I got exact the same exception, and my patch fixed it for me.

from asynchbase.

tsuna avatar tsuna commented on July 17, 2024

I believe you @octo47 but I would like to understand the exact circumstances under which this problem is triggered so that we can have a regression test for it. The one I posted above (tsuna/asynchbase@c4209af) doesn't seem to trigger the problem.

from asynchbase.

octo47 avatar octo47 commented on July 17, 2024

It is hard to reproduce. This bug triggered only in CompositeChannelBuffer, which in turn can be used by netty only under moderate load or big replies. But it is easy to see the bug in the code.

Suppose, we have keyvalue, which has only key and family. Qualifier and value are empty. With this conditions, after key and family have been read, we will be at line https://github.com/octo47/asynchbase/blob/50b2a18cb602e7973dfd36d8083fe480578172d9/src/KeyValue.java#L259 (patched version). As metioned above, qualifier will has 0 bytes length. Due of described situation, incoming buffer will depleted. Suppose, we don't check length and call buf.readBytes(qualifier); In turn we call method org.jboss.netty.buffer.CompositeChannelBuffer#componentId (via readBytes). In case of depleted buffer, index will be beyond buffer bounds (we already red all data from it), but method componentId checks, that index is not out of bounds, and of couse, it is. And as expected, exception has been thrown.
But your regression tests passed well, because in tests HeapChannelBuffer used, and it has very simple and safe implementation of readBytes
public void getBytes(int index, byte[] dst, int dstIndex, int length) {
System.arraycopy(array, index, dst, dstIndex, length);
}

Thus, you can't reproduce, until you find, how to force netty to use CompositeChannelBuffer.

Hope this helps.

from asynchbase.

dingwa avatar dingwa commented on July 17, 2024

As @octo47 has stated, I've had a lot of trouble being able to reproduce this. I have isolated this in our application down to one table, however, I still haven't been able to reliably reproduce this.

Looking at the data in my table however, I don't see any cells with empty qualifiers, however I do have various cells that have empty values.

I will continue on trying to replicate this issue.

from asynchbase.

octo47 avatar octo47 commented on July 17, 2024

Artificial reproducible code is not very hard to write.

public class TestIssue40 {
  public static void main(String[] args) {
    final HeapChannelBuffer b1 = new LittleEndianHeapChannelBuffer("ha-ha".getBytes());
    // check, that HCB works:
    b1.getBytes(5, new byte[0], 0, 0);

    final ArrayList<ChannelBuffer> bufs = new ArrayList<ChannelBuffer>();
    bufs.add(b1);
    final CompositeChannelBuffer bbb = new CompositeChannelBuffer(ByteOrder.LITTLE_ENDIAN, bufs, true);
    // but CCB - fails
    bbb.getBytes(5, new byte[0], 0, 0);
  }
}

from asynchbase.

tsuna avatar tsuna commented on July 17, 2024

This is a Netty bug, discussed at netty/netty#474, fixed in 3.5.8 – I will make sure to ship with that version (or a newer one) with asynchbase 1.4.0

from asynchbase.

octo47 avatar octo47 commented on July 17, 2024

anyway, why we need to touch buffers, if we already know, that no data will be read?

PS: thanks for link to the bug

from asynchbase.

tsuna avatar tsuna commented on July 17, 2024

True, I will merge in your fix too.

from asynchbase.

tsuna avatar tsuna commented on July 17, 2024

Alright so the actual change I intend to merge in to close this bug is tsuna/asynchbase@73d4639

from asynchbase.

dingwa avatar dingwa commented on July 17, 2024

Thanks for the quick resolution guys

from asynchbase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.