title: Grails + Spring Web Flow - Unable to acquire conversation lock (LockTimeoutException)
body: <p>we've faced a strange behavior in our Grails application which is using Web Flow 2.0.0 plugin (what is basically Spring Web Flow 2.0.8.RELEASE). We sometimes receive <strong><em>LockTimeoutException</em></strong> which is fired by a user who is going through our web flow; this usually result in server going down.</p>
  
  <p>After reading more about Spring Web Flow, I realized that the problem could be in a long running tasks (I've tested this with Thread.sleep(30000)). If the user clicks twice on the "next" button when the first computation takes long (more than 30 sec by default), the second request could not be satisfied (cannot lock the flow) and therefore will throw this exception.</p>
  
  <p>This behavior could be also achieve with "crazy" clicking on the next button while the computation takes shorter time (lets say 5 sec). After a sufficient number of clicks the latest request/thread will need to wait longer than 30 sec and therefore will fail. (I think this is our case in production because our computation should take really short time; Imagine inpatient user who is clicking like crazy :-)</p>
  
  <p><strong>My question is:</strong></p>
  
  <p><em><strong>Is there any standard way how to solve this problem?</em></strong></p>
  
  <ul>
  <li>For example like somehow discarding the  second request if the first one was not finished? - Could this lead to dead lock?</li>
  <li>Or disabling a "next" button after the first click?</li>
  <li>I think increasing the lock timeout period would just postpone this trouble...</li>
  </ul>
  
  <p><em><strong>Is there any prevention of the server going down?</em></strong></p>
  
  <ul>
  <li>When I tested it locally (with Thread.sleep()) it didn't go down, just in production</li>
  </ul>
  
  <p>I think this question isn't relevant just for Grails web flow users but also Spring web flow users...</p>
  
  <p>Thanks for any advice,
  Mateo</p>