Hang in ValueFactory.createBinary()
jonathandfields Oct 23, 2013 4:39 PMHi,
I'm invoking ValueFactory.createBinary() and am encountering a hang. This is occurring in Modeshape 3.3.0 and EAP 6.
An SLSB (transaction/session) is being repeatedly invoked every few seconds and in that the following code is being called. (The test case is polling certain properties on a node to determine when they change).
if (node.hasProperty("returnValue")) { Binary binary = node.getProperty("returnValue").getBinary(); ObjectInputStream ois = new ObjectInputStream(binary.getStream()); Object returnValue = ois.readObject(); // ... do something with returnValue }
At some point while this is happening, the following code is called from another SLSB (transaction/session):
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(buffer); oos.writeObject(mySerializableObject); oos.close(); Binary binary = session.getValueFactory().createBinary(new ByteArrayInputStream(buffer.toByteArray())); // <--- HANG node.setProperty("returnValue", binary);
This latter call hangs and here is the stack trace from jstack:
"EJB default - 9" prio=3 tid=0x0000000002d36000 nid=0xca waiting on condition [0xfffffd7d9e4f6000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197) at java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945) at org.modeshape.jcr.value.binary.NamedLocks$NamedLock.lock(NamedLocks.java:196) at org.modeshape.jcr.value.binary.NamedLocks.lock(NamedLocks.java:91) at org.modeshape.jcr.value.binary.NamedLocks.writeLock(NamedLocks.java:54) at org.modeshape.jcr.value.binary.FileSystemBinaryStore.saveTempFileToStore(FileSystemBinaryStore.java:161) at org.modeshape.jcr.value.binary.FileSystemBinaryStore.storeValue(FileSystemBinaryStore.java:128) at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:253) at org.modeshape.jcr.value.binary.BinaryStoreValueFactory.create(BinaryStoreValueFactory.java:57) at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:147) at org.modeshape.jcr.JcrValueFactory.createBinary(JcrValueFactory.java:47)
FWIW, I have IPSN locking set to PESSIMISTIC.
Any suggestions? I'll probably try this with 3.5.0 but thought I'd also ask here in case this is a known issue.
Thanks! Jon
.