You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by George Christman <gc...@cardaddy.com> on 2013/04/15 19:59:44 UTC

Long running process in onSuccess causing Life Cycle methods to rerun.

Hello, I have a long running process in my onSuccess method. I'm
noticing my onActivate and onValidate methods are being called
multiple times before the onSuccess method has actually completed. I
was able to successfully reproduce this using Thread.sleep in the
following example. Does anybody know why this my be happening?

onActivate() {
   System.out.println("onActivate");
}

onValidate() {
   System.out.println("onValidate");
}

Object onSuccess() throws Exception {
        if(ApplicationActionEnum.GENERATE_PO == this.action) {
            try {
                Thread.sleep(60000);
            } catch (Exception e) {

            }
        }
        System.out.println("onSuccess");
        return Index.class;
    }

My output.

onActivate
pnValidate
onActivate
pnValidate
OnSuccess

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by George Christman <gc...@cardaddy.com>.
I'd like to also note I'm using Jetty locally.


On Tue, Apr 16, 2013 at 4:06 PM, George Christman
<gc...@cardaddy.com>wrote:

> Hi Josh,
>
> I'm running localhost version 5.3.6. The only thing sitting in front of my
> app is Charles Proxy, but I have ruled that out do to the fact there
> doesn't seem to be an issue with it running in my test page. Charles Proxy
> is how I was able to determine the cancel request at 30.0 secs.
>
> I don't know if it's an issue in production at this point in time do to
> the fact the issue was discovered while implementing new code.
>
> I've tried both Firefox and Chrome, same issue.
>
> I am seeing this in the over view on failure.
>
>    URL http://localhost:8080/eprs/purchase_request.pr  Status Failed
> Failure Remote server closed the connection before sending response header  Response
> Code -  Protocol HTTP/1.1  Method POST  Kept Alive Yes  Content-Type -  Client
> Address /127.0.0.1  Remote Address localhost/127.0.0.1
>
>
>  and the following on success.
>
>
>
>    URL http://localhost:8080/eprs/purchase_request.pr  Status Complete  Response
> Code -  Protocol HTTP/1.1  Method POST  Kept Alive No  Content-Type -  Client
> Address /127.0.0.1  Remote Address localhost/127.0.0.1
>
>
> Header appears to be the same for failed and successful request, below is
> an example.
>
>
> POST /eprs/purchase_request.pr HTTP/1.1  Host localhost:8080
> Content-Length 4042  Cache-Control max-age=0  Accept
> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8  Origin
> http://localhost:8080  User-Agent Mozilla/5.0 (Windows NT 6.1)
> AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
> Content-Type application/x-www-form-urlencoded  Referer
> http://localhost:8080/eprs/purchase_request  Accept-Encoding
> gzip,deflate,sdch  Accept-Language en-US,en;q=0.8  Accept-Charset
> ISO-8859-1,utf-8;q=0.7,*;q=0.3  Cookie SpryMedia_DataTables_dataTable_=%7B%22iCreate%22%3A1366141532497%2C%22iStart%22%3A0%2C%22iEnd%22%3A25%2C%22iLength%22%3A25%2C%22aaSorting%22%3A%5B%5B0%2C%22asc%22%2C0%5D%5D%2C%22oSearch%22%3A%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%22aoSearchCols%22%3A%5B%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%5D%2C%22abVisCols%22%3A%5Btrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%5D%7D;
> JSESSIONID=qdpvp6xgojai1ai671l0hizx2
>
>
> On Tue, Apr 16, 2013 at 3:11 PM, Josh Canfield <jo...@gmail.com>wrote:
>
>> Hi George.
>>
>> Probably need to know more about how your system is set up.
>>
>> Did you run the test in the exact same environment as you are seeing the
>> problem? (same codebase different page?)
>> Are you seeing the problem only in a production environment?
>> Are you running apache mod_proxy, or something else in front of your app?
>> Have you tried a different browser?
>> Anything interesting in the headers recorded in Charles Proxy?
>>
>>
>> On Tue, Apr 16, 2013 at 11:08 AM, George Christman
>> <gc...@cardaddy.com>wrote:
>>
>> > I ended up setting up a test app to learn that the issue was on my end
>> > and that the test app worked as intended. I setup Charlies Proxy and
>> > discovered after 30.0 seconds exact, it fails the request and creates
>> > a new request. I've disabled all my JS, css and can not figure out the
>> > underlying issue. Does anybody happen to know what might be happening?
>> >
>> > On Mon, Apr 15, 2013 at 7:56 PM, Cezary Biernacki <ce...@gmail.com>
>> > wrote:
>> > > Are you sure that the second request is not generated by e.g. a
>> reverse
>> > > proxy?
>> > >
>> > >
>> > > On Mon, Apr 15, 2013 at 7:59 PM, George Christman
>> > > <gc...@cardaddy.com>wrote:
>> > >
>> > >> Hello, I have a long running process in my onSuccess method. I'm
>> > >> noticing my onActivate and onValidate methods are being called
>> > >> multiple times before the onSuccess method has actually completed. I
>> > >> was able to successfully reproduce this using Thread.sleep in the
>> > >> following example. Does anybody know why this my be happening?
>> > >>
>> > >> onActivate() {
>> > >>    System.out.println("onActivate");
>> > >> }
>> > >>
>> > >> onValidate() {
>> > >>    System.out.println("onValidate");
>> > >> }
>> > >>
>> > >> Object onSuccess() throws Exception {
>> > >>         if(ApplicationActionEnum.GENERATE_PO == this.action) {
>> > >>             try {
>> > >>                 Thread.sleep(60000);
>> > >>             } catch (Exception e) {
>> > >>
>> > >>             }
>> > >>         }
>> > >>         System.out.println("onSuccess");
>> > >>         return Index.class;
>> > >>     }
>> > >>
>> > >> My output.
>> > >>
>> > >> onActivate
>> > >> pnValidate
>> > >> onActivate
>> > >> pnValidate
>> > >> OnSuccess
>> > >>
>> > >> ---------------------------------------------------------------------
>> > >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > >> For additional commands, e-mail: users-help@tapestry.apache.org
>> > >>
>> > >>
>> >
>> >
>> >
>> > --
>> > George Christman
>> > www.CarDaddy.com
>> > P.O. Box 735
>> > Johnstown, New York
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>>
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by George Christman <gc...@cardaddy.com>.
Hi Josh,

