title: Writing into a chronicle queue with multiple threads -> java.nio.BufferOverflowException
body: <p>I am writing an adapter to use chronicle queue in Apache Aries Remote Service Admin. It works fine when I only use a single thread. With more than one thread I get exceptions like below. </p>
  
  <p>Any idea what i do wrong?</p>
  
  <p>For reference this is my code:
  <a href="https://github.com/cschneider/rsa-chronicle-provider/blob/master/src/test/java/org/apache/aries/rsa/provider/chronicle/ChronicleProviderTest.java" rel="nofollow">https://github.com/cschneider/rsa-chronicle-provider/blob/master/src/test/java/org/apache/aries/rsa/provider/chronicle/ChronicleProviderTest.java</a></p>
  
  <p>You can see the exception if you increase the number of threads in the executor.</p>
  
  <pre><code>Exception in thread "pool-3-thread-2" java.nio.BufferOverflowException
      at net.openhft.chronicle.bytes.AbstractBytes.writePosition(AbstractBytes.java:182)
      at net.openhft.chronicle.bytes.AbstractBytes.writePosition(AbstractBytes.java:29)
      at net.openhft.chronicle.wire.AbstractWire.writeHeader0(AbstractWire.java:183)
      at net.openhft.chronicle.wire.AbstractWire.writeHeader(AbstractWire.java:171)
      at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.append(SingleChronicleQueueExcerpts.java:252)
      at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueExcerpts$StoreAppender.writeBytes(SingleChronicleQueueExcerpts.java:153)
      at org.apache.aries.rsa.provider.chronicle.ChronicleInvocationHandler.invoke(ChronicleInvocationHandler.java:45)
      at com.sun.proxy.$Proxy7.callOneWay(Unknown Source)
      at org.apache.aries.rsa.provider.chronicle.ChronicleProviderTest$1.run(ChronicleProviderTest.java:87)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>