Skip to content

Running queries ocassionally causes ArcadeDB to get stuck at 100% CPU usage #846

Closed

Description

@shasaur

ArcadeDB Version: ArcadeDB Server v23.1.1 (build aa687e4/1673895089679/main)

JDK Version: OpenJDK (zsrc11.54.25-jdk11.0.14.1) [I think]

OS: Windows 11 Home (21H2)

Sometimes when I run a cypher query or perhaps just connect / disconnect from the database, the CPU usage increases to 100% and gets stuck there. It stays at 100% even when I am not running any queries.

I don't know what causes it to happen as sometimes I can do a lot of queries without this happening, and sometimes after the first few seconds of queries it gets stuck.

My guess would be that there is something accidentally jumps into a 'busy wait' mode where it gets stuck checking something in an infinite for loop. Would be really nice to have a fix for this.

Activity

  1. changed the title [-]Running queries ocassionally causes 100% CPU usage[/-] [+]Running queries ocassionally causes ArcadeDB to get stuck at 100% CPU usage[/+] on Feb 8, 2023
  2. self-assigned this
    on Feb 8, 2023
  3. lvca commented on Feb 8, 2023

    @lvca
    Member

    Are you using the setting -Darcadedb.profile=high-performance or -Darcadedb.asyncOperationsQueueImpl=fast?

  4. added
    question
    on Feb 8, 2023
  5. lvca commented on Feb 8, 2023

    @lvca
    Member

    Or are you running o Docker? We have another issue about that.

  6. shasaur commented on Feb 8, 2023

    @shasaur
    ContributorAuthor

    I'm not using any special setting (as far as I know), just running server.bat. So I just tested about half an hour of production usage, and it did not seem to happen. However, I think I closed it during a running transaction and it shot up to 70% and got stuck there.

    Could it be happening when connections are closed during running transactions or something like that?

  7. shasaur commented on Feb 8, 2023

    @shasaur
    ContributorAuthor

    Oh actually, the only thing is that I'm using the Postgres plug-in. And no, I'm not using Docker.

  8. lvca commented on Feb 8, 2023

    @lvca
    Member

    This was never found in production, AFAIK, so it could be the Postgres plugin. Is there any chance you can do a dump of the JVM when that happens? You can execute a jstack <pid>.

  9. added and removed
    question
    on Feb 8, 2023
  10. added this to the 23.2.1 milestone on Feb 8, 2023
  11. shasaur commented on Feb 8, 2023

    @shasaur
    ContributorAuthor

    Done! Here's the JVM dump and also the console output of the DB.

  12. shasaur commented on Feb 8, 2023

    @shasaur
    ContributorAuthor

    Also just a note, now that (I think) it's happening only between connections, it's not super high priority for me as my use is based only on a single connection. Though I leave this prioritisation up to you.

  13. lvca commented on Feb 9, 2023

    @lvca
    Member

    Thanks for the dump! The issue seems to be in the postgres threads:

    "ArcadeDB-postgres//0:0:0:0:0:0:0:1" #56 prio=5 os_prio=0 cpu=189828.13ms elapsed=239.99s tid=0x000002832c484000 nid=0x5d5c runnable  [0x000000e2f3fff000]
       java.lang.Thread.State: RUNNABLE
    	at java.lang.Throwable.fillInStackTrace(java.base@11.0.14.1/Native Method)
    	at java.lang.Throwable.fillInStackTrace(java.base@11.0.14.1/Throwable.java:787)
    	- locked <0x0000000722b90c40> (a java.io.EOFException)
    	at java.lang.Throwable.<init>(java.base@11.0.14.1/Throwable.java:255)
    	at java.lang.Exception.<init>(java.base@11.0.14.1/Exception.java:54)
    	at java.io.IOException.<init>(java.base@11.0.14.1/IOException.java:47)
    	at java.io.EOFException.<init>(java.base@11.0.14.1/EOFException.java:50)
    	at java.io.DataInputStream.readUnsignedByte(java.base@11.0.14.1/DataInputStream.java:295)
    	at com.arcadedb.network.binary.ChannelBinary.readUnsignedByte(ChannelBinary.java:87)
    	at com.arcadedb.postgres.PostgresNetworkExecutor.readNextByte(PostgresNetworkExecutor.java:994)
    	at com.arcadedb.postgres.PostgresNetworkExecutor.readMessage(PostgresNetworkExecutor.java:953)
    	at com.arcadedb.postgres.PostgresNetworkExecutor.run(PostgresNetworkExecutor.java:140)
    

    The reading from the TCP/IP socket causes tons of exceptions. Checking on it.

  14. lvca commented on Feb 9, 2023

    @lvca
    Member

    Do you have any idea why a client is opening so many connections to the server?

    2023-02-08 22:20:22.415 SEVER [PostgresNetworkExecutor] Closing connection with client
    2023-02-08 22:20:22.418 SEVER [PostgresNetworkExecutor] Closing connection with client
    2023-02-08 22:20:22.425 SEVER [PostgresNetworkExecutor] Closing connection with client
    2023-02-08 22:20:22.426 SEVER [PostgresNetworkExecutor] Closing connection with client
    2023-02-08 22:20:22.427 SEVER [PostgresNetworkExecutor] Closing connection with client
    
  15. lvca commented on Feb 9, 2023

    @lvca
    Member

    Ok, thanks to your files I was able to understand the issue (almost sure). The EOFException from the socket was not managed properly. Please let me know if you see this happening again. Thanks again for the detailed report!

  16. shasaur commented on Feb 9, 2023

    @shasaur
    ContributorAuthor

    Okay great! Nice to see it fixed so quickly. This will help a lot when I run tests as I open a lot of connections then.

  17. LLuke commented on Nov 17, 2023

    @LLuke
    Contributor

    I noticed this too as I started to play with arcadedb 23.10.1 yesterday sporadically with python postgres drivers. This is just a heads up and I will provide the dump here next time it happens. Please also let us know whether we should run it in debug mode (and detailed instruction to make it reproducible if applicable).

    BTW, setting

    -XX:ActiveProcessorCount=1

    with OpenJDK 64-Bit Server VM 11.0.10 (Zulu11.45+27-CA) didn't help. for this scenario. I also noticed that there doesn't seem to be a more graceful shutdown instruction except interrupting the batch file with Ctrl-C or otherwise kill the Java process.

    Ok, thanks to your files I was able to understand the issue (almost sure). The EOFException from the socket was not managed properly. Please let me know if you see this happening again. Thanks again for the detailed report!

  18. lvca commented on Nov 17, 2023

    @lvca
    Member

    @LLuke it would be awesome if you could produce a stack trace ;-)

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions