xadisk
  1. xadisk
  2. XADISK-105

Should document this - "Proxy objects for a remote xadisk instance cannot be shared by multiple threads."

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2.1
    • Component/s: documentation
    • Labels:
      None
    • Environment:

      JDK 1.6, Atomikos Transaction Manager, Windows 7 64-bit

      Description

      Occasionally when running a long on-going transaction on a remote XADisk instance the following exception is thrown:

      org.xadisk.filesystem.exceptions.ConnectionException: java.io.StreamCorruptedException: invalid stream header: 05000000
      at org.xadisk.bridge.proxies.facilitators.RemoteMethodInvoker.invokeRemoteMethod(RemoteMethodInvoker.java:116)
      at org.xadisk.bridge.proxies.facilitators.RemoteObjectProxy.invokeRemoteMethod(RemoteObjectProxy.java:39)
      at org.xadisk.bridge.proxies.impl.RemoteXAFileOutputStream.write(RemoteXAFileOutputStream.java:53)
      at org.xadisk.additional.XAFileOutputStreamWrapper.write(XAFileOutputStreamWrapper.java:75)
      at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1026)
      at org.apache.commons.io.IOUtils.copy(IOUtils.java:999)
      at workflow.BeanTest.testMe(BeanTest.java:67)
      at workflow.WorkflowTest$2.run(WorkflowTest.java:60)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: java.io.StreamCorruptedException: invalid stream header: 05000000
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:782)
      at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
      at org.xadisk.bridge.proxies.facilitators.RemoteMethodInvoker.invokeRemoteMethod(RemoteMethodInvoker.java:102)
      ... 8 more
      org.xadisk.filesystem.exceptions.ConnectionException: java.io.StreamCorruptedException: invalid type code: 01
      at org.xadisk.bridge.proxies.facilitators.RemoteMethodInvoker.invokeRemoteMethod(RemoteMethodInvoker.java:116)
      at org.xadisk.bridge.proxies.facilitators.RemoteObjectProxy.invokeRemoteMethod(RemoteObjectProxy.java:39)
      at org.xadisk.bridge.proxies.impl.RemoteXAFileOutputStream.write(RemoteXAFileOutputStream.java:53)
      at org.xadisk.additional.XAFileOutputStreamWrapper.write(XAFileOutputStreamWrapper.java:75)
      at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1026)
      at org.apache.commons.io.IOUtils.copy(IOUtils.java:999)
      at workflow.BeanTest.testMe(BeanTest.java:67)
      at workflow.WorkflowTest$1.run(WorkflowTest.java:43)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: java.io.StreamCorruptedException: invalid type code: 01
      at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2463)
      at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2498)
      at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2570)
      at java.io.ObjectInputStream$BlockDataInputStream.readBoolean(ObjectInputStream.java:2711)
      at java.io.ObjectInputStream.readBoolean(ObjectInputStream.java:883)
      at org.xadisk.bridge.proxies.facilitators.RemoteMethodInvoker.invokeRemoteMethod(RemoteMethodInvoker.java:103)
      ... 8 more
      Exception in thread "pool-1-thread-5" org.xadisk.filesystem.exceptions.XASystemNoMoreAvailableException: The XADisk instance has encoutered a critial issue and is no more available. Such a condition is very rare. If you think you have setup everything right for XADisk to work, please consider discussing in XADisk forums, or raising a bug with details
      at org.xadisk.filesystem.NativeXAFileSystem.notifySystemFailure(NativeXAFileSystem.java:488)
      at org.xadisk.filesystem.workers.observers.CriticalWorkersListener.workCompleted(CriticalWorkersListener.java:31)
      at org.xadisk.filesystem.standalone.StandaloneWorkManager$WorkRunnable.run(StandaloneWorkManager.java:81)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: javax.resource.spi.work.WorkException: org.xadisk.filesystem.exceptions.XASystemNoMoreAvailableException: The XADisk instance has encoutered a critial issue and is no more available. Such a condition is very rare. If you think you have setup everything right for XADisk to work, please consider discussing in XADisk forums, or raising a bug with details
      ... 4 more
      Caused by: org.xadisk.filesystem.exceptions.XASystemNoMoreAvailableException: The XADisk instance has encoutered a critial issue and is no more available. Such a condition is very rare. If you think you have setup everything right for XADisk to work, please consider discussing in XADisk forums, or raising a bug with details
      at org.xadisk.filesystem.NativeXAFileSystem.notifySystemFailure(NativeXAFileSystem.java:488)
      at org.xadisk.filesystem.workers.TransactionTimeoutDetector.doWorkOnce(TransactionTimeoutDetector.java:42)
      at org.xadisk.filesystem.workers.TimedWorker.run(TimedWorker.java:42)
      at org.xadisk.filesystem.standalone.StandaloneWorkManager$WorkRunnable.run(StandaloneWorkManager.java:75)
      ... 3 more
      Caused by: org.xadisk.filesystem.exceptions.XASystemNoMoreAvailableException: The XADisk instance has encoutered a critial issue and is no more available. Such a condition is very rare. If you think you have setup everything right for XADisk to work, please consider discussing in XADisk forums, or raising a bug with details
      at org.xadisk.filesystem.NativeXAFileSystem.notifySystemFailure(NativeXAFileSystem.java:488)
      at org.xadisk.filesystem.NativeSession.rollback(NativeSession.java:934)
      at org.xadisk.filesystem.NativeSession.rollbackPrematurely(NativeSession.java:121)
      at org.xadisk.filesystem.NativeSession.rollbackAsynchronously(NativeSession.java:112)
      at org.xadisk.filesystem.workers.TransactionTimeoutDetector.doWorkOnce(TransactionTimeoutDetector.java:38)
      ... 5 more
      Caused by: java.nio.channels.ClosedChannelException
      at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:88)
      at sun.nio.ch.FileChannelImpl.size(FileChannelImpl.java:289)
      at org.xadisk.filesystem.workers.GatheringDiskWriter.ensureLogFileCapacity(GatheringDiskWriter.java:340)
      at org.xadisk.filesystem.workers.GatheringDiskWriter.forceWrite(GatheringDiskWriter.java:317)
      at org.xadisk.filesystem.workers.GatheringDiskWriter.transactionCompletes(GatheringDiskWriter.java:232)
      at org.xadisk.filesystem.NativeSession.rollback(NativeSession.java:927)
      ... 8 more

      The initialization of the server XADisk was done as presented below:

      String XADiskSystemDirectory = "c:/temp/xadisk";
      StandaloneFileSystemConfiguration configuration = new StandaloneFileSystemConfiguration(XADiskSystemDirectory, "instance-1");
      configuration.setEnableRemoteInvocations(true);
      configuration.setServerPort(9999);
      configuration.setTransactionTimeout(720);
      _xaFileSystem = XAFileSystemProxy.bootNativeXAFileSystem(configuration);
      _xaFileSystem.waitForBootup(-1);
      ......

      The initialization of the client XADisk was done as presented below:

      _xaFileSystem = XAFileSystemProxy.getRemoteXAFileSystemReference(_serverAddress, _serverPort);
      _xaSession = _xaFileSystem.createSessionForXATransaction();
      ......

        Activity

        Hide
        dscheibe added a comment -

        Something i forgot:

        There are two threads running on a single XAFileSystem instance, but each thread has gotten it's own XASession, maybe i'm missing some threading issue i should be aware of?

        Show
        dscheibe added a comment - Something i forgot: There are two threads running on a single XAFileSystem instance, but each thread has gotten it's own XASession, maybe i'm missing some threading issue i should be aware of?
        Hide
        Nitin Verma added a comment -

        Actually, in case of remote xadisk, the XAFileSystem reference (pointing to the remote xadisk instance) and subsequently derived objects like Session cannot be used by multiple threads concurrently. Such remote XAFileSystem objects keep their own communication channel until they are disconnected.

        This needs to be clarified in the documentation. Many Thanks to Daniel for identifying it at discussion thread: http://groups.google.com/group/xadisk/browse_thread/thread/8cad076a1eaab99.

        Show
        Nitin Verma added a comment - Actually, in case of remote xadisk, the XAFileSystem reference (pointing to the remote xadisk instance) and subsequently derived objects like Session cannot be used by multiple threads concurrently. Such remote XAFileSystem objects keep their own communication channel until they are disconnected. This needs to be clarified in the documentation. Many Thanks to Daniel for identifying it at discussion thread: http://groups.google.com/group/xadisk/browse_thread/thread/8cad076a1eaab99 .
        Hide
        Nitin Verma added a comment -

        Changing the Component to "documentation".

        Show
        Nitin Verma added a comment - Changing the Component to "documentation".
        Hide
        Nitin Verma added a comment -

        Checked-in the changes (relevant JavaDoc comment) to trunk.

        Show
        Nitin Verma added a comment - Checked-in the changes (relevant JavaDoc comment) to trunk.

          People

          • Assignee:
            Nitin Verma
            Reporter:
            dscheibe
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: