I am getting below exception whenever I switch one state to another more then 15 times in web-flow.
No flow execution snapshot could be found with id '1'; perhaps the snapshot has been removed? . Stacktrace follows:
org.springframework.webflow.execution.repository.FlowExecutionRestorationFailureException: A problem occurred restoring the flow execution with key 'e7s1'
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.webflow.execution.repository.snapshot.SnapshotNotFoundException: No flow execution snapshot could be found with id '1'; perhaps the snapshot has been removed?
... 3 more
I am using grails webflow plug-in.
Are anyone have any idea why this is occurring and how to resolve this?
Web Flow only retains a specified number of Executions ("e7") and Snapshots ("s1") in its repository at one time. This is useful in order to limit how much memory can be consumed. I'm guessing the default is 15, in which case Execution "e7" can have 15 Snapshots as you move from state to state. Once you've hit "e7s16", "s1" will be discarded, thus giving you the result you see.
You can change the defaults with the <webflow:flow-execution-repository>
configuration element:
<!-- Executes flows: the entry point into the Spring Web Flow system -->
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
<webflow:flow-execution-repository max-execution-snapshots="20" max-executions="2"/>
</webflow:flow-executor>
Quoting that link above:
Tune the max-execution-snapshots attribute to place a cap on the number of history snapshots that can be taken per flow execution. To disable snapshotting, set this value to 0. To enable an unlimited number of snapshots, set this value to -1.
I do find the default behavior unacceptable, though, when you happen to visit an expired Snapshot and you just get an Exception. Another recent question asked about how to catch that case, presumably so you can do something more useful when it occurs.
(We implemented custom code to carry along in the HttpSession the last valid Snapshot so that we could send the user there when that exception occurs.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With