Repository: provectus/kafka-ui
Issue: `webclient.max-in-memory-buffer-size` does not take any effect: DataBufferLimit is always 262144
Labels: type/bug
scope/backend
status/accepted
type/regression

**Describe the bug** (Actual behavior)
Cannot view <Cluster> -> Schema Registry page. An error message is displayed: 
```
500
200 OK from GET http://kafka.intra:8081/subjects; nested exception is org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
```

Overriding `webclient.max-in-memory-buffer-size` didn't help. It always fails with a buffer limit of 262144 bytes.
Version 0.4.0 works completely fine. I guess a buffer override does not work anymore. May be an upstream dependency issue.

**Expected behavior**
<Cluster> -> Schema Registry page shows schema registry topics data

**Set up**
How do you run the app? Please provide as much info as possible:
1. App version : v0.5.0 [027d9b4]
2. Helm chart version: 0.5.0
3. Env Var configs:
    ```
      KAFKA_ADMIN-CLIENT-TIMEOUT: "120000"
      KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: ....
    ```


**Steps to Reproduce**
1. Open <Cluster> -> Schema Registry page. 

**Screenshots**
<img width="1219" alt="Screen Shot 2023-02-03 at 11 46 15 am" src="https://user-images.githubusercontent.com/10956941/216484492-39a3558b-70fd-4f2c-90ec-28d1d3b3da98.png">



**Additional context**
Full error stacktrace
```
org.springframework.web.reactive.function.client.WebClientResponseException: 200 OK from GET http://localhost/subjects; nested exception is org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
        at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:250)
        at org.springframework.web.reactive.function.client.DefaultClientResponse.lambda$createException$1(DefaultClientResponse.java:207)
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
        at reactor.core.publisher.FluxOnErrorReturn$ReturnSubscriber.onError(FluxOnErrorReturn.java:199)
        at reactor.core.publisher.Operators$MonoSubscriber.onError(Operators.java:1863)
        at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onError(FluxOnAssembly.java:544)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:142)
        at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onError(FluxContextWrite.java:121)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onError(FluxMapFuseable.java:340)
        at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onError(FluxFilterFuseable.java:382)
        at reactor.core.publisher.MonoCollect$CollectSubscriber.onError(MonoCollect.java:145)
        at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
        at reactor.core.publisher.FluxPeek$PeekSubscriber.onError(FluxPeek.java:222)
        at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
        at reactor.core.publisher.Operators.error(Operators.java:198)
        at reactor.netty.channel.FluxReceive.startReceiver(FluxReceive.java:182)
        at reactor.netty.channel.FluxReceive.subscribe(FluxReceive.java:143)
        at reactor.core.publisher.InternalFluxOperator.subscribe(InternalFluxOperator.java:62)
        at reactor.netty.ByteBufFlux.subscribe(ByteBufFlux.java:340)
        at reactor.core.publisher.Mono.subscribe(Mono.java:4455)
        at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
        at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onError(FluxOnAssembly.java:544)
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:172)
        at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onError(FluxContextWrite.java:121)
        at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onError(FluxMapFuseable.java:340)
        at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onError(FluxFilterFuseable.java:382)
        at reactor.core.publisher.MonoCollect$CollectSubscriber.onError(MonoCollect.java:145)
        at reactor.core.publisher.MonoCollect$CollectSubscriber.onNext(MonoCollect.java:124)
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
        at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200)
        at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
```




Issue comments:
Hi, please follow the issue template and leave all the requested information (the version you run, configs, etc.)
Ping me once you're done
> Hi, please follow the issue template and leave all the requested information (the version you run, configs, etc.) Ping me once you're done

The description has been updated.
I still can't see the `webclient.max-in-memory-buffer-size` property in your config. Please provide a full one.
Okay, considering `Version 0.4.0 works completely fine`:
Changes made within #903 might take no effect after #3123.
@iliax can you take a look?
@galanoff , thank you for creating issue - we found bug, and will fix it within (https://github.com/provectus/kafka-ui/pull/3310) PR
@armenuikafka please check this is covered in test cases as well.
Need to add a TC for it to Qase.io

Pull request review comments:

Patch that resolved the issue:
diff --git a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/KafkaClusterFactory.java b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/KafkaClusterFactory.java
index 7113f5af367..aea92ab4c45 100644
--- a/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/KafkaClusterFactory.java
+++ b/kafka-ui-api/src/main/java/com/provectus/kafka/ui/service/KafkaClusterFactory.java
@@ -82,6 +82,7 @@ private ReactiveFailover<KafkaSrClientApi> schemaRegistryClient(ClustersProperti
     WebClient webClient = new WebClientConfigurator()
         .configureSsl(clusterProperties.getSchemaRegistrySsl())
         .configureBasicAuth(auth.getUsername(), auth.getPassword())
+        .configureBufferSize(maxBuffSize)
         .build();
     return ReactiveFailover.create(
         parseUrlList(clusterProperties.getSchemaRegistry()),


Test patch: