Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: Out-of-memory when CREATE EDGE ... IF NOT EXISTS for existing edges with array of destination vertices #1763

Open
gramian opened this issue Oct 18, 2024 · 1 comment

Comments

@gramian
Copy link
Collaborator

gramian commented Oct 18, 2024

ArcadeDB Version:

ArcadeDB Server v24.11.1-SNAPSHOT (build 4207821d055e37cbd74b76683e45073da759c2de/1729083296142/console)

OS and JDK Version:

Running on Mac OS X 12.7.6 - OpenJDK 64-Bit Server VM 17.0.12 (Homebrew)

When creating edges that already exists with the suffix IF NOT EXISTS and the destinition (TO part) is an array, then an out-of-memory error happens after some time.

Expected behavior

No out-of-memory (OOM) error.

Actual behavior

Error on command execution (PostCommandHandler)
java.lang.OutOfMemoryError: Java heap space

or:

Error on command execution (PostCommandHandler)
java.lang.OutOfMemoryError: Java heap space
	at java.base/java.util.Arrays.copyOf(Arrays.java:3481)
	at java.base/java.util.ArrayList.grow(ArrayList.java:237)
	at java.base/java.util.ArrayList.grow(ArrayList.java:244)
	at java.base/java.util.ArrayList.add(ArrayList.java:454)
	at java.base/java.util.ArrayList.add(ArrayList.java:467)
	at com.arcadedb.query.sql.executor.InsertExecutionPlan.executeInternal(InsertExecutionPlan.java:67)
	at com.arcadedb.query.sql.executor.ScriptLineStep.syncPull(ScriptLineStep.java:48)
	at com.arcadedb.query.sql.executor.ScriptExecutionPlan.doExecute(ScriptExecutionPlan.java:101)
	at com.arcadedb.query.sql.executor.ScriptExecutionPlan.fetchNext(ScriptExecutionPlan.java:62)
	at com.arcadedb.query.sql.parser.LocalResultSet.fetchNext(LocalResultSet.java:44)
	at com.arcadedb.query.sql.parser.LocalResultSet.<init>(LocalResultSet.java:40)
	at com.arcadedb.query.sql.SQLScriptQueryEngine.executeInternal(SQLScriptQueryEngine.java:218)
	at com.arcadedb.query.sql.SQLScriptQueryEngine.command(SQLScriptQueryEngine.java:108)
	at com.arcadedb.database.LocalDatabase.command(LocalDatabase.java:1348)
	at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:472)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:134)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:113)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:100)
	at com.arcadedb.server.http.handler.AbstractServerHttpHandler.handleRequest(AbstractServerHttpHandler.java:127)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:395)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
	at java.base/java.lang.Thread.run(Thread.java:840)

Steps to reproduce

  1. Create vertex and edge types
CREATE VERTEX TYPE vex;
CREATE EDGE TYPE edg;
  1. Add some vertices
CREATE VERTEX vex;
CREATE VERTEX vex;
CREATE VERTEX vex;
  1. Add new edges
CREATE EDGE edg FROM #1:0 TO [#4:0,#7:0]
  1. Try add same edges again with IF NOT EXISTS
CREATE EDGE edg FROM #1:0 TO [#4:0,#7:0] IF NOT EXISTS

This last statement causes the OOM error.

@lvca
Copy link
Contributor

lvca commented Oct 18, 2024

That's pretty awful, I'll look it up asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants