Closed plesiecki closed 9 years ago
I would like to propose a pull request for this issue.
I will look at the pull later, but don't think there is a leak. Everything is closed it: https://github.com/jknack/handlebars.java/blob/master/handlebars/src/main/java/com/github/jknack/handlebars/io/URLTemplateSource.java#L125-131
I'm pretty sure there is ;)
Some references: http://www.genevski.com/2010/04/javaneturl-and-jarurlconnection-may.html http://webcache.googleusercontent.com/search?q=cache:_sNS9oOvDnwJ:sourceforge.net/p/freemarker/bugs/189/+&cd=7&hl=pl&ct=clnk&gl=pl
Also https://github.com/kohsuke/file-leak-detector maybe useful for debugging.
Here goes steps to reproduce:
git clone https://github.com/plesiecki/handlebars-spring-boot-starter-example.git && cd handlebars-spring-boot-starter-example
./gradlew installapp && build/install/handlebars-spring-boot-starter-example/bin/handlebars-spring-boot-starter-example
while true; do lsof -p $(jps | grep App | cut -d ' ' -f 1) | wc -l ; sleep 1; done
this is number of open files by app from step 2curl locahost:8080/
multiple timesodd, but thanks!
just realize a have the same bug in another (and awesome) project: https://github.com/jooby-project/jooby https://github.com/jooby-project/jooby/blob/master/jooby/src/main/java/org/jooby/internal/URLAsset.java :S
thanks again.
Glad I could help. Any idea when we can expect the next release?
BTW Jooby looks interesting ;)
will push a release now (will be available in 2/3 hours)
Cool! I've updated my https://github.com/allegro/handlebars-spring-boot-starter ;)
Hello!
Recently I that discovered method URLTemplateSource.lastModified may cause file handle leaks. It happens when you run your application from its pacakaged jar and handlebars reads last modification date from resource with URL like jar:file:/path/app.jar!/template.hbs.