Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Apr 1, 2014 · 3 comments
Assignees
Labels
in: web status: backported type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Apr 1, 2014

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:

  • #16269 MarshallingView should avoid temporary byte array when copying to response

Backported to: 3.2.9

1 votes, 4 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Apr 2, 2014

Igor Mukhin commented

Because of this bug, if a file was once served by the <mvc:resources ...>, you can't delete this file anymore (on Windows 7 at least) until you stop the JVM.
Please fix.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 12, 2014

Juergen Hoeller commented

Dave, Igor, does this work for you again, against 4.0.4 and/or the latest 3.2.9 snapshot?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 13, 2014

Igor Mukhin commented

Juergen, 4.0.4 works for me. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web status: backported type: bug
Projects
None yet
Development

No branches or pull requests

2 participants