OrientDB Community 2.0.3 - Losing connection to a remote database

706 views
Skip to first unread message

Ivan Jovanovic

unread,
Mar 2, 2015, 9:50:40 AM3/2/15
to orient-...@googlegroups.com
Hello everyone,

I am using a OrientDB Community 2.0.3 in my application in order to store PDF documents with some additional attached properties. Every user will have its own Vertex (class Client), each document will be represented as a Vertex (class Document), its thumbnail as well (class Thumbnail), and there will exist an "Owns" edge between between Client and Document, and "Rendition" edge between Document and Thumbnail;

When I start the application try to process a number of files (let's say 50 or 100) one by one, the application, after some time during writing the files (which appears to be random) loses connection to the database with the following error:

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)

The connection never recovers! This is the only message that I see, the log is empty, and the try/catch block which surrounds the code does not catch any exceptions.

I am posting the relevant code below:

private OrientGraphFactory factory;

public void initialize() {
try {
StringBuilder builder = new StringBuilder();
builder.append(SERVER_URL);
builder.append('/');
builder.append(DB_NAME);
OServerAdmin serverAdmin = new OServerAdmin(builder.toString()).connect(USERNAME, PASSWORD);
if(!serverAdmin.existsDatabase("plocal")) {
serverAdmin.createDatabase("graph", "plocal");
OrientGraphFactory factory = new OrientGraphFactory(builder.toString(), USERNAME, PASSWORD);
OrientGraphNoTx graph = factory.getNoTx();
OrientVertexType clientVertex = graph.createVertexType(CLIENT_CLASS);
OrientVertexProperty guidProperty = clientVertex.createProperty(GUID_PARAMETER, OType.STRING);
guidProperty.setMandatory(true);
guidProperty.setNotNull(true);

OrientVertexType documentVertex = graph.createVertexType(DOCUMENT_CLASS);
OrientVertexProperty documentGuidProperty = documentVertex.createProperty(GUID_PARAMETER, OType.STRING);
documentGuidProperty.setMandatory(true);
documentGuidProperty.setNotNull(false);
OrientVertexProperty filenameProperty = documentVertex.createProperty(FILENAME_PARAMETER, OType.STRING);
filenameProperty.setMandatory(true);
filenameProperty.setNotNull(true);

OrientVertexProperty creationDateProperty = documentVertex.createProperty(CREATION_DATE_PARAMETER, OType.DATETIME);
creationDateProperty.setMandatory(true);
creationDateProperty.setNotNull(true);

OrientVertexProperty descriptionProperty = documentVertex.createProperty(DESCRIPTION_PARAMETER, OType.STRING);
descriptionProperty.setMandatory(false);
descriptionProperty.setNotNull(false);
OrientVertexProperty numPagesProperty = documentVertex.createProperty(NUM_PAGES_PARAMETER, OType.INTEGER);
numPagesProperty.setMandatory(true);
numPagesProperty.setNotNull(true);

OrientVertexProperty fiscalYearProperty = documentVertex.createProperty(FISCAL_YEAR_PARAMETER, OType.STRING);
fiscalYearProperty.setMandatory(true);
fiscalYearProperty.setNotNull(true);

OrientVertexProperty categoryParameter = documentVertex.createProperty(CATEGORY_PARAMETER, OType.STRING);
categoryParameter.setMandatory(false);
categoryParameter.setNotNull(false);

OrientVertexProperty codeParameter = documentVertex.createProperty(CODE_PARAMETER, OType.STRING);
codeParameter.setMandatory(false);
codeParameter.setNotNull(false);

OrientVertexProperty clientCopyParameter = documentVertex.createProperty(CLIENT_COPY_PARAMETER, OType.BOOLEAN);
clientCopyParameter.setMandatory(true);

OrientVertexProperty taxAdministratorCopyParameter = documentVertex.createProperty(TAX_ADMINISTRATOR_COPY_PARAMETER, OType.BOOLEAN);
taxAdministratorCopyParameter.setMandatory(true);

OrientVertexProperty archiveCopyParameter = documentVertex.createProperty(ARCHIVE_COPY_PARAMETER, OType.BOOLEAN);
archiveCopyParameter.setMandatory(true);

OrientVertexProperty processedParameter = documentVertex.createProperty(PROCESSED_PARAMETER, OType.BOOLEAN);
processedParameter.setMandatory(true);

OrientVertexProperty contentParameter = documentVertex.createProperty(CONTENT_PARAMETER, OType.LINK);
contentParameter.setMandatory(true);
contentParameter.setNotNull(true);

OrientVertexType thumbnailVertex = graph.createVertexType(THUMBNAIL_CLASS);
OrientVertexProperty thumbnailContentParameter = thumbnailVertex.createProperty(CONTENT_PARAMETER, OType.LINK);
thumbnailContentParameter.setMandatory(true);
thumbnailContentParameter.setNotNull(true);

graph.createEdgeType(OWNS_EDGE);
graph.createEdgeType(RENDITION_EDGE);
graph.shutdown();
}
}
catch(Exception e) {
e.printStackTrace();
}
 
factory = new OrientGraphFactory(builder.toString(), USERNAME, PASSWORD);
ODatabaseRecordThreadLocal.INSTANCE.set(factory.getDatabase());
}


private Vertex getClientVertex(OrientGraph graph, String guid) {
Vertex clientVertex = null;
Iterable<Vertex> vertices = graph.query().has(GUID_PARAMETER, guid).vertices();
if(vertices.iterator().hasNext()) {
clientVertex = vertices.iterator().next();
}
else {
clientVertex = graph.addVertex("class:Client");
clientVertex.setProperty(GUID_PARAMETER, guid);
graph.commit();
}

return clientVertex;
 
 
public void writeDocument(String filename, Date dateCreated, String category, String guid, byte[] contents, int pageCount, String description, String code, String fiscalYear, boolean 
taxAdministratorsCopy, boolean clientsCopy, boolean archivesCopy, boolean processed) {
OrientGraph graph = factory.getTx();
try {
Vertex clientVertex = getClientVertex(graph, guid);
OrientVertex documentVertex = graph.addVertex("class:Document");
documentVertex.setProperty(FILENAME_PARAMETER, filename);
documentVertex.setProperty(GUID_PARAMETER, guid);
documentVertex.setProperty(CREATION_DATE_PARAMETER, dateCreated);
if(description != null) {
documentVertex.setProperty(DESCRIPTION_PARAMETER, description);
}
documentVertex.setProperty(NUM_PAGES_PARAMETER, pageCount);
documentVertex.setProperty(FISCAL_YEAR_PARAMETER, fiscalYear);
if(category != null) {
documentVertex.setProperty(CATEGORY_PARAMETER, category);
}
if(code != null) {
documentVertex.setProperty(CODE_PARAMETER, code);
}
documentVertex.setProperty(TAX_ADMINISTRATOR_COPY_PARAMETER, taxAdministratorsCopy);
documentVertex.setProperty(CLIENT_COPY_PARAMETER, clientsCopy);
documentVertex.setProperty(ARCHIVE_COPY_PARAMETER, archivesCopy);
documentVertex.setProperty(PROCESSED_PARAMETER, processed);
ORecordBytes record = new ORecordBytes(contents);
record.save();
documentVertex.setProperty(CONTENT_PARAMETER, record.getIdentity());

Object id = documentVertex.getId();
documentVertex = graph.getVertex(id);
graph.addEdge("class:E", clientVertex, documentVertex, OWNS_EDGE);
 
// Thumbnail generation code...

OrientVertex thumbnailVertex = graph.addVertex("class:Thumbnail");
ORecordBytes thumbnailRecord = new ORecordBytes(thumbnail);
thumbnailRecord.save();
thumbnailVertex.setProperty(CONTENT_PARAMETER, thumbnailRecord.getIdentity());

Object thumbnailId = thumbnailVertex.getId();
thumbnailVertex = graph.getVertex(thumbnailId);
graph.addEdge("class:E", documentVertex, thumbnailVertex, RENDITION_EDGE);
}
catch(Exception e) {
e.printStackTrace();
}
graph.shutdown();
}


What am I doing wrong here?

Many thanks for your help, it is much appreciated.

Ivan

Emanuel

unread,
Mar 2, 2015, 10:30:52 AM3/2/15
to orient-...@googlegroups.com
Hi,

Do you see anything on the server log ?
Your session may be killed if something wrong happen server side.

bye
Emanuel
--

---
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-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ivan Jovanovic

unread,
Mar 2, 2015, 11:02:58 AM3/2/15
to orient-...@googlegroups.com
Hi Emanuel,

Thanks for your reply. Unfortunately not, the server log contains nothing useful that I could use to determine what the problem is:

2015-03-02 08:35:44:202 INFO  OrientDB auto-config DISKCACHE=5,582MB (heap=455MB os=8,086MB disk=861,714MB) [orientechnologies]
2015-03-02 08:35:44:204 INFO  Loading configuration from: D:/OrientDB/config/orientdb-server-config.xml... [OServerConfigurationLoaderXml]
2015-03-02 08:35:44:308 INFO  OrientDB Server v2.0.3 (build UNKNOWN@r${buildNumber}; 2015-02-19 23:40:05+0000) is starting up... [OServer]
2015-03-02 08:35:44:319 INFO  Databases directory: D:\OrientDB\databases [OServer]
2015-03-02 08:35:44:341 INFO  Listening binary connections on 0.0.0.0:2424 (protocol v.28, socket=default) [OServerNetworkListener]
2015-03-02 08:35:44:341 INFO  Listening http connections on 0.0.0.0:2480 (protocol v.10, socket=default) [OServerNetworkListener]
2015-03-02 08:35:44:349 INFO  Installing dynamic plugin 'orientdb-lucene-2.0.3-dist.jar'... [OServerPluginManager]
2015-03-02 08:35:44:400 INFO  Lucene index plugin installed and active. Lucene version: LUCENE_47 [OLuceneIndexPlugin]
2015-03-02 08:35:44:401 INFO  Installing dynamic plugin 'studio-2.0.zip'... [OServerPluginManager]
2015-03-02 08:35:44:414 INFO  Installing GREMLIN language v.2.6.0 - graph.pool.max=50 [OGraphServerHandler]
2015-03-02 08:35:44:414 INFO  [OVariableParser.resolveVariables] Error on resolving property: distributed [orientechnologies]
2015-03-02 08:35:44:415 INFO  Installing Script interpreter. WARN: authenticated clients can execute any kind of code into the server by using the following allowed languages: [sql] [OServerSideScriptInterpreter]
2015-03-02 08:35:44:416 INFO  OrientDB Server v2.0.3 is active. [OServer]
2015-03-02 09:05:18:612 SEVERE Internal server error:
com.orientechnologies.orient.core.exception.OQueryParsingException: Error on parsing query at position #8: Error on parsing query
Query:  _studio where type = 'Bookmark' order by name
-------------^
--> com.orientechnologies.orient.core.exception.OCommandExecutionException: Class '_STUDIO' was not found in current database [ONetworkProtocolHttpDb]
2015-03-02 09:49:25:083 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 09:51:26:071 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 09:53:29:329 SEVERE Internal server error:
com.orientechnologies.orient.core.exception.OQueryParsingException: Error on parsing query at position #8: Error on parsing query
Query:  _studio where type = 'Bookmark' order by name
-------------^
--> com.orientechnologies.orient.core.exception.OCommandExecutionException: Class '_STUDIO' was not found in current database [ONetworkProtocolHttpDb]
2015-03-02 09:54:28:703 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 10:00:28:352 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 10:03:21:366 SEVERE Internal server error:
com.orientechnologies.orient.core.exception.OQueryParsingException: Error on parsing query at position #8: Error on parsing query
Query:  _studio where type = 'Bookmark' order by name
-------------^
--> com.orientechnologies.orient.core.exception.OCommandExecutionException: Class '_STUDIO' was not found in current database [ONetworkProtocolHttpDb]
2015-03-02 10:06:53:048 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 10:28:40:195 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 10:51:24:907 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 11:01:08:657 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 11:11:09:096 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 11:23:23:730 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 11:32:06:644 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 11:41:49:432 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 11:59:45:980 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 12:37:45:229 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 12:48:11:563 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 14:23:27:520 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 14:23:27:520 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 14:23:27:521 INFO  {db=attachments} Created database 'attachments' of type 'plocal' [ONetworkProtocolBinary]
2015-03-02 14:23:42:955 INFO  Received signal: SIGINT [OSignalHandler]
2015-03-02 14:23:42:955 INFO  OrientDB Server is shutting down... [OServer]

Those multiple creations of database 'attachments' is me dropping the database and starting from the scratch.

Cheers,
Ivan

Ivan Jovanovic

unread,
Mar 4, 2015, 3:09:25 AM3/4/15
to orient-...@googlegroups.com
By trying to dissect the problem and see what is causing it I was trying different things. 

My application, after each writing of a document, it reads from the database to extract the document information and their counts. If I turn off this reading the document information everything works just like fine.

The relevant code:

private DocumentCounts extractDocumentCounts(String guid, String taxYear, String[] categories) {
int allDocuments = 0;
Map<String, Integer> categoryDocuments = new HashMap<String, Integer>();
try {
for(int i = 0; i < categories.length; i++) {
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();
Long result = resultList.get(0).field("COUNT");
categoryDocuments.put(categories[i], result.intValue());
}

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();
Long result = resultList.get(0).field("COUNT");
allDocuments = result.intValue();
}
catch(Exception e) {
e.printStackTrace();
}

return new DocumentCounts(allDocuments, categoryDocuments);
}

So, somehow, this reading from a database right after something has been written somehow causes this problem (that I am unable to solve).

Anybody has any idea how can I solve this?

Thanks,
Ivan

Ivan Jovanovic

unread,
Mar 5, 2015, 4:44:16 AM3/5/15
to orient-...@googlegroups.com
I have updated to OrientDB 2.0.4 Community Edition and the problem that I am experiencing is still there.

I also did some application profiling to see what is happening. When the application gets stuck, i.e. remote connection to database has been lost, the stack trace from the OrientDB Async Client looks like this:

 OrientDB <- Asynch Client (/127.0.0.1:2424) [RUNNABLE, IN_NATIVE] [DAEMON]
java.io.DataInputStream.readByte()
com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.readByte() OChannelBinary.java:73
com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient.beginResponse(int, long, boolean) OChannelBinaryAsynchClient.java:200
com.orientechnologies.orient.enterprise.channel.binary.OAsynchChannelServiceThread.execute() OAsynchChannelServiceThread.java:50
com.orientechnologies.common.thread.OSoftThread.run() OSoftThread.java:69

Does anyone have any idea how can I overcome this?

Please and thank you,
Ivan

Ivan Jovanovic

unread,
Mar 16, 2015, 4:15:47 AM3/16/15
to orient-...@googlegroups.com
Updated to OrientDB Community Edition 2.0.5, I am still having the same issue.

Any ideas what is up?

Thanks,
Ivan

Colin

unread,
Mar 16, 2015, 11:05:15 AM3/16/15
to orient-...@googlegroups.com
Hi Ivan,

Sorry to see you're still having issues with this.

When you get that "trying to reconnect" warning has the client connection been idle at all during that time?  I believe you said that this happens randomly during a write, correct?

How long does each call to writeDocument typically take to complete?

Also, try adding a call to graph.commit() in writeDocument().  I'm curious if that makes any difference or throws a different exception.

I'm assuming your reconnect warning appears when graph.shutdown() is called.  However, it would be helpful if you could isolate what's being called in writeDocument() when this occurs.

Thanks,

-Colin

Orient Technologies

The Company behind OrientDB

Ivan Jovanovic

unread,
Mar 16, 2015, 12:23:21 PM3/16/15
to orient-...@googlegroups.com
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

Colin

unread,
Mar 16, 2015, 5:23:09 PM3/16/15
to orient-...@googlegroups.com
Hi Ivan,

Thanks for the very thorough test.

You stated "I was able to determine from testing the code many times, the application loses connection mostly on read operations after write operation have completed.", yet in your tests it seems to happen from within the writeDocument() method.  Am I misunderstanding this?

(You are correct that on the call to graph.shutdown() it will call commit().  I had you call it explicitly so that we could capture any exception when it actually attempted to write to the database.)

When this error occurs, do you have to restart the server in order to get the application to work, or do you just re-start the application?

When this error occurs, would you mind trying to connect remotely using the console and see if it communicates successfully?  (I'm assuming it will.)

Thanks,

-Colin

Orient Technologies

The Company behind OrientDB


Ivan Jovanovic

unread,
Mar 17, 2015, 4:28:31 AM3/17/15
to orient-...@googlegroups.com
Hello Colin,

Thanks again for your reply, and for the clarification about the graph.commit() method.

By examining stack traces of these exceptions that I got I can tell that all of them come from reading operations after a write:
- In the 1. run connection is lost when the application is obtaining the total number of documents. 
- In the 2. run exception is thrown when the application is refreshing a document list after a write and loading the first document (ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$2.load(OrientDBDocumentManager.java:1)).
- In the 3. run exception is thrown when the application is refreshing a document list after a write and loading document thumbnails (ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.getThumbnail(OrientDBDocumentManager.java:1370))
- In the 4. run no information is available
- 5. run completed successdully
- In the 6. run no information is available
- In the 7. run exception is thrown when the application is refreshing a document list after a write and loading document thumbnails (ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.getThumbnail(OrientDBDocumentManager.java:1378))

My opinion, that this happens only while performing reading after writing, is backed up by the fact that everything will work like charm if I temporary disable refreshing a document list, loading of thumbnails and extracting the document counts, and leave just the writing part. I was able, from the application, to upload 500 documents in one go, without any problems...

When this error occurs, there are no related information available in the server logs and I do not need to restart the server, only the application. 

And yes, indeed, I was able to connect to a database from a console after a connection has been lost from the application.

Cheers and thanks,
Ivan

Colin

unread,
Mar 17, 2015, 3:09:16 PM3/17/15
to orient-...@googlegroups.com
Hi Ivan,

Thanks, again, for the very precise and detailed reply.

Let's try an experiment for the writing and the reading, would you mind replacing the factory calls to factory.getTx()with the non-factory version:

new OrientGraph(url, user, password)

Please let me know if that changes anything.

Thanks for your patience.

-Colin

Orient Technologies

The Company behind OrientDB



Ivan Jovanovic

unread,
Mar 18, 2015, 10:10:59 AM3/18/15
to orient-...@googlegroups.com
Hi Colin,

That's the least I can do. Thank you for your replies, and for your help and for your time!

I have tried replacing factory.getTx() with directly instantiating an OrientGraph every time that I need it and repeating experiments from yesterday (7 runs, each time uploading 50 documents). Each of these 7 runs completed successfully, without losing connection, which is a move in the right direction. Before, I was able to achieve to upload 50 documents in one go, once or twice in a month period.

For this to work I had, also, to change a call List<ODocument> resultList = factory.getDatabase().command(new OCommandSQL(builder.toString())).execute(); with a call: List<ODocument> resultList = graph.getRawGraph().command(new OCommandSQL(builder.toString())).execute();

However, I tried up-scaling my tests to 500 documents in one go (a test that worked like charm when I turn off reading after writing) and I got different results. The number of documents that I was able to upload in one go has vastly improved when I instantiate a graph instead of getting one from factory, but still I was not able to complete the task. For example, on average, before, the connection was lost after uploading 25-30 documents. 

First, I tried without graph.commit(); that we have added yesterday, and below I present to you the result of these tests:

1. run (successfully uploaded 295 documents): Connection lost, without 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)

2. run (successfully uploaded 295 documents): Connection lost, 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.OStorageException: Error on executing command: sql.SELECT COUNT(*) FROM Document 
WHERE guid='drtax-820a02fc-b450-4ce8-8218-36368f1baec9' AND fiscalyear='2014'
at com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1580)
at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1064)
at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:436)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.extractDocumentCounts
(OrientDBDocumentManager.java:1248)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

3. run (successfully uploaded 330 documents): Connection lost 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.OStorageException: Error on executing command: sql.SELECT COUNT(*) FROM Document WHERE guid='drtax-820a02fc-b450-4ce8-8218-36368f1baec9' AND fiscalyear='2014'
at com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1580)
at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1064)
at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:436)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.extractDocumentCounts
(OrientDBDocumentManager.java:1248)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

4. run (successfully uploaded 75 documents): Connection lost with an error:
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)
Mär 18, 2015 12:39:23 PM com.orientechnologies.common.log.OLogManager log
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:1580)
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.extractDocumentCounts
(OrientDBDocumentManager.java:1261)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

5. run (successfully uploaded 255 documents): Connection lost with an error:
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)
Mär 18, 2015 12:57:02 PM com.orientechnologies.common.log.OLogManager log
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:1580)
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.extractDocumentCounts
(OrientDBDocumentManager.java:1261)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

6. run (successfully uploaded 270 documents): Connection lost 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.OStorageException: Error on executing command: sql.SELECT COUNT(*) FROM Document WHERE guid='drtax-820a02fc-b450-4ce8-8218-36368f1baec9' AND fiscalyear='2014'
at com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1580)
at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1064)
at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:436)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.extractDocumentCounts
(OrientDBDocumentManager.java:1248)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

