diff --git a/changelog.md b/changelog.md index 6f0e378a..69a2dd87 100644 --- a/changelog.md +++ b/changelog.md @@ -4,7 +4,7 @@ - 升级`spring-boot/spring-cloud/spring-cloud-alibaba`版本 - 修复`DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144`问题 -- 修复压测出现`ClosedChannelException`问题 +- 修复压测出现`ClosedChannelException`,`Connection has been closed BEFORE response`问题 ## 4.2.7 diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java index 476f3083..d92ec8e1 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/config/SopGatewayEnvironmentPostProcessor.java @@ -40,9 +40,13 @@ public class SopGatewayEnvironmentPostProcessor implements EnvironmentPostProces } private void initMemSize(Properties properties) { - String size = properties.getProperty("spring.servlet.multipart.max-file-size", "10M"); - DataSize dataSize = DataSize.parse(size); - properties.putIfAbsent("spring.codec.max-in-memory-size", dataSize.toBytes()); + String maxFileSizeKey = "spring.servlet.multipart.max-file-size"; + String maxMemSizeKey = "spring.codec.max-in-memory-size"; + String defaultSize = "10M"; + String maxUploadSize = properties.getProperty(maxFileSizeKey, defaultSize); + String maxBodySize = properties.getProperty(maxMemSizeKey, defaultSize); + long size = Math.max(DataSize.parse(maxUploadSize).toBytes(), DataSize.parse(maxBodySize).toBytes()); + properties.put(maxMemSizeKey, size); } }