Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-14873

Problems around BoundedByteBufferPool providing direct buffers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      HBASE-13819 made BoundedByteBufferPool provide direct buffers.

      See RpcServer.java:

      ...
      class Call implements RpcCallContext {
        protected synchronized void setResponse(...) {
      ...
          this.cellBlock = ipcUtil.buildCellBlock(..., reservoir);
      ...
          bc = new BufferChain(..., this.cellBlock);
          if (connection.useWrap) {
            bc = wrapWithSasl(bc);
          }
      ...
        private BufferChain wrapWithSasl(BufferChain bc) throws IOException {
      ...
          byte[] responseBytes = bc.getBytes();
      ...
      

      cellBlock is expected to be a direct buffer retrieved from reservoir (but not always), and bc may be composed of both direct and non-direct buffers.

      And then, see BufferChain.java:

      byte [] getBytes() {
      ...
          for (ByteBuffer bb: this.buffers) {
            System.arraycopy(bb.array(), ...);
      

      A direct buffer doesn't give its array, and will throw UnsupportedOperationException.

      Another problem; cellBlock is allowed to be a non-direct buffer, and after use it will be put to reservoir, mixing direct and non-direct buffers in the pool.

      Attachments

        1. HBASE-14873-V2.patch
          2 kB
          Hiroshi Ikeda
        2. HBASE-14873.patch
          32 kB
          Hiroshi Ikeda
        3. HBASE-14873.patch
          32 kB
          Hiroshi Ikeda
        4. HBASE-14873.patch
          32 kB
          Michael Stack

        Activity

          People

            ikeda Hiroshi Ikeda
            ikeda Hiroshi Ikeda
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: