IllegalReferenceCountException: refCnt: 0, decrement: 1 on spring cloud gateway

Viewed 220

Trying to use RetryGatewayFilter programmatically. But stuck with netty IllegalReferenceCountException: refCnt: 0, decrement: 1

route("route-one", p -> p
                        .readBody(String.class, i -> !StringUtils.isEmpty(i)).and()
                        .path("/id")
                        .filters(f -> f
                                .modifyRequestBody(String.class, String.class, ((exchange, s) -> {
                                    //Body modification
                                }))
                                .retry(retryConfig -> {

                                    retryConfig.setRouteId("route-one");

                    RetryGatewayFilterFactory.BackoffConfig backoffConfig = new RetryGatewayFilterFactory.BackoffConfig();
                                    backoffConfig.setFirstBackoff(Duration.ofSeconds(1));
                                    backoffConfig.setMaxBackoff(Duration.ofSeconds(5));
                                    backoffConfig.setFactor(1);
                                    backoffConfig.setBasedOnPreviousValue(true);

                                    retryConfig.setSeries(HttpStatus.Series.SERVER_ERROR);
                                    retryConfig.setStatuses(HttpStatus.BAD_GATEWAY, HttpStatus.INTERNAL_SERVER_ERROR);
                                    retryConfig.setRetries(3);
                                    //retryConfig.setBackoff(backoffConfig);
                                })
                        )
                        .uri(Url))

Same happens with GET requests too

0 Answers
Related