Repository navigation
Description
ArcadeDB Version: v22.12.1-SNAPSHOT
JDK Version: openjdk 11.0.17 2022-10-18
OS: Ubuntu 22.04.1 LTS
Expected behavior
Even with low-ram profile (128mb ram or lower) I expect to import any database if I have enough space on my disk.
Actual behavior
java.lang.OutOfMemoryError (java heap space)
`
2022-12-14 10:50:15.027 INFO [ArcadeDBServer] <ArcadeDB_0> ArcadeDB Server v22.12.1-SNAPSHOT (build 81566f3/1670890687610/main) is starting up...
2022-12-14 10:50:15.029 INFO [ArcadeDBServer] <ArcadeDB_0> Starting ArcadeDB Server with plugins [Redis, MongoDB, Postgres, GremlinServer] ...
2022-12-14 10:50:15.051 INFO [ArcadeDBServer] <ArcadeDB_0> - JMX Metrics Started...
2022-12-14 10:50:15.090 INFO [ServerSecurity] <ArcadeDB_0> Creating root user with the provided password
2022-12-14 10:50:15.224 INFO [ArcadeDBServer] <ArcadeDB_0> Creating default database 'Imported'...
2022-12-14 10:50:15.391 INFO [SourceDiscovery] <ArcadeDB_0> Analyzing url: https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz...
2022-12-14 10:50:16.343 INFO [SourceDiscovery] <ArcadeDB_0> Recognized format OrientDB (parsingLimitBytes=9.54MB parsingLimitEntries=0)
Importing OrientDB database from stream to './databases/Imported'
Creation of the schema: types, properties and indexes
- Created type 'V' with the following properties {}
- Created type 'Beer' with the following properties {id=INTEGER}
- Created type 'Brewery' with the following properties {id=INTEGER}
- Created type 'Category' with the following properties {id=INTEGER}
- Created type 'E' with the following properties {}
- Created type 'HasBrewery' with the following properties {}
- Created type 'HasCategory' with the following properties {}
- Created type 'HasStyle' with the following properties {}
- Created type 'Style' with the following properties {id=INTEGER}
- Created index UNIQUE on Beer[id]
- Created index UNIQUE on Brewery[id]
- Created index UNIQUE on Style[id]
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid1.hprof ...
Heap dump file created [81224816 bytes in 0.106 secs] - Status update: parsed 0 (0/sec) - 0 documents (0/sec) - 0 vertices (0/sec) - 0 edges (0/sec) - 0 skipped edges - 0 linked edges (0/sec - 0%)
2022-12-14 10:50:16.344 INFO [Importer] <ArcadeDB_0> Checking schema...Exception in thread "main" com.arcadedb.exception.CommandExecutionException: Error on importing database
at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:70)
at com.arcadedb.query.sql.executor.SingleOpExecutionPlan.executeInternal(SingleOpExecutionPlan.java:115)
at com.arcadedb.query.sql.parser.SimpleExecStatement.execute(SimpleExecStatement.java:56)
at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:82)
at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:66)
at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:88)
at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1223)
at com.arcadedb.server.ArcadeDBServer.loadDefaultDatabases(ArcadeDBServer.java:468)
at com.arcadedb.server.ArcadeDBServer.start(ArcadeDBServer.java:130)
at com.arcadedb.server.ArcadeDBServer.main(ArcadeDBServer.java:91)
Caused by: com.arcadedb.integration.importer.ImportException: Error on parsing source 'https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz (compressed=true size=1085781)'
at com.arcadedb.integration.importer.Importer.load(Importer.java:62)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:65)
... 9 more
Caused by: com.arcadedb.index.IndexException: Error on creating index on type 'Category', properties [id]
at com.arcadedb.schema.EmbeddedSchema.createTypeIndex(EmbeddedSchema.java:506)
at com.arcadedb.schema.EmbeddedSchema.getOrCreateTypeIndex(EmbeddedSchema.java:541)
at com.arcadedb.integration.importer.OrientDBImporter.parseIndexes(OrientDBImporter.java:772)
at com.arcadedb.integration.importer.OrientDBImporter.createRecord(OrientDBImporter.java:424)
at com.arcadedb.integration.importer.OrientDBImporter.createRecords(OrientDBImporter.java:384)
at com.arcadedb.integration.importer.OrientDBImporter.parseRecords(OrientDBImporter.java:333)
at com.arcadedb.integration.importer.OrientDBImporter.parseInputFile(OrientDBImporter.java:286)
at com.arcadedb.integration.importer.OrientDBImporter.run(OrientDBImporter.java:175)
at com.arcadedb.integration.importer.format.OrientDBImporterFormat.load(OrientDBImporterFormat.java:48)
at com.arcadedb.integration.importer.Importer.loadFromSource(Importer.java:90)
at com.arcadedb.integration.importer.Importer.load(Importer.java:53)
... 14 more
Caused by: com.arcadedb.exception.DatabaseOperationException: Error during read lock
at com.arcadedb.database.EmbeddedDatabase.executeInReadLock(EmbeddedDatabase.java:1357)
at com.arcadedb.database.EmbeddedDatabase.commit(EmbeddedDatabase.java:359)
at com.arcadedb.database.EmbeddedDatabase.transaction(EmbeddedDatabase.java:998)
at com.arcadedb.schema.EmbeddedSchema.lambda$createTypeIndex$4(EmbeddedSchema.java:484)
at com.arcadedb.database.EmbeddedDatabase.executeInWriteLock(EmbeddedDatabase.java:1372)
at com.arcadedb.database.EmbeddedDatabase.recordFileChanges(EmbeddedDatabase.java:1392)
at com.arcadedb.schema.EmbeddedSchema.recordFileChanges(EmbeddedSchema.java:1370)
at com.arcadedb.schema.EmbeddedSchema.createTypeIndex(EmbeddedSchema.java:483)
... 24 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at com.arcadedb.database.Binary.(Binary.java:64)
at com.arcadedb.database.Binary.(Binary.java:71)
at com.arcadedb.engine.WALFile.writeTransactionToBuffer(WALFile.java:237)
at com.arcadedb.engine.TransactionManager.createTransactionBuffer(TransactionManager.java:138)
at com.arcadedb.database.TransactionContext.commit1stPhase(TransactionContext.java:507)
at com.arcadedb.database.TransactionContext.commit(TransactionContext.java:114)
at com.arcadedb.database.EmbeddedDatabase.lambda$commit$2(EmbeddedDatabase.java:364)
at com.arcadedb.database.EmbeddedDatabase$$Lambda$111/0x0000000840128c40.call(Unknown Source)
at com.arcadedb.database.EmbeddedDatabase.executeInReadLock(EmbeddedDatabase.java:1346)
at com.arcadedb.database.EmbeddedDatabase.commit(EmbeddedDatabase.java:359)
at com.arcadedb.database.EmbeddedDatabase.transaction(EmbeddedDatabase.java:998)
at com.arcadedb.schema.EmbeddedSchema.lambda$createTypeIndex$4(EmbeddedSchema.java:484)
at com.arcadedb.schema.EmbeddedSchema$$Lambda$156/0x0000000840207840.call(Unknown Source)
at com.arcadedb.database.EmbeddedDatabase.executeInWriteLock(EmbeddedDatabase.java:1372)
at com.arcadedb.database.EmbeddedDatabase.recordFileChanges(EmbeddedDatabase.java:1392)
at com.arcadedb.schema.EmbeddedSchema.recordFileChanges(EmbeddedSchema.java:1370)
at com.arcadedb.schema.EmbeddedSchema.createTypeIndex(EmbeddedSchema.java:483)
at com.arcadedb.schema.EmbeddedSchema.getOrCreateTypeIndex(EmbeddedSchema.java:541)
at com.arcadedb.integration.importer.OrientDBImporter.parseIndexes(OrientDBImporter.java:772)
at com.arcadedb.integration.importer.OrientDBImporter.createRecord(OrientDBImporter.java:424)
at com.arcadedb.integration.importer.OrientDBImporter.createRecords(OrientDBImporter.java:384)
at com.arcadedb.integration.importer.OrientDBImporter.parseRecords(OrientDBImporter.java:333)
at com.arcadedb.integration.importer.OrientDBImporter.parseInputFile(OrientDBImporter.java:286)
at com.arcadedb.integration.importer.OrientDBImporter.run(OrientDBImporter.java:175)
at com.arcadedb.integration.importer.format.OrientDBImporterFormat.load(OrientDBImporterFormat.java:48)
at com.arcadedb.integration.importer.Importer.loadFromSource(Importer.java:90)
at com.arcadedb.integration.importer.Importer.load(Importer.java:53)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:65)
`
Steps to reproduce
docker run -d --rm -p 2480:2480 -p 2424:2424 -p 6379:6379 -p 5432:5432 -p 8182:8182 \
--name arcadedb \
--env ARCADEDB_OPTS_MEMORY="-Xms128M -Xmx128M" \
--env JAVA_OPTS="-Darcadedb.server.rootPassword=playwithdata \
-Darcadedb.profile=low-ram \
-Darcadedb.server.defaultDatabases=Imported[root]{import:https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz} \
-Darcadedb.server.plugins=Redis:com.arcadedb.redis.RedisProtocolPlugin,MongoDB:com.arcadedb.mongo.MongoDBProtocolPlugin,Postgres:com.arcadedb.postgres.PostgresProtocolPlugin,GremlinServer:com.arcadedb.server.gremlin.GremlinServerPlugin " \
arcadedata/arcadedb:latestI tried with some tuning like the following, without success:
-Darcadedb.sqlStatementCache=10 \
-Darcadedb.freePageRAM=100 \
-Darcadedb.indexCompactionRAM=1 \
-Darcadedb.maxPageRAM=1024 \I tried even without defaultDatabases and with import database https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz after the startup of the server.
Thank you
Activity
[-]Cannot import database in low-profile mode[/-][+]Cannot import database in low-ram profile[/+]lvca commentedon Dec 14, 2022
With such low RAM, please try with
commitEveryequals to 50 or less:https://docs.arcadedb.com/#_additional-settings
retaggi commentedon Dec 15, 2022
i tried with
and
with the same issue
I think that the problem is that, before the parsing of the data, the OpenBeer.gz is fully loaded in RAM and if there is no space, it just raise the OutOfMemoryError exception. I think its missing some logic to chunk the OpenBeer.gz
lvca commentedon Dec 15, 2022
This is the main loop:
The input file is read byte per byte and as soon as a record is completed it's imported. So the whole file is not read in RAM first. How much heap memory to the JVM?
lvca commentedon Jan 4, 2023
Closing the issue because no answer was received.
chore(deps-dev): bump org.codehaus.mojo:license-maven-plugin from 2.4…
chore(deps-dev): bump org.codehaus.mojo:license-maven-plugin from 2.4…
chore(deps): bump io.github.jbellis:jvector from 4.0.0-rc.8-hf1 to 4.…