7. run (successfully uploaded 25 documents): Connection lost with an error:
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)
Mär 18, 2015 1:19:38 PM com.orientechnologies.common.log.OLogManager log
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:1580)
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.extractDocumentCounts
(OrientDBDocumentManager.java:1261)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)
com.google.common.util.concurrent.UncheckedExecutionException: com.orientechnologies.orient.core.exception.OStorageException: 
Cannot create a connection to remote server because url list is empty
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.getDocumentPage
(OrientDBDocumentManager.java:727)
at ch.ringler.attachment.mgm.mediator.internal.DocumentManagerMediatorImpl.getDocumentPageSmallPreview
(DocumentManagerMediatorImpl.java:68)
at ch.ringler.attachment.mgm.module.window.swing.Workbench$AttachmentPagesLoaderWorker.doInBackground
(Workbench.java:1140)
at ch.ringler.attachment.mgm.module.window.swing.Workbench$AttachmentPagesLoaderWorker.doInBackground
(Workbench.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: 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.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:1824)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:181)
at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:102)
at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:98)
at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:96)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$2.load
(OrientDBDocumentManager.java:236)
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)
... 13 more


Furthermore, in order to obtain more information, I have repeated these tests, this time with call graph.shutdown(); inside writeDocument method. Results are below:

1. run (successfully uploaded 20 documents): Connection lost without 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)

