[ 
https://issues.apache.org/jira/browse/ISIS-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16841020#comment-16841020
 ] 

ASF subversion and git services commented on ISIS-2119:
-------------------------------------------------------

Commit e7a4c8eabb10cdd5a0796205f998a0397bcc39a8 in isis's branch 
refs/heads/ISIS-538 from danhaywood
[ https://gitbox.apache.org/repos/asf?p=isis.git;h=e7a4c8e ]

ISIS-2119: increases the timeout for downloading blobs to 250ms

... to avoid, I hope, the occasional InvalidBehaviourIdException .


> Increase timeout to avoid occasional exceptions when download Blobs
> -------------------------------------------------------------------
>
>                 Key: ISIS-2119
>                 URL: https://issues.apache.org/jira/browse/ISIS-2119
>             Project: Isis
>          Issue Type: Bug
>    Affects Versions: 1.17.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: 1.18.0
>
>
> On a slow connection, can get occasional exceptions when downloading a 
> blob... that the behaviour cannot be found on the entity.  There's not a lot 
> to go on.
> Inspecting the returned payload though, I discovered at the end:
> {code}
> <evaluate><![CDATA[(function(){setTimeout("window.location.href='./orders.Order:7975?24-1.IBehaviorListener.0-'",
>  10);})();]]></evaluate>
> {code}
> which gave me the clue.  The relevant code is in 
> ActionResultResponseHandlingStrategy:
> {code}
>     SCHEDULE_HANDLER {
>         @Override
>         public void handleResults(
>                 final ActionResultResponse resultResponse,
>                 final IsisSessionFactory isisSessionFactory) {
>             final RequestCycle requestCycle = RequestCycle.get();
>             AjaxRequestTarget target = 
> requestCycle.find(AjaxRequestTarget.class);
>             if (target == null) {
>                 // non-Ajax request => just stream the Lob to the browser
>                 // or if this is a no-arg action, there also will be no 
> parent for the component
>                 
> requestCycle.scheduleRequestHandlerAfterCurrent(resultResponse.getHandler());
>             } else {
>                 // otherwise,
>                 // Ajax request => respond with a redirect to be able to 
> stream the Lob to the client
>                 ResourceStreamRequestHandler scheduledHandler = 
> (ResourceStreamRequestHandler) resultResponse.getHandler();
>                 StreamAfterAjaxResponseBehavior streamingBehavior = new 
> StreamAfterAjaxResponseBehavior(scheduledHandler);
>                 final Page page = target.getPage();
>                 page.add(streamingBehavior);
>                 String callbackUrl = 
> streamingBehavior.getCallbackUrl().toString();
>                 target.appendJavaScript("setTimeout(\"window.location.href='" 
> + callbackUrl + "'\", 10);");
>             }
>         }
>     },
> {code}
> What's happening here is that response from the ajax call to invoke the 
> button is the fragments to rebuild the page ... it's not possible to also 
> return the BLOB.  So the Ajax instead sets a timeout to download that Blob as 
> a separate web call.
> Experimenting with this code, if the behaviour is stripped off (everything 
> after the "?") then the download doesn't occur; so this is needed.
> Since I've seen the problem mostly with large docs and on a slow connection, 
> my guess is that this is some sort of race condition.  Since we can wait a 
> bit more than 10ms, my suggestion is to increase the timeout to 250ms.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to