I'm running localhost version 5.3.6. The only thing sitting in front of my
app is Charles Proxy, but I have ruled that out do to the fact there
doesn't seem to be an issue with it running in my test page. Charles Proxy
is how I was able to determine the cancel request at 30.0 secs.

I don't know if it's an issue in production at this point in time do to the
fact the issue was discovered while implementing new code.

I've tried both Firefox and Chrome, same issue.

I am seeing this in the over view on failure.

   URL http://localhost:8080/eprs/purchase_request.pr  Status Failed
Failure Remote server closed the connection before sending response
header  Response
Code -  Protocol HTTP/1.1  Method POST  Kept Alive Yes  Content-Type -  Client
Address /127.0.0.1  Remote Address localhost/127.0.0.1


 and the following on success.



   URL http://localhost:8080/eprs/purchase_request.pr  Status Complete
 Response
Code -  Protocol HTTP/1.1  Method POST  Kept Alive No  Content-Type -  Client
Address /127.0.0.1  Remote Address localhost/127.0.0.1


Header appears to be the same for failed and successful request, below is
an example.


POST /eprs/purchase_request.pr HTTP/1.1  Host localhost:8080  Content-Length
4042  Cache-Control max-age=0  Accept
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8  Origin
http://localhost:8080  User-Agent Mozilla/5.0 (Windows NT 6.1)
AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31
Content-Type application/x-www-form-urlencoded  Referer
http://localhost:8080/eprs/purchase_request  Accept-Encoding
gzip,deflate,sdch  Accept-Language en-US,en;q=0.8  Accept-Charset
ISO-8859-1,utf-8;q=0.7,*;q=0.3  Cookie
SpryMedia_DataTables_dataTable_=%7B%22iCreate%22%3A1366141532497%2C%22iStart%22%3A0%2C%22iEnd%22%3A25%2C%22iLength%22%3A25%2C%22aaSorting%22%3A%5B%5B0%2C%22asc%22%2C0%5D%5D%2C%22oSearch%22%3A%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%22aoSearchCols%22%3A%5B%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%5D%2C%22abVisCols%22%3A%5Btrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%5D%7D;
JSESSIONID=qdpvp6xgojai1ai671l0hizx2


On Tue, Apr 16, 2013 at 3:11 PM, Josh Canfield <jo...@gmail.com>wrote:

> Hi George.
>
> Probably need to know more about how your system is set up.
>
> Did you run the test in the exact same environment as you are seeing the
> problem? (same codebase different page?)
> Are you seeing the problem only in a production environment?
> Are you running apache mod_proxy, or something else in front of your app?
> Have you tried a different browser?
> Anything interesting in the headers recorded in Charles Proxy?
>
>
> On Tue, Apr 16, 2013 at 11:08 AM, George Christman
> <gc...@cardaddy.com>wrote:
>
> > I ended up setting up a test app to learn that the issue was on my end
> > and that the test app worked as intended. I setup Charlies Proxy and
> > discovered after 30.0 seconds exact, it fails the request and creates
> > a new request. I've disabled all my JS, css and can not figure out the
> > underlying issue. Does anybody happen to know what might be happening?
> >
> > On Mon, Apr 15, 2013 at 7:56 PM, Cezary Biernacki <ce...@gmail.com>
> > wrote:
> > > Are you sure that the second request is not generated by e.g. a reverse
> > > proxy?
> > >
> > >
> > > On Mon, Apr 15, 2013 at 7:59 PM, George Christman
> > > <gc...@cardaddy.com>wrote:
> > >
> > >> Hello, I have a long running process in my onSuccess method. I'm
> > >> noticing my onActivate and onValidate methods are being called
> > >> multiple times before the onSuccess method has actually completed. I
> > >> was able to successfully reproduce this using Thread.sleep in the
> > >> following example. Does anybody know why this my be happening?
> > >>
> > >> onActivate() {
> > >>    System.out.println("onActivate");
> > >> }
> > >>
> > >> onValidate() {
> > >>    System.out.println("onValidate");
> > >> }
> > >>
> > >> Object onSuccess() throws Exception {
> > >>         if(ApplicationActionEnum.GENERATE_PO == this.action) {
> > >>             try {
> > >>                 Thread.sleep(60000);
> > >>             } catch (Exception e) {
> > >>
> > >>             }
> > >>         }
> > >>         System.out.println("onSuccess");
> > >>         return Index.class;
> > >>     }
> > >>
> > >> My output.
> > >>
> > >> onActivate
> > >> pnValidate
> > >> onActivate
> > >> pnValidate
> > >> OnSuccess
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > >> For additional commands, e-mail: users-help@tapestry.apache.org
> > >>
> > >>
> >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by Josh Canfield <jo...@gmail.com>.
Hi George.

Probably need to know more about how your system is set up.

Did you run the test in the exact same environment as you are seeing the
problem? (same codebase different page?)
Are you seeing the problem only in a production environment?
Are you running apache mod_proxy, or something else in front of your app?
Have you tried a different browser?
Anything interesting in the headers recorded in Charles Proxy?


On Tue, Apr 16, 2013 at 11:08 AM, George Christman
<gc...@cardaddy.com>wrote:

> I ended up setting up a test app to learn that the issue was on my end
> and that the test app worked as intended. I setup Charlies Proxy and
> discovered after 30.0 seconds exact, it fails the request and creates
> a new request. I've disabled all my JS, css and can not figure out the
> underlying issue. Does anybody happen to know what might be happening?
>
> On Mon, Apr 15, 2013 at 7:56 PM, Cezary Biernacki <ce...@gmail.com>
> wrote:
> > Are you sure that the second request is not generated by e.g. a reverse
> > proxy?
> >
> >
> > On Mon, Apr 15, 2013 at 7:59 PM, George Christman
> > <gc...@cardaddy.com>wrote:
> >
> >> Hello, I have a long running process in my onSuccess method. I'm
> >> noticing my onActivate and onValidate methods are being called
> >> multiple times before the onSuccess method has actually completed. I
> >> was able to successfully reproduce this using Thread.sleep in the
> >> following example. Does anybody know why this my be happening?
> >>
> >> onActivate() {
> >>    System.out.println("onActivate");
> >> }
> >>
> >> onValidate() {
> >>    System.out.println("onValidate");
> >> }
> >>
> >> Object onSuccess() throws Exception {
> >>         if(ApplicationActionEnum.GENERATE_PO == this.action) {
> >>             try {
> >>                 Thread.sleep(60000);
> >>             } catch (Exception e) {
> >>
> >>             }
> >>         }
> >>         System.out.println("onSuccess");
> >>         return Index.class;
> >>     }
> >>
> >> My output.
> >>
> >> onActivate
> >> pnValidate
> >> onActivate
> >> pnValidate
> >> OnSuccess
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by Dmitry Gusev <dm...@gmail.com>.
On Wed, Apr 17, 2013 at 4:43 PM, George Christman
<gc...@cardaddy.com>wrote:

> Cezary, I would agree with your response if it didn't work perfectly fine
> in my test page using the same proxy settings. Anyhow, I removed the proxy
> all together and the behavior remains the same. Do you have any suggestions
> in regards to debugging this issue?
>
> I also agree this should be put on it's own thread, I'm just not aware of
> away with tapestry to push the response back to the UI after the thread has
> completed.
>

You would push response back as you would do with any other web framework :)
There are two options -- poll or push. You can push from server to
client-size using CometD or WebSockets,
or you can poll from client side and check if results are ready on server.
For instance, you may store results to DB when your job completed and
lookup results from DB on poll requests.

You can use ZoneRefresh, or just do AJAX call, say, with jQuery and return
results in response to display them on client-side using tapestry
client-side API or your custom javascript.


> On Tue, Apr 16, 2013 at 4:21 PM, Cezary Biernacki <cezary.bi@gmail.com
> >wrote:
>
> > Hi George,
> > you answered your own question.  Your proxy waits for response and after
> > some time it fails the request and issues new one. It is a typical
> > behaviour of the proxy, and it is designed to recover from failures or
> > temporary unresponsive servers. Check documentation of your proxy to see
> > how to change default timeout value. However setting this too high is
> not a
> > good solution. Browser also implement some maximum wait time (AFAIK
> around
> > 6 minutes). Even without software timeouts after few minutes a user
> > probably will get impatient and click refresh thinking that connection
> > failed.
> >
> > The proper solution would be to start long running process on a separate
> > thread (e.g. by using ParallelExecutor) or maybe even a separate machine,
> > return request immediately and provide some kind of feedback (e.g. via
> AJAX
> > polling) about process progress.
> >
> > Best regards,
> > Cezary
> >
> >
> > On Tue, 16 Apr 2013 14:08:14 -0400 George Christman <
> > gchristman@cardaddy.com> wrote:
> >
> >> I ended up setting up a test app to learn that the issue was on my end
> >> and that the test app worked as intended. I setup Charlies Proxy and
> >> discovered after 30.0 seconds exact, it fails the request and creates
> >> a new request. I've disabled all my JS, css and can not figure out the
> >> underlying issue. Does anybody happen to know what might be happening?
> >>
> >> On Mon, Apr 15, 2013 at 7:56 PM, Cezary Biernacki <ce...@gmail.com>
> >> wrote:
> >>
> >>> Are you sure that the second request is not generated by e.g. a reverse
> >>> proxy?
> >>>
> >>>
> >>> On Mon, Apr 15, 2013 at 7:59 PM, George Christman
> >>> <gc...@cardaddy.com>**wrote:
> >>>
> >>>  Hello, I have a long running process in my onSuccess method. I'm
> >>>> noticing my onActivate and onValidate methods are being called
> >>>> multiple times before the onSuccess method has actually completed. I
> >>>> was able to successfully reproduce this using Thread.sleep in the
> >>>> following example. Does anybody know why this my be happening?
> >>>>
> >>>> onActivate() {
> >>>>     System.out.println("**onActivate");
> >>>> }
> >>>>
> >>>> onValidate() {
> >>>>     System.out.println("**onValidate");
> >>>> }
> >>>>
> >>>> Object onSuccess() throws Exception {
> >>>>          if(ApplicationActionEnum.**GENERATE_PO == this.action) {
> >>>>              try {
> >>>>                  Thread.sleep(60000);
> >>>>              } catch (Exception e) {
> >>>>
> >>>>              }
> >>>>          }
> >>>>          System.out.println("onSuccess"**);
> >>>>          return Index.class;
> >>>>      }
> >>>>
> >>>> My output.
> >>>>
> >>>> onActivate
> >>>> pnValidate
> >>>> onActivate
> >>>> pnValidate
> >>>> OnSuccess
> >>>>
> >>>> ------------------------------**------------------------------**
> >>>> ---------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> users-unsubscribe@tapestry.apache.org>
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>>
> >>
> >>
> >
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> users-unsubscribe@tapestry.apache.org>
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by George Christman <gc...@cardaddy.com>.
Cezary, I would agree with your response if it didn't work perfectly fine
in my test page using the same proxy settings. Anyhow, I removed the proxy
all together and the behavior remains the same. Do you have any suggestions
in regards to debugging this issue?

I also agree this should be put on it's own thread, I'm just not aware of
away with tapestry to push the response back to the UI after the thread has
completed.


On Tue, Apr 16, 2013 at 4:21 PM, Cezary Biernacki <ce...@gmail.com>wrote:

> Hi George,
> you answered your own question.  Your proxy waits for response and after
> some time it fails the request and issues new one. It is a typical
> behaviour of the proxy, and it is designed to recover from failures or
> temporary unresponsive servers. Check documentation of your proxy to see
> how to change default timeout value. However setting this too high is not a
> good solution. Browser also implement some maximum wait time (AFAIK around
> 6 minutes). Even without software timeouts after few minutes a user
> probably will get impatient and click refresh thinking that connection
> failed.
>
> The proper solution would be to start long running process on a separate
> thread (e.g. by using ParallelExecutor) or maybe even a separate machine,
> return request immediately and provide some kind of feedback (e.g. via AJAX
> polling) about process progress.
>
> Best regards,
> Cezary
>
>
> On Tue, 16 Apr 2013 14:08:14 -0400 George Christman <
> gchristman@cardaddy.com> wrote:
>
>> I ended up setting up a test app to learn that the issue was on my end
>> and that the test app worked as intended. I setup Charlies Proxy and
>> discovered after 30.0 seconds exact, it fails the request and creates
>> a new request. I've disabled all my JS, css and can not figure out the
>> underlying issue. Does anybody happen to know what might be happening?
>>
>> On Mon, Apr 15, 2013 at 7:56 PM, Cezary Biernacki <ce...@gmail.com>
>> wrote:
>>
>>> Are you sure that the second request is not generated by e.g. a reverse
>>> proxy?
>>>
>>>
>>> On Mon, Apr 15, 2013 at 7:59 PM, George Christman
>>> <gc...@cardaddy.com>**wrote:
>>>
>>>  Hello, I have a long running process in my onSuccess method. I'm
>>>> noticing my onActivate and onValidate methods are being called
>>>> multiple times before the onSuccess method has actually completed. I
>>>> was able to successfully reproduce this using Thread.sleep in the
>>>> following example. Does anybody know why this my be happening?
>>>>
>>>> onActivate() {
>>>>     System.out.println("**onActivate");
>>>> }
>>>>
>>>> onValidate() {
>>>>     System.out.println("**onValidate");
>>>> }
>>>>
>>>> Object onSuccess() throws Exception {
>>>>          if(ApplicationActionEnum.**GENERATE_PO == this.action) {
>>>>              try {
>>>>                  Thread.sleep(60000);
>>>>              } catch (Exception e) {
>>>>
>>>>              }
>>>>          }
>>>>          System.out.println("onSuccess"**);
>>>>          return Index.class;
>>>>      }
>>>>
>>>> My output.
>>>>
>>>> onActivate
>>>> pnValidate
>>>> onActivate
>>>> pnValidate
>>>> OnSuccess
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>
>>
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by Cezary Biernacki <ce...@gmail.com>.
Hi George,
you answered your own question.  Your proxy waits for response and after 
some time it fails the request and issues new one. It is a typical 
behaviour of the proxy, and it is designed to recover from failures or 
temporary unresponsive servers. Check documentation of your proxy to see 
how to change default timeout value. However setting this too high is 
not a good solution. Browser also implement some maximum wait time 
(AFAIK around 6 minutes). Even without software timeouts after few 
minutes a user probably will get impatient and click refresh thinking 
that connection failed.

