Hi Colin,

Thank you for your reply!

When I get this message (Caught I/O errors, trying to reconnect), the 
connection idles, to be more precise, it does never reconnect. As I was 
able to determine from testing the code many times, the application loses 
connection mostly on read operations after write operation have completed.

To complete writeDocument call application takes, on average, 400ms. 

I have tried adding graph.commit() now to writeDocument; (I have read on 
somewhere that if autoStartTx is true, the graph will automatically commit 
before shutdown, that's why I have left it out in the first place). After I 
added commit() I performed a couple of tests and I get different exceptions 
on different runs. Before, when commit(), connection was usually lost 
without any exception at all.

I have tested the code 7 times, each time trying to write 50 documents.

*1. run: *Connection lost while executing this block, with just a message 
(WARNUNG: 
Caught I/O errors, trying to reconnect (error: 
com.orientechnologies.common.io.OIOException: Cannot open a connection to 
remote server: 127.0.0.1:2424/attachments)):

StringBuilder builder = new StringBuilder();

builder.append("SELECT COUNT(*) FROM ");

builder.append(DOCUMENT_CLASS);

builder.append(" WHERE guid='");

builder.append(guid);

builder.append("' AND fiscalyear='");

builder.append(taxYear);

builder.append("'");

List<ODocument> resultList = factory.getDatabase().command(new 
OCommandSQL(builder.toString())).execute();


*2. run:*  Connection lost while executing this block, wit an exception:

StringBuilder builder = new StringBuilder();

builder.append("SELECT COUNT(*) FROM ");

builder.append(DOCUMENT_CLASS);

builder.append(" WHERE guid='");

builder.append(guid);

builder.append("' AND fiscalyear='");

builder.append(taxYear);

builder.append("' AND category LIKE '%");

builder.append(categories[i]);

builder.append("%'");

List<ODocument> resultList = factory.getDatabase().command(new 
OCommandSQL(builder.toString())).execute();


 WARNUNG: Caught I/O errors, trying to reconnect (error: 
com.orientechnologies.common.io.OIOException: Cannot open a 

connection to remote server: 127.0.0.1:2424/attachments)
com.google.common.util.concurrent.UncheckedExecutionException: 
com.orientechnologies.orient.core.exception.OStorageException: 

Cannot create a connection to remote server because url list is empty
Caused by: com.orientechnologies.orient.core.exception.OStorageException: 
Cannot create a connection to remote server because 

url list is empty
at 
com.orientechnologies.orient.client.remote.OStorageRemote.getCurrentServerURL(OStorageRemote.java:1826)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1592)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.open(OStorageRemote.java:211)
at 
com.orientechnologies.orient.client.remote.OStorageRemoteThread.open(OStorageRemoteThread.java:87)
at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:243)
at 
com.tinkerpop.blueprints.impls.orient.OrientGraphFactory.getDatabase(OrientGraphFactory.java:132)
at 
com.tinkerpop.blueprints.impls.orient.OrientGraphFactory.getDatabase(OrientGraphFactory.java:111)
at 
com.tinkerpop.blueprints.impls.orient.OrientGraphFactory.getTx(OrientGraphFactory.java:71)
at 
ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$2.load

(OrientDBDocumentManager.java:228)
at 
ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$2.load(OrientDBDocumentManager.java:1)
at 
com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)

*3. run*: Connection lost on graph.shutdown() with an exception:
WARNUNG: Caught I/O errors, trying to reconnect (error: 
com.orientechnologies.common.io.OIOException: Cannot open a connection to 
remote server: 127.0.0.1:2424/attachments)
com.orientechnologies.orient.core.exception.ODatabaseException: Error on 
retrieving record #3:5 (cluster: default)
at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeReadRecord(ODatabaseDocumentTx.java:1605)
at 
com.orientechnologies.orient.core.tx.OTransactionOptimistic.loadRecord(OTransactionOptimistic.java:226)
at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.load(ODatabaseDocumentTx.java:1424)
at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.load(ODatabaseDocumentTx.java:117)
at 
com.orientechnologies.orient.core.record.impl.ODocument.field(ODocument.java:858)
at 
com.tinkerpop.blueprints.impls.orient.OrientElement.getProperty(OrientElement.java:251)
at 
ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.getThumbnail(OrientDBDocumentManager.java:1370)
at 
ch.ringler.attachment.mgm.mediator.internal.DocumentManagerMediatorImpl.getThumbnail(DocumentManagerMediatorImpl.java:112)
at 
ch.ringler.attachment.mgm.module.window.swing.ModuleWindow$ThumbnailLoaderWorker.doInBackground(ModuleWindow.java:919)
at 
ch.ringler.attachment.mgm.module.window.swing.ModuleWindow$ThumbnailLoaderWorker.doInBackground(ModuleWindow.java:1)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.orientechnologies.orient.core.exception.OStorageException: 
Error on read record #3:5
at 
com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1506)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.readRecord(OStorageRemote.java:522)
at 
com.orientechnologies.orient.client.remote.OStorageRemoteThread.readRecord(OStorageRemoteThread.java:253)
at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.executeReadRecord(ODatabaseDocumentTx.java:1572)
... 15 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 1
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.getCurrentServerURL(OStorageRemote.java:1829)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.beginRequest(OStorageRemote.java:1811)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.readRecord(OStorageRemote.java:478)
... 17 more

*4. run*: Connection lost on the same block as with the *2. run*, this time 
without any message nor exception

*5. run: *Competed successfully, without losing connection and exceptions!

*6. run: *Identical to *4. run*, connection lost without any information

*7. run*: Connection lost on graph.shutdown(), with exception:
SCHWERWIEGEND: Exception during commit of active transaction.
com.orientechnologies.orient.core.exception.OStorageException: Error on 
commit
at 
com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1506)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.commit(OStorageRemote.java:1176)
at 
com.orientechnologies.orient.client.remote.OStorageRemoteThread.commit(OStorageRemoteThread.java:445)
at 
com.orientechnologies.orient.core.tx.OTransactionOptimistic.doCommit(OTransactionOptimistic.java:470)
at 
com.orientechnologies.orient.core.tx.OTransactionOptimistic.commit(OTransactionOptimistic.java:147)
at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.commit(ODatabaseDocumentTx.java:2376)
at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.close(ODatabaseDocumentTx.java:1062)
at 
com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.shutdown(OrientBaseGraph.java:1152)
at 
com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.shutdown(OrientBaseGraph.java:1124)
at 
ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.getThumbnail(OrientDBDocumentManager.java:1378)
at 
ch.ringler.attachment.mgm.mediator.internal.DocumentManagerMediatorImpl.getThumbnail(DocumentManagerMediatorImpl.java:112)
at 
ch.ringler.attachment.mgm.module.window.swing.ModuleWindow$ThumbnailLoaderWorker.doInBackground(ModuleWindow.java:919)
at 
ch.ringler.attachment.mgm.module.window.swing.ModuleWindow$ThumbnailLoaderWorker.doInBackground(ModuleWindow.java:1)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 1
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.getCurrentServerURL(OStorageRemote.java:1829)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.beginRequest(OStorageRemote.java:1811)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.commit(OStorageRemote.java:1087)
... 17 more

What else can I try?

In the stack traces of these exceptions there are methods that I have not 
mentioned before here, they usually just read from vertices in a graph. If 
it is needed, I can post that code as well. 

Thanks again,
Ivan

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to