2. run (successfully uploaded 75 documents): Connection lost 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.OStorageException: Error on executing command: sql.SELECT COUNT(*) FROM Document WHERE guid='drtax-820a02fc-b450-4ce8-8218-36368f1baec9' AND fiscalyear='2014' AND category LIKE '%ah398jigonp0%'
at com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1580)
at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1064)
at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:436)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.extractDocumentCounts
(OrientDBDocumentManager.java:1233)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

3. run (successfully uploaded 345 documents): Connection lost after uploading 300 documents, it was re-acquired transparently and was, again lost, after uploading 45 documents more with an exception. This was the first time I got this kind of behaviour:
WARNUNG: Caught I/O errors from Not connected (local socket=?), trying to reconnect (error: java.io.IOException: Channel is closed)
Mär 18, 2015 10:33:51 AM com.orientechnologies.common.log.OLogManager log
WARNUNG: Connection re-acquired transparently after 15ms and 1 retries to server '127.0.0.1:2424/attachments': no errors will be thrown at application level
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:3 (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:1429)
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:942)
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:3
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 (successfully uploaded 30 documents): Connection lost with an error:
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)
Mär 18, 2015 10:41:16 AM com.orientechnologies.common.log.OLogManager log
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:1580)
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.extractDocumentCounts
(OrientDBDocumentManager.java:1261)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

