Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails connection timeout during large fileupload

I want to prevent the SocketTimeoutException that occurs after about 1 minute if a user tries to upload a large file from an upload form in my Grails web application. I know this is a Tomcat thing rather than a Grails thing, but I'm struggling a bit to modify server.xml using the eventConfigureTomcat event block in _Events.groovy.

According to the tomcat docs there is a disableUploadTimeout property that I should set to true on the connector, but when I try this in the eventConfigureTomcat block, I get the following error when my app starts up:

| Running Grails application
| Error Server failed to start: No such property: disableUploadTimeout for class: org.apache.catalina.connector.Connector (Use --stacktrace to see the full trace)

The contents of my _Events.groovy looks like this:

eventConfigureTomcat = { tomcat ->
    tomcat.connector.disableUploadTimeout = "true"
}

And that error does make sense - according to the javadoc, there is no property disableUploadTimeout on that connector implementation.

What am I doing wrong? How should I be setting this property, or is there some other way to prevent long running file uploads from timing out?

like image 948
rcgeorge23 Avatar asked Oct 20 '22 05:10

rcgeorge23


1 Answers

haven't checked it, but taking a look at the tomcat documentation, the configuration you want to modify seems to be an attribute of the Connector.

The Connector has a method called setAttribute. So I guess you'll succeed with the following code:

eventConfigureTomcat = { tomcat ->
    tomcat.connector.setAttribute('disableUploadTimeout', true); //may 'true'
}

have to admit that I couldn't test this code myself...

Update: according to @Charles-Wood , it has to be set to false and not true.

PS: if you post more information on how to reproduce your problem, I will give it a try

like image 191
rdmueller Avatar answered Oct 23 '22 04:10

rdmueller