Hello Dave
for my point of view , the problem come from file http://pastebin.com/QGCFtq2X
line 77 to 80

while
($process->poll()) {
                       template 'processing.tt';
                       sleep 10;
                }
first time it's work, but after not , every 10 sec you send processing.tt to your browser ( first time ,
browser ask 1 anwers, not more , and that all )

you need to use ajax
1) launch in background your process (and create PID to locate your process, https://metacpan.org/pod/Unix::PID )

2) add javascript in your brower to update result ( see example below )

3) add  route

ajax '/myProcesss' {

            If ( $PID )  {
                ... in course
            } else {
                ... process over
            }

}



see fun example
http://advent.perldancer.org/2011/14

bye
Hugues



Le 13/10/2014 15:45, Tushar Dave a écrit :

Hello,

I am working on my Dancer Project (using Perl 5.20.0, apache2, RHEL 6 and Dancer) in which I am providing a web form to user. When user submits the form with appropriate values, a Q-Q plot will be generated by R code on backend. Once the plot is available on server I am sending user an email with the link of generated plot.

My code works completely fine with smaller data file (e.g. 100KB – 10 MB) upload. But, if user uploads the large data files (e.g. > 30MB), the upload works fine but processing of data and generating of plot will take more time which caused 504 Gateway Time Out Error. I can use below options to resolve this.

(1) Change Time Out time in apache configuration file
(2) Submit a job through batch queuing system such as SGE
(3) Use Proc::Simple or Proc::Background to run the process in background and keep checking whether process is running in background or not.

I am using the 3rd option. What I am trying to do is I am using Proc::Simple to run Perl-R-code (i.e. listed in below list as 2) in background. Then I am using poll() method of Proc::Simple to check whether the process is running or not. If the process is running, render a template that shows user that process is still running. When process is finished, render another template with generated Q-Q plot. Below are my codes:

(1) Dancer code under lib/ ---- http://pastebin.com/QGCFtq2X
(2) Perl + R code that generate Q-Q plot ----http://pastebin.com/U5hg45dQ
(3) qqPlot.tt ---- http://pastebin.com/u30XArVr
(4) processing.tt ---- http://pastebin.com/RSH1kptp

The problem I am facing right now that my Dancer code (i.e. listed as 1 above) execute while loop on line 77 of (1) but the template “processing.tt” is not coming up on browser. I don’t know what am I doing wrong?

Can someone help me to figure out my error? Or please suggest me any other way to resolve Gateway Time Out Error.

Thanks for any help.





_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users