+$!=0;
+if (!close $fh) {
+ die $! if $!;
+ die $? if $? != 24; # SIGXCPU but not in POSIX.pm :-/
+</%perl>
+% $someresults->('Search took too long and was terminated');
+
+Sorry, but your query resulted in a search that took too long.
+Searches are limited to <% $maxcpu |h %> seconds of CPU time to
+avoid them consuming excessive resources on the server system, and to
+make sure that shorter searches can still happen.
+
+<p>
+Please try a search with a smaller maximum distance, or place more
+restrictions on the route.
+
+</div>
+<%perl>
+ return;
+}
+
+if ($concur_fail) {
+</%perl>
+% $someresults->('Server too busy');
+
+Sorry, but there are already <% $concur_lim |h %> route searches
+running. We limit the number which can run at once to avoid
+overloading the server system and to make sure that the rest of the
+YARRG website still runs quickly.
+<p>
+
+If you submitted several searches and gave up on them (eg by hitting
+"back" or "stop" in your browser), be aware that that doesn't
+generally stop the search process at the server end. So it's best to
+avoid asking for large searches that you're not sure about.
+
+<p>
+Otherwise, please try later. Searches are limited to <% $maxcpu |h %>
+seconds of CPU time so more processing resources should be available soon.
+
+</div>
+<%perl>
+ return;
+}
+
+$someresults->();
+