我有一个JHipster应用程序,提供用于上传文件的REST端点。
这段代码在Linux机器上的Docker容器中没有任何问题,但似乎卡在Windows上运行的同一个Docker容器中。
@PostMapping("/datafiles")
@Timed
public ResponseEntity<DataFileDTO> createDataFile(@Valid @RequestParam("file") MultipartFile data,
@Valid @RequestHeader("workspaceId") Long workspaceId, RedirectAttributes redirectAttributes)
throws URISyntaxException, IOException {
log.debug("REST request to save a data content");
DataFileDTO result = dataFileService.createFromData(data, workspaceId);
return ResponseEntity.created(new URI("/api/datafiles/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())).body(result);
}
此代码适用于12Mb视频文件,但是当我尝试上传70Mb的文件时,没有调试日志出现,服务器被阻止,直到我从下载到超时
Jan 29 15:26:46 StorageService StorageService-dockerstorage_storageservice-app_1.network:8081: ERROR - io.undertow.request : UT005023: Exception handling request to /api/datafiles
java.io.IOException: UT000128: Remote peer closed connection before all data could be read
at io.undertow.conduits.FixedLengthStreamSourceConduit.exitRead(FixedLengthStreamSourceConduit.java:338)
at io.undertow.conduits.FixedLengthStreamSourceConduit.read(FixedLengthStreamSourceConduit.java:255)
at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
at io.undertow.channels.DetachableStreamSourceChannel.read(DetachableStreamSourceChannel.java:209)
at io.undertow.server.HttpServerExchange$ReadDispatchChannel.read(HttpServerExchange.java:2343)
at org.xnio.channels.Channels.readBlocking(Channels.java:294)
at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:192)
at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:168)
at io.undertow.server.handlers.form.MultiPartParserDefinition$MultiPartUploadHandler.parseBlocking(MultiPartParserDefinition.java:223)
at io.undertow.servlet.spec.HttpServletRequestImpl.parseFormData(HttpServletRequestImpl.java:792)
... 43 common frames omitted
更改超时只会使服务器等待,但我的代码没有任何反应。
在这种情况下,Windows是否有特定的东西?
我终于发现问题不在JHipster方面,而是与运行前端的NGinx Docker容器的配置有关。在这种情况下,默认配置似乎不同。