All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wido den Hollander <wido@42on.com>
To: ceph-devel <ceph-devel@vger.kernel.org>
Subject: Need some help with the RBD Java bindings
Date: Thu, 15 Aug 2013 17:51:39 +0200	[thread overview]
Message-ID: <520CF90B.2070106@42on.com> (raw)

Hi,

I'm having some issues with the Java bindings for librbd and I'm not 
sure what the problem is here.

The problem is with listing snapshot of a RBD image. I test it in this 
test case:

public void testCreateAndClone() {
     try {
         ..
         ..
         image.snapCreate(snapName);
         image.snapProtect(snapName);

         List<RbdSnapInfo> snaps = image.snapList();
         assertEquals("There should only be one snapshot", 1, snaps.size());
     ..
     ..
     }
}

This test fails 95% of the time with my whole JVM crashing.

The code to blame is in RbdImage.java:

public List<RbdSnapInfo> snapList() throws RbdException {
     IntByReference numSnaps = new IntByReference(16);
     PointerByReference snaps = new PointerByReference();
     List<RbdSnapInfo> list = new ArrayList<RbdSnapInfo>();
     RbdSnapInfo snapInfo, snapInfos[];

     while (true) {
         int r = rbd.rbd_snap_list(this.getPointer(), snaps, numSnaps);
         if (r >= 0) {
             numSnaps.setValue(r);
             break;
         } else {
             throw new RbdException("Failed listing snapshots", r);
         }
     }

     Pointer p = snaps.getValue(); <<<< crash
     snapInfo = new RbdSnapInfo(p);

     ..
     ..
}

So it crashes when it wants to get the value of the snaps var.

I can't figure out why this is happening and why it isn't consistent. 
I'm not a real JNA expert and I was hoping somebody around here would be 
able to figure out what I'm doing wrong.

Any Java/JNA experts around who might have a clue?

The source of rados-java: https://github.com/wido/rados-java

-- 
Wido den Hollander
42on B.V.

Phone: +31 (0)20 700 9902
Skype: contact42on

             reply	other threads:[~2013-08-15 15:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 15:51 Wido den Hollander [this message]
2013-08-15 16:57 ` Need some help with the RBD Java bindings Noah Watkins
2013-08-20 21:26   ` Noah Watkins
2013-08-21 12:11     ` Wido den Hollander
2013-08-21 19:47       ` Noah Watkins
2013-08-22  6:20         ` Wido den Hollander
2013-08-22 14:43           ` Noah Watkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520CF90B.2070106@42on.com \
    --to=wido@42on.com \
    --cc=ceph-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.