mapfish / mapfish-print

A component of MapFish for printing templated cartographic maps. This module is the Java serverside module.
http://mapfish.github.io/mapfish-print-doc/
BSD 2-Clause "Simplified" License
183 stars 417 forks source link

buildreport Web API documentation #688

Open kuzkok opened 6 years ago

kuzkok commented 6 years ago

Missing documentation for buildreport.:format at "Web Protocol" description, but it work, and I found description in https://geomapfish-demo.camptocamp.net/course_mapfishprint.pdf.

Create and get report (in one request)
POST /print/:appId/buildreport.:format

Should it be presented in documentation or not? Can we use this route for production?

sanak commented 2 weeks ago

Hi, I have been curious about this, because current job request => status check polling doesn't fit server side redundancy (multiple Docker containers with load balancer). From glance of the related code, this route seems to wait for response by Thread.sleep until completion, so I guess that we can't use it in production server, because one user's request may block other user's request (default timeout 10 mins). https://github.com/mapfish/mapfish-print/blob/3.30.6/core/src/main/java/org/mapfish/print/servlet/MapPrinterServlet.java#L656-L661

        long startWaitTime = System.currentTimeMillis();
        final long maxWaitTimeInMillis = TimeUnit.SECONDS.toMillis(this.maxCreateAndGetWaitTimeInSeconds);
        while (!isDone && System.currentTimeMillis() - startWaitTime < maxWaitTimeInMillis) {
            Thread.sleep(TimeUnit.SECONDS.toMillis(1));
            isDone = loadReport(ref, createReportResponse, handler);
        }
ltshb commented 2 weeks ago

@sanak I can confirm your code observation, we were using mapfish print (using the master branch) on a k8s cluster using several pod and after a short while all prints were stuck reaching the default 10min timeout. We had to restart the pods to avoid this. Using the latest version 3.30.6 seems to works better on this.

sanak commented 2 weeks ago

@ltshb Okay, thanks for the information!

sebr72 commented 1 week ago

@sanak Could you please elaborate on the relation between this issue and lines of code you mentionned in MapPrinterServlet ?