Skip to content

ResourceHttpRequestHandler not closing Resource's input stream [SPR-11644] #16267

Closed
@spring-projects-issues

Description

@spring-projects-issues

Dave Hallam opened SPR-11644 and commented

#16040 introduced a change with the intention of preventing the output stream being closed when copying a resource. Unfortunately, the change from FileCopyUtils to StreamUtils has resulted in the resource's input stream not being closed.

see the writeContent() method at https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandler.java#L254

The result of this is that static resources, e.g. html files that are served up by the application remain locked for a period of time as the inputstream has not been programmatically closed. This prevents the ability to be able to edit static resources (html, css, jsp, etc.), save, and hot deploy as the new versions aren't able to overwrite the locked files.

The other class that was updated by #16040 was ShallowEtagHeaderFilter which is unaffected by this issue as it doesn't involve an input stream.


Affects: 3.2.8, 4.0.2, 4.0.3

Issue Links:

Backported to: 3.2.9

1 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions