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

Getting heap memory issue for the count query. #10021

Closed
Aniket-Lonare opened this issue Aug 29, 2023 · 5 comments
Closed

Getting heap memory issue for the count query. #10021

Aniket-Lonare opened this issue Aug 29, 2023 · 5 comments
Milestone

Comments

@Aniket-Lonare
Copy link

OrientDB Version: 3.2.22

Java Version: jdk11

OS: Linux ( Docker image)

Expected behavior

Should return the single record with the count number.

Actual behavior

Return multiple records according to the limit provided. If a limit is not provided then gives heap memory issues.

Steps to reproduce

We have a class named "Objects" with three properties: ID, Name, and Searchable. Indexes have been created for both the "Name" and "Searchable" properties as shown below:
Index for "Name" property:
CREATE INDEX Objects.Name ON Objects (Name) UNIQUE_HASH_INDEX ENGINE HASH_INDEX
Index for "Searchable" property:
CREATE INDEX Objects.Searchable ON Objects (Searchable) NOTUNIQUE_HASH_INDEX ENGINE HASH_INDEX
issue_image_5
After that, we created some records in the database.
Running the below query we are getting count results in multiple records as shown in the image.

SELECT count(*) from Objects where Searchable = true
image

This is explain view of the same query.
issue_image_2
If we run the query using orientjs(Without passing the limit) then it give us heap memory issue as shown below.

java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid1.hprof ...
Heap dump file created [3286284170 bytes in 26.841 secs]
2023-08-28 12:44:40:095 INFO  Storage 'plocal:/orientdb/databases/SampleDB' is opened under OrientDB distribution : 3.2.22 (build ${buildNumber}, branch 3.2.22-without-embedded-validation) [OEnterpriseLocalPaginatedStorage]
2023-08-28 12:48:38:244 SEVER Error during WAL writing [CASDiskWriteAheadLog$RecordsWriter]
java.lang.OutOfMemoryError: Java heap space
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.cas.CASDiskWriteAheadLog$RecordsWriter.run(CASDiskWriteAheadLog.java:1655)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)   

 

2023-08-28 12:48:38:268 SEVER Exception in thread 'OrientDB Write Cache Flush Task' [OScheduledThreadPoolExecutorWithLogging]
java.lang.OutOfMemoryError: Java heap space

 

2023-08-28 12:48:38:268 SEVER Uncaught exception in thread OrientDB (/172.26.0.7:2424) <- BinaryClient (/172.26.0.9:46822) [OUncaughtExceptionHandler]
java.lang.OutOfMemoryError: Java heap space

 

2023-08-28 12:48:38:271 SEVER Exception in thread 'OrientDB WAL Flush Task' [OScheduledThreadPoolExecutorWithLogging]
java.lang.OutOfMemoryError: Java heap space
        at com.orientechnologies.orient.core.storage.impl.local.paginated.wal.cas.CASDiskWriteAheadLog$RecordsWriter.run(CASDiskWriteAheadLog.java:1655)        
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

If we run the query without * or Adding any other property like ID we are getting results as expected as shown below images.

issue_image_3
issue_image_4
issue_image_6

If we delete the index then we are getting results as expected.
issue_image_7
issue_image_8

In this scenario is there an index creation issue?
Please let me know if any additional information is needed to investigate this issue.

Thank you.

@tglman tglman added this to the 3.2.x milestone Aug 29, 2023
@tglman
Copy link
Member

tglman commented Aug 31, 2023

Hi,

I tried to reproduce this case without any success, also your explain looks a bit strange to me, OrientDB has multiple steps usually like the CALCULATE PROJECTIONS you see in the second explain, not sure how can you make that explain.

@tglman
Copy link
Member

tglman commented Sep 14, 2023

Hi,

I could reproduce this with a unit test and fix it, will be released next hotfix.

Regards

@tglman tglman modified the milestones: 3.2.x, 3.2.23 Sep 14, 2023
@Aniket-Lonare
Copy link
Author

Okay, Thank you

@tglman
Copy link
Member

tglman commented Sep 21, 2023

Hi,

The release 3.2.23 is out, will close this, please re-open if you still experience similar problem.

Regards

@tglman tglman closed this as completed Sep 21, 2023
@Aniket-Lonare
Copy link
Author

It's resolved in 3.2.23, Thank you

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

No branches or pull requests

2 participants