The proper solution would be to start long running process on a separate 
thread (e.g. by using ParallelExecutor) or maybe even a separate 
machine, return request immediately and provide some kind of feedback 
(e.g. via AJAX polling) about process progress.

Best regards,
Cezary

On Tue, 16 Apr 2013 14:08:14 -0400 George Christman 
<gc...@cardaddy.com> wrote:
> I ended up setting up a test app to learn that the issue was on my end
> and that the test app worked as intended. I setup Charlies Proxy and
> discovered after 30.0 seconds exact, it fails the request and creates
> a new request. I've disabled all my JS, css and can not figure out the
> underlying issue. Does anybody happen to know what might be happening?
>
> On Mon, Apr 15, 2013 at 7:56 PM, Cezary Biernacki <ce...@gmail.com> wrote:
>> Are you sure that the second request is not generated by e.g. a reverse
>> proxy?
>>
>>
>> On Mon, Apr 15, 2013 at 7:59 PM, George Christman
>> <gc...@cardaddy.com>wrote:
>>
>>> Hello, I have a long running process in my onSuccess method. I'm
>>> noticing my onActivate and onValidate methods are being called
>>> multiple times before the onSuccess method has actually completed. I
>>> was able to successfully reproduce this using Thread.sleep in the
>>> following example. Does anybody know why this my be happening?
>>>
>>> onActivate() {
>>>     System.out.println("onActivate");
>>> }
>>>
>>> onValidate() {
>>>     System.out.println("onValidate");
>>> }
>>>
>>> Object onSuccess() throws Exception {
>>>          if(ApplicationActionEnum.GENERATE_PO == this.action) {
>>>              try {
>>>                  Thread.sleep(60000);
>>>              } catch (Exception e) {
>>>
>>>              }
>>>          }
>>>          System.out.println("onSuccess");
>>>          return Index.class;
>>>      }
>>>
>>> My output.
>>>
>>> onActivate
>>> pnValidate
>>> onActivate
>>> pnValidate
>>> OnSuccess
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by George Christman <gc...@cardaddy.com>.
I ended up setting up a test app to learn that the issue was on my end
and that the test app worked as intended. I setup Charlies Proxy and
discovered after 30.0 seconds exact, it fails the request and creates
a new request. I've disabled all my JS, css and can not figure out the
underlying issue. Does anybody happen to know what might be happening?

