Skip to content

Commit c5d7398

Browse files
authored
[hotfix] upload file oom bug fixed. (apache#693)
* [hotfix] upload file oom bug fixed.
1 parent 6bb11e6 commit c5d7398

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/entity/Project.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ public File getGitRepository() {
149149

150150
@JsonIgnore
151151
public void delete() throws IOException {
152-
File file = getGitRepository();
153-
FileUtils.deleteDirectory(file);
152+
FileUtils.deleteDirectory(getAppSource());
153+
FileUtils.deleteDirectory(getDistHome());
154154
}
155155

156156
@JsonIgnore
@@ -212,8 +212,7 @@ public boolean isCloned() {
212212
*/
213213
public void cleanCloned() throws IOException {
214214
if (isCloned()) {
215-
FileUtils.deleteDirectory(getAppSource());
216-
FileUtils.deleteDirectory(getDistHome());
215+
this.delete();
217216
}
218217
}
219218

streamx-console/streamx-console-service/src/main/java/com/streamxhub/streamx/console/core/service/impl/ApplicationServiceImpl.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public Map<String, Serializable> dashboard() {
252252
}
253253
}
254254

255-
// mergee metrics from flink kubernetes cluster
255+
// merge metrics from flink kubernetes cluster
256256
FlinkMetricCV k8sMetric = k8sFlinkTrkMonitor.getAccClusterMetrics();
257257
totalJmMemory += k8sMetric.totalJmMemory();
258258
totalTmMemory += k8sMetric.totalTmMemory();
@@ -288,13 +288,13 @@ public void tailMvnDownloading(Long id) {
288288
@Override
289289
public String upload(MultipartFile file) throws Exception {
290290
String temp = WebUtils.getAppDir("temp");
291-
File saveFile = new File(temp, file.getOriginalFilename());
291+
File saveFile = new File(temp, Objects.requireNonNull(file.getOriginalFilename()));
292292
// delete when exists
293293
if (saveFile.exists()) {
294294
saveFile.delete();
295295
}
296296
// save file to temp dir
297-
FileUtils.writeByteArrayToFile(saveFile, file.getBytes());
297+
file.transferTo(saveFile);
298298
return saveFile.getAbsolutePath();
299299
}
300300

streamx-console/streamx-console-service/src/main/resources/application.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ spring:
1919
servlet:
2020
multipart:
2121
enabled: true
22-
max-file-size: 200MB
23-
max-request-size: 200MB
22+
max-file-size: 500MB
23+
max-request-size: 500MB
2424
datasource:
2525
dynamic:
2626
# 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗

0 commit comments

Comments
 (0)