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

hydra-router require guarantee of running node during route match #86

Open
jkyberneees opened this issue Apr 19, 2017 · 8 comments
Open

Comments

@jkyberneees
Copy link

The router seems to be accepting the first URL match without guarantee that such service have a running node instance. In my case I just started a hapi-service-test service and the response from the router is this:

{
 "statusCode": 503,
 "statusMessage": "Service Unavailable",
 "statusDescription": "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay",
 "result": {
   "reason": "HR: [ol0r2s8oml] Unavailable express-service-test instances"
 },
 "tracer": "ol0r2s8oml"
}

Meaning that the hydra-router is considering old routes from the express-service-test service that I have ran in the past.

Regards, Rolando

@cjus
Copy link
Contributor

cjus commented Apr 19, 2017

@jkyberneees on startup, your hapi-service-test should have sent a message to hydra-router with its updated routes.

@jkyberneees
Copy link
Author

Hi @cjus, it does it. However the issue appears when multiple services have registered the same route.
IMO the router should decide for the service that match the route but also is online.

@cjus
Copy link
Contributor

cjus commented Apr 27, 2017

@jkyberneees I looked into this. I don't see a way to address it. I think it's up to the service builder to ensure that routes are not reused by other services. Meaning two different services should not both register v1/{serviceName}/endpoint. I also think that service registries have to expire at some point. Perhaps a router that ends up with a 503 might flush the service registry or perhaps a Lua script in Redis.

@jkyberneees
Copy link
Author

Hi @cjus, I can suggest you to check for service presence before accept the route match.
You can see an example here: https://github.com/jkyberneees/hydra-plugin-http/blob/master/libs/proxy.js#L35
I agree on the flush of the routes if 503 is detected, that would keep the router more performant and consistent.

Regards.

@arn-the-long-beard
Copy link

Hello
This discussion is old, but I have the same issue with hydra-router.

I used the different command for clean and refresh:
hydra-cli refresh
hydra-cli refresh node list

but hydra-cli routes show me the old dead services and then hydra-router cannot work correctly.

Is it something I am missing for cleaning/refresh ?

@cjus
Copy link
Contributor

cjus commented Mar 6, 2018

@arn-the-long-beard which version of hydra-cli are you using? How comfortable are you with Redis? Is this happening locally or on a production server?

@arn-the-long-beard
Copy link

Hello @cjus :)

I am using hydra-cli@1.5.5

For now this is happening locally. I am a very newbie to Hydra and Redis also. I am building micro services for a distributed system for the startup I am working.

@emirhg
Copy link

emirhg commented Nov 5, 2019

Same problem here. I'm using hydra-cli@1.6.0

hydra-cli refresh and hydra-cli refresh node listkeeps old routes, is not cleaning properly

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

4 participants