Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relatively frequent NPE: Inflater has been closed in map print job #3242

Open
iljanen opened this issue Mar 25, 2024 · 0 comments
Open

Relatively frequent NPE: Inflater has been closed in map print job #3242

iljanen opened this issue Mar 25, 2024 · 0 comments

Comments

@iljanen
Copy link

iljanen commented Mar 25, 2024

Context

  • MapFish print version: 3.30.6
  • Java version: 11.0.20.1+1
  • OS: 5.10.210-201.852.amzn2.x86_64 (docker container from camptocamp:mapfish-print:3.30.6 running in AWS ECS)

Describe the bug

Random java.lang.NullPointerException: Inflater has been closed error when printing map spec.

We use MapFish Print in such a way, that we calculcate specific WFS features to be printed in certain scales and call MapFish Print x times with slightly different WFS-urls (each url usually has different bbox specified). Example spec. below.

How to reproduce

I've not been able to intentionally reproduce this locally. This only happens in our production environment from time to time (about twice a day).

{
  "layout": "A4 portrait Archived",
  "app": "archived-map",
  "attributes": {
    "date": "Tulostettu / Utskriven: 13.03.2024",
    "copyright": "© 2023",
    "requestHeaders": {
      "requestHeaders": {
        "content-length": [
          "1674"
        ],
        "host": [
          "<internal server url>"
        ],
        "content-type": [
          "application/json"
        ],
        "connection": [
          "close"
        ],
        "accept-encoding": [
          "gzip, compress, deflate, br"
        ],
        "accept": [
          "application/json, text/plain, */*"
        ],
        "user-agent": [
          "axios/1.5.0"
        ]
      }
    },
    "legend": {
      "classes": [
        {
          "name": "Toimenpidekuviot / Åtgärdsområden",
          "icons": [
            "<internal server url>/wms?SERVICE=WMS&REQUEST=GetLegendGraphic&VERSION=1.3.0&FORMAT=image/png&LAYER=our_layer&legend_options=dpi:300"
          ]
        },
        {
          "name": "Kiinteistörajat / Fastighetsgränser",
          "icons": [
            "<internal server url>/wms?SERVICE=WMS&REQUEST=GetLegendGraphic&VERSION=1.3.0&FORMAT=image/png&LAYER=out_other_layer&legend_options=dpi:300"
          ]
        }
      ],
      "name": ""
    },
    "title": "Map",
    "map": {
      "center": [
        432645.0831363622,
        7090536.100270482
      ],
      "rotation": 0,
      "longitudeFirst": true,
      "layers": [
        {
          "geoJson": "<internal server url>/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=sampo%3Aout_layer&maxFeatures=100000&outputFormat=application%2Fjson&cql_filter=%28ID%20IN%20%28898%29%29",
          "style": "file://./generic_polygon.sld",
          "type": "geojson"
        },
        {
          "geoJson": "<internal server url>/wfs?service=WFS&version=2.0.0&request=GetFeature&typeName=nili%3Aour_other_layer&srsname=EPSG%3A3067&outputFormat=application/json&cql_filter=%28ID+IN+(317)%29",
          "style": "file://./Kiinteisto.sld",
          "type": "geojson"
        },
        {
          "imageFormat": "image/png",
          "baseURL": "<internal server url>/WMSServer?",
          "layers": [
            "1"
          ],
          "styles": [
            ""
          ],
          "opacity": 1,
          "type": "WMS"
        }
      ],
      "scale": 5000,
      "pdfA": true,
      "projection": "EPSG:3067",
      "dpi": 300
    }
  },
  "outputFormat": "pdf"
}

Actual results

Usually maps print fine, but sometimes the described error aborts the print job.

CallStack

java.util.concurrent.ExecutionException: java.lang.NullPointerException
--
at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
at org.mapfish.print.output.AbstractJasperReportOutputFormat.getJasperPrint(AbstractJasperReportOutputFormat.java:164)
at org.mapfish.print.output.AbstractJasperReportOutputFormat.print(AbstractJasperReportOutputFormat.java:98)
at org.mapfish.print.MapPrinter.print(MapPrinter.java:133)
at org.mapfish.print.servlet.job.PrintJob.lambda$call$0(PrintJob.java:145)
at org.mapfish.print.servlet.job.PrintJob.withOpenOutputStream(PrintJob.java:110)
at org.mapfish.print.servlet.job.PrintJob.call(PrintJob.java:143)
at org.mapfish.print.servlet.job.PrintJob.call(PrintJob.java:52)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException: null
at java.base/jdk.internal.reflect.GeneratedConstructorAccessor388.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
... 12 common frames omitted
Caused by: java.lang.NullPointerException: null
at java.base/jdk.internal.reflect.GeneratedConstructorAccessor388.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678)
at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:722)
at org.mapfish.print.processor.ProcessorDependencyGraph.tryExecuteNodes(ProcessorDependencyGraph.java:59)
at org.mapfish.print.processor.ProcessorDependencyGraph$ProcessorGraphForkJoinTask.lambda$compute$0(ProcessorDependencyGraph.java:210)
at org.mapfish.print.processor.AbstractProcessor$Context.mdcContext(AbstractProcessor.java:251)
at org.mapfish.print.processor.ProcessorDependencyGraph$ProcessorGraphForkJoinTask.compute(ProcessorDependencyGraph.java:205)
at org.mapfish.print.processor.ProcessorDependencyGraph$ProcessorGraphForkJoinTask.compute(ProcessorDependencyGraph.java:180)
at java.base/java.util.concurrent.RecursiveTask.exec(RecursiveTask.java:94)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.NullPointerException: null
at java.base/jdk.internal.reflect.GeneratedConstructorAccessor388.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678)
at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:722)
at org.mapfish.print.http.HttpRequestFetcher$CachedClientHttpRequest.execute(HttpRequestFetcher.java:188)
at org.mapfish.print.map.image.AbstractSingleImageLayer.fetchImage(AbstractSingleImageLayer.java:158)
at org.mapfish.print.map.image.wms.WmsLayer.loadImage(WmsLayer.java:55)
at org.mapfish.print.map.image.AbstractSingleImageLayer.getLayers(AbstractSingleImageLayer.java:85)
at org.mapfish.print.map.geotools.AbstractGeotoolsLayer.render(AbstractGeotoolsLayer.java:87)
at org.mapfish.print.processor.map.CreateMapProcessor.createLayerGraphics(CreateMapProcessor.java:456)
at org.mapfish.print.processor.map.CreateMapProcessor.execute(CreateMapProcessor.java:244)
at org.mapfish.print.processor.map.CreateMapProcessor.execute(CreateMapProcessor.java:98)
at org.mapfish.print.processor.ProcessorGraphNode$ProcessorNodeForkJoinTask.lambda$compute$0(ProcessorGraphNode.java:195)
at org.mapfish.print.processor.AbstractProcessor$Context.mdcContext(AbstractProcessor.java:251)
at org.mapfish.print.processor.ProcessorGraphNode$ProcessorNodeForkJoinTask.compute(ProcessorGraphNode.java:178)
at org.mapfish.print.processor.ProcessorGraphNode$ProcessorNodeForkJoinTask.compute(ProcessorGraphNode.java:164)
... 6 common frames omitted
Caused by: java.lang.NullPointerException: Inflater has been closed
at java.base/java.util.zip.Inflater.ensureOpen(Inflater.java:740)
at java.base/java.util.zip.Inflater.inflate(Inflater.java:377)
at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:153)
at java.base/java.util.zip.GZIPInputStream.read(GZIPInputStream.java:118)
at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.apache.http.client.entity.LazyDecompressingInputStream.read(LazyDecompressingInputStream.java:64)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1484)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1104)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1457)
at org.apache.commons.io.IOUtils.copy(IOUtils.java:1082)
at org.mapfish.print.http.HttpRequestFetcher$CachedClientHttpResponse.<init>(HttpRequestFetcher.java:94)
at org.mapfish.print.http.HttpRequestFetcher$CachedClientHttpRequest.lambda$call$0(HttpRequestFetcher.java:213)
at org.mapfish.print.processor.AbstractProcessor$Context.mdcContextEx(AbstractProcessor.java:268)
at org.mapfish.print.http.HttpRequestFetcher$CachedClientHttpRequest.call(HttpRequestFetcher.java:203)
at org.mapfish.print.http.HttpRequestFetcher$CachedClientHttpRequest.call(HttpRequestFetcher.java:136)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1448)
... 5 common frames omitted

Expected results

PDF with requested map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant