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

Bug: Close socket connection takes ~5s #129

Open
2 tasks done
dormammun opened this issue Jun 15, 2023 · 1 comment
Open
2 tasks done

Bug: Close socket connection takes ~5s #129

dormammun opened this issue Jun 15, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@dormammun
Copy link

dormammun commented Jun 15, 2023

Describe the bug

I use built-in authentication and create a connection for each user. After the request is done, I close the connection.
Issue that when I close connection it takes ~5s, so I forced to skip Promise from the close function. In case if I don't close the connection, every request will create a new connection and they will spawn memory leaks.

Test:

  const connectionIsOpen = provider.status === 0
  if (connectionIsOpen) {
    console.time('close')
    await provider.close() // takes ~5s on await
    console.timeEnd('close')
  }

Output:

close: 4.993s

Is this desirable behavior?

Steps to reproduce

You can use simple code:

const db = new Surreal("http://localhost:8000");
await db.query(`
   SELECT ->fights.out.hero_link as out FROM hero:mr_andersen FETCH out;
`)

console.time('close')
await db.close()
console.timeEnd('close')

Expected behaviour

Can it be as fast as an open connection?

SurrealDB version

1.0.0-beta.9+20230402.5eafebd for linux on x86_64

Contact Details

khoteiv.dev@gmail.com

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@dormammun dormammun added the bug Something isn't working label Jun 15, 2023
@kearfy kearfy transferred this issue from surrealdb/surrealdb Jun 15, 2023
@kearfy
Copy link
Member

kearfy commented Jun 15, 2023

Interestingly enough, this differs per runtime. It's fast on Deno but slower on node and bun is another story. Haven't properly looked into it just yet but I've seen similar cases online

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants