schema-registry icon indicating copy to clipboard operation
schema-registry copied to clipboard

failover issue with schema-registry behind reverse proxy

Open emasab opened this issue 7 years ago • 4 comments

Hi, I've noticed that when the schema registry is behind a reverse proxy like nginx and we have configured multiple schema registry url like

schema.registry.url=http://x.x.x.1/api/schema-registry/,http://x.x.x.2/api/schema-registry/,http://x.x.x.3/api/schema-registry/

if the first schema registry is down the reverse proxy return 502 Bad Gateway, the schema registry client doesn't continue with trying the other urls, but throws a RestClientException. This is because at RestService.httpRequest the RestClientException is not caught

} catch (IOException e) {
        baseUrls.fail(baseUrl);
        if (i == n - 1) {
          throw e; // Raise the exception since we have no more urls to try
        }
}

Was this intented as is or can be fixed?

Thanks

emasab avatar Oct 02 '18 07:10 emasab

@emasab thanks for bringing this up. The issue you are raising should have nothing to do with a reverse proxy setup, right?

mageshn avatar Oct 15 '18 16:10 mageshn

Yes, in theory if the same schema registry returns a status code different from 200 the problem happens

emasab avatar Oct 15 '18 16:10 emasab

It depends, if the error returned by the schema registry is something that will happen on the other nodes too, it should not retry, but in cases like this where the problem is only on one node, it should

For example it could failover with a 5xx status code or return the error immediately with a 4xx

More specifically, it could failover in case of IOException like now or if it cannot parse the response to an ErrorMessage and the error is an 5xx

emasab avatar Oct 15 '18 17:10 emasab

@emasab how to reproduce this?

rneha725 avatar Nov 13 '23 15:11 rneha725