5. run (successfully uploaded 195 documents): Connection lost with an error:
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)
Mär 18, 2015 10:52:10 AM com.orientechnologies.common.log.OLogManager log
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:1580)
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.extractDocumentCounts
(OrientDBDocumentManager.java:1261)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

6. run (successfully uploaded 30 documents): Connection lost 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.OStorageException: Error on executing command: sql.SELECT COUNT(*) FROM Document WHERE guid='drtax-820a02fc-b450-4ce8-8218-36368f1baec9' AND fiscalyear='2014' AND category LIKE '%lazqwz7d1vip%'
at com.orientechnologies.orient.client.remote.OStorageRemote.handleException(OStorageRemote.java:1580)
at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1064)
at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:436)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:63)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.extractDocumentCounts
(OrientDBDocumentManager.java:1233)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager.access$15
(OrientDBDocumentManager.java:1212)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1280)
at ch.ringler.attachment.mgm.document.manager.internal.OrientDBDocumentManager$11.call
(OrientDBDocumentManager.java:1)
at java.util.concurrent.FutureTask.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)

7. run (successfully uploaded 245 documents): Connection lost, without 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)

I will continue experimenting to try figuring out what is going on. What else can I try?

Thanks again and cheers,
Ivan

Colin

unread,
Mar 18, 2015, 2:42:49 PM3/18/15
to orient-...@googlegroups.com
Hi Ivan,

Interesting findings!

Would you object to sending me your code (privately), so I can look over both the reading and the writing implementation?

Thanks!

-Colin

Orient Technologies

The Company behind OrientDB


...

Ivan Jovanovic

unread,
Mar 19, 2015, 12:10:30 PM3/19/15
to orient-...@googlegroups.com
Hello Colin,

Thanks again for your reply and your time!

By preparing a code snippet to send it to you, I started commenting the code to explain what particular pieces of code are meant to do. While doing so, I realized what the problem was! During all this time I failed to see that the problem was in a big picture itself, and not in those three, four, methods that perform writing and reading from a graph database. 

The problem in fact was in a specific order of execution. Those two operations, reading and writing (in a form of three methods writeDocument, readAllDocuments, extractDocumentCounts) were executed by a dedicated thread, in order no to freeze the UI which was handled by the main thread. Often, multiple requests to write to a database and read from it, came simultaneously (after writing a document there happens a refresh of the document list, thus write request was always followed by a read request). Since it made no sense to complete the read operation if a request to write just got received (since another read request is coming right after it), I was canceling the execution of that reading operation by the thread. Only today I realized that, by doing so, I was not shutting down the initialized graph instance, and that could cause the behavior that I was experiencing. 

When I fixed that, everything went smoothly, all 500 documents written (in multiple tests) without any problems or losing connection.

How do I mark this topic as solved? :)

Thanks again for your time!

Cheers,
Ivan

Colin

unread,
Mar 20, 2015, 10:03:51 AM3/20/15
to orient-...@googlegroups.com
Hi Ivan,

That's great to hear that you solved it!

I believe, if your permissions are right, there should be a "Mark as Complete" button at the very end of the post you can click.

Good luck!

-Colin

Orient Technologies

The Company behind OrientDB


Reply all
Reply to author
Forward
0 new messages