On Mon, Apr 15, 2013 at 7:56 PM, Cezary Biernacki <ce...@gmail.com> wrote:
> Are you sure that the second request is not generated by e.g. a reverse
> proxy?
>
>
> On Mon, Apr 15, 2013 at 7:59 PM, George Christman
> <gc...@cardaddy.com>wrote:
>
>> Hello, I have a long running process in my onSuccess method. I'm
>> noticing my onActivate and onValidate methods are being called
>> multiple times before the onSuccess method has actually completed. I
>> was able to successfully reproduce this using Thread.sleep in the
>> following example. Does anybody know why this my be happening?
>>
>> onActivate() {
>>    System.out.println("onActivate");
>> }
>>
>> onValidate() {
>>    System.out.println("onValidate");
>> }
>>
>> Object onSuccess() throws Exception {
>>         if(ApplicationActionEnum.GENERATE_PO == this.action) {
>>             try {
>>                 Thread.sleep(60000);
>>             } catch (Exception e) {
>>
>>             }
>>         }
>>         System.out.println("onSuccess");
>>         return Index.class;
>>     }
>>
>> My output.
>>
>> onActivate
>> pnValidate
>> onActivate
>> pnValidate
>> OnSuccess
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>



-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by Cezary Biernacki <ce...@gmail.com>.
Are you sure that the second request is not generated by e.g. a reverse
proxy?


On Mon, Apr 15, 2013 at 7:59 PM, George Christman
<gc...@cardaddy.com>wrote:

> Hello, I have a long running process in my onSuccess method. I'm
> noticing my onActivate and onValidate methods are being called
> multiple times before the onSuccess method has actually completed. I
> was able to successfully reproduce this using Thread.sleep in the
> following example. Does anybody know why this my be happening?
>
> onActivate() {
>    System.out.println("onActivate");
> }
>
> onValidate() {
>    System.out.println("onValidate");
> }
>
> Object onSuccess() throws Exception {
>         if(ApplicationActionEnum.GENERATE_PO == this.action) {
>             try {
>                 Thread.sleep(60000);
>             } catch (Exception e) {
>
>             }
>         }
>         System.out.println("onSuccess");
>         return Index.class;
>     }
>
> My output.
>
> onActivate
> pnValidate
> onActivate
> pnValidate
> OnSuccess
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Long running process in onSuccess causing Life Cycle methods to rerun.

Posted by Josh Canfield <jo...@gmail.com>.
Hmm... I can't reproduce. I assume you're running in a test environment
with controlled requests.

I could imagine extra GET requests caused by broken CSS, but that shouldn't
trigger a onValidate, unless maybe you've rigged something up to process
the form from a GET?

public class About {

    @Inject
    private Request request;

    void onActivate() {
        log("onActivate");
    }

    void onValidate() {
        log("onValidate");
    }

    void onSuccess() throws Exception {
        try {
            Thread.sleep(60000);
        } catch (Exception e) {

        }
        log("onSuccess");
    }

    private void log(String method) {
        System.out.printf(
                "%s %s %s%n", method, request.getMethod(), request.getPath()
        );
    }
}



Output:

onActivate GET /about
onActivate POST /about.form
onValidate POST /about.form
onSuccess POST /about.form
onActivate GET /about


On Mon, Apr 15, 2013 at 10:59 AM, George Christman
<gc...@cardaddy.com>wrote:

> Hello, I have a long running process in my onSuccess method. I'm
> noticing my onActivate and onValidate methods are being called
> multiple times before the onSuccess method has actually completed. I
> was able to successfully reproduce this using Thread.sleep in the
> following example. Does anybody know why this my be happening?
>
> onActivate() {
>    System.out.println("onActivate");
> }
>
> onValidate() {
>    System.out.println("onValidate");
> }
>
> Object onSuccess() throws Exception {
>         if(ApplicationActionEnum.GENERATE_PO == this.action) {
>             try {
>                 Thread.sleep(60000);
>             } catch (Exception e) {
>
>             }
>         }
>         System.out.println("onSuccess");
>         return Index.class;
>     }
>
> My output.
>
> onActivate
> pnValidate
> onActivate
> pnValidate
> OnSuccess
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>