codeconsole opened a new pull request, #16741:
URL: https://github.com/apache/grails-core/pull/16741

   The Undertow servlet web server factory that `grails-undertow` vendors 
created its two temporary directories with `createTempDir`. Spring Boot 4.1 
deprecates that method for removal in 4.3, in favor of `TempDirs` 
([spring-boot#9983](https://github.com/spring-projects/spring-boot/issues/9983)).
 The two directories are `undertow.<port>.*`, for uploaded files, and 
`undertow-docbase.<port>.*`, when the application has no document root. 
`createTempDir` only marked them for deletion on exit, so a directory that 
still held a file, such as an upload Undertow had written to disk, was left in 
`java.io.tmpdir` after every run.
   
   ### Temporary directories
   
   The factory now creates both directories with `TempDirs`, as Spring Boot's 
Tomcat and Jetty factories do. It deletes them, together with anything left in 
them, when the deployment is undeployed, which the server does when it stops. A 
document root the application configures is never deleted.
   
   ### A server that never started
   
   A server whose port is negative, such as one an application runs with 
`server.port=-1`, is never started. Destroying it used to leave its deployment 
deployed, so the listeners of its servlet context were initialized but never 
destroyed, and its temporary directories stayed. Destroying the server, which 
Spring Boot does when the application context closes, now undeploys a 
deployment that is still deployed, as Tomcat destroys its context. That runs 
`contextDestroyed` of those listeners and deletes the directories.
   
   The Grails 8 upgrade notes on the Undertow plugin say the directories are 
deleted when the application stops.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to