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

Websocket connection disconnet, Neptune limitation for IAM Authentication enabled #14

Open
priyabratap opened this issue Feb 27, 2021 · 5 comments

Comments

@priyabratap
Copy link

First of all, I would like to thank you for the beautiful wrapper connection with IAM authenitcation.

There is an AWS neptune limitation :
When IAM authentication is enabled, a WebSocket connection is always disconnected a few minutes more than 10 days after it was established, if it hasn't already been closed by then.

I saw there is one option to enable autoReconnect with a maxRetry (default is 10). Once we reached maxRetry then because of the Neptune Limitation, the connection will be disconnected after 10days.

Very high level, I can think about a solution to make the autoReconnect a default option in case of _closeHandler. Additionally, we can log the _closeHandler behaviour to know about the timing of disconnect exactly after 10days or not.

Love to hear a better solution to address the above issue. Also, I am very interested to contribute here.

@fabrice404
Copy link
Member

Hi @priyabratap, thank you for your comment.

The autoReconnect option should already work as you describe, when the socket is closed, the _closeHandler event is triggered, and a connection attempt is made.

  • If the connection fails, _statusCallback event is called with an error, so it will call the _errorHandler, and the connection will be retried while the try value is lower than maxRetry.
  • If the connection succeed, the try value is reset to 0 (L86), and so on the next disconnection it will retry maxRetry times.

Did you encounter a case that doesn't work like described above? I'd be happy to help you solve your issue.

Also, if you wish to contribute more, you can suggest any pull request or issue, Just please follow the code of conduct

@priyabratap
Copy link
Author

priyabratap commented Feb 27, 2021

Hi @fabrice404 , thank you for the detailed clarification and I got it.

Two generic queries,

  1. Can I go for Singleton Pattern to Create a GraphDBAdapter for my application?
  2. In my case, the dev/testing env does not require IAM Authentication and it's required for Production only. To solve this case Can we have some option to toggle IAM authentication to use or not? (Solution I can think about to add some cond in my code to use gremlin.driver.RemoteConnection directly)

@fabrice404
Copy link
Member

  1. Yes you can totally use the singleton pattern, that's how I use it.
  2. Disabling the IAM authentication seems a bit strange as the main purpose of this project is to provide IAM authentication. I would personally recommend your pre-production clusters to match the configuration of your production cluster, but the solution you suggest would work, although you won't have the same code executed in pre-prod and in prod.

@priyabratap
Copy link
Author

Thanks @fabrice404
Now we can close this.

@priyabratap
Copy link
Author

Hi @fabrice404

Do you have the typescript support of it? currently, I have installed this one npm install --save @types/gremlin

@priyabratap priyabratap reopened this Mar 1, 2021
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