JAI error occurred: 'Problem occurs when computing a tile by the owner.'

Hello!

Context:

  • the graph is ok, it runs on SNAP desktop
  • the inputs are ok

What are the root causes of the exception:
JAI error occurred: 'Problem occurs when computing a tile by the owner. ?

The complete stack trace is:

SEVERE: org.esa.snap.core.util.SystemUtils$SnapImagingListener: JAI error occurred: 'Problem occurs when computing a tile by the owner.' at com.sun.media.jai.util.SunTileScheduler@424ede6c org.esa.snap.core.gpf.OperatorException: java.lang.NullPointerException at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:432) at org.esa.s1tbx.sar.gpf.geometric.RangeDopplerGeocodingOp.computeTileStack(RangeDopplerGeocodingOp.java:1104) at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeRect(OperatorImageTileStack.java:122) at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeTile(OperatorImageTileStack.java:86) at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904) at javax.media.jai.OpImage.getTile(OpImage.java:1129) at javax.media.jai.PlanarImage.cobbleFloat(PlanarImage.java:3254) at javax.media.jai.PlanarImage.getData(PlanarImage.java:2181) at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64) at org.esa.snap.core.datamodel.Band.readRasterData(Band.java:309) at org.esa.snap.core.dataio.ProductSubsetBuilder.readBandRasterDataRegion(ProductSubsetBuilder.java:393) at org.esa.snap.core.dataio.ProductSubsetBuilder.readBandRasterDataImpl(ProductSubsetBuilder.java:330) at org.esa.snap.core.dataio.AbstractProductReader.readBandRasterData(AbstractProductReader.java:277) at org.esa.snap.core.gpf.common.SubsetOp.computeTile(SubsetOp.java:290) at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:82) at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137) at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904) at javax.media.jai.OpImage.getTile(OpImage.java:1129) at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085) at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64) at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:449) at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:435) at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeRect(OperatorImageTileStack.java:116) at org.esa.snap.core.gpf.internal.OperatorImageTileStack.computeTile(OperatorImageTileStack.java:86) at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904) at javax.media.jai.OpImage.getTile(OpImage.java:1129) at com.sun.media.jai.util.RequestJob.compute(SunTileScheduler.java:247) at com.sun.media.jai.util.WorkerThread.run(SunTileScheduler.java:468) Caused by: java.lang.NullPointerException at org.esa.s1tbx.sar.gpf.geometric.RangeDopplerGeocodingOp.computeTileStack(RangeDopplerGeocodingOp.java:955) ... 26 more

And the graph is:

<graph> <version>1.0</version> <node id="read_calibration"> <operator>Read</operator> <sources/> <parameters class="com.bc.ceres.binding.dom.XppDomElement"> <file>$input_calibration</file> <formatName>BEAM-DIMAP</formatName> <copyMetadata>true</copyMetadata> </parameters> </node> <node id="read_coherence"> <operator>Read</operator> <sources/> <parameters class="com.bc.ceres.binding.dom.XppDomElement"> <file>$input_coherence</file> <formatName>BEAM-DIMAP</formatName> <copyMetadata>true</copyMetadata> </parameters> </node> <node id="band-merge"> <operator>BandMerge</operator> <sources> <sourceProduct refid="read_calibration"/> <sourceProduct.1 refid="read_coherence"/> </sources> <parameters class="com.bc.ceres.binding.dom.XppDomElement"> <sourceBands/> <geographicError>1.0E-5</geographicError> </parameters> </node> <node id="terrain-correction"> <operator>Terrain-Correction</operator> <sources> <sourceProduct refid="band-merge"/> </sources> <parameters class="com.bc.ceres.binding.dom.XppDomElement"> <sourceBands/> <demName>SRTM 3Sec</demName> <externalDEMFile/> <externalDEMNoDataValue>0.0</externalDEMNoDataValue> <externalDEMApplyEGM>true</externalDEMApplyEGM> <demResamplingMethod>BILINEAR_INTERPOLATION</demResamplingMethod> <imgResamplingMethod>BILINEAR_INTERPOLATION</imgResamplingMethod> <pixelSpacingInMeter>30.0</pixelSpacingInMeter> <pixelSpacingInDegree>2.6949458523585647E-4</pixelSpacingInDegree> <mapProjection>PROJCS[&quot;WGS 84 / Auto UTM&quot;, GEOGCS[&quot;WGS84(DD)&quot;, DATUM[&quot;WGS84&quot;, SPHEROID[&quot;WGS84&quot;, 6378137.0, 298.257223563]], PRIMEM[&quot;Greenwich&quot;, 0.0], UNIT[&quot;degree&quot;, 0.017453292519943295], AXIS[&quot;Geodetic longitude&quot;, EAST], AXIS[&quot;Geodetic latitude&quot;, NORTH]], PROJECTION[&quot;Transverse_Mercator&quot;], PARAMETER[&quot;central_meridian&quot;, 3.0], PARAMETER[&quot;latitude_of_origin&quot;, 0.0], PARAMETER[&quot;scale_factor&quot;, 0.9996], PARAMETER[&quot;false_easting&quot;, 500000.0], PARAMETER[&quot;false_northing&quot;, 0.0], UNIT[&quot;m&quot;, 1.0], AXIS[&quot;Easting&quot;, EAST], AXIS[&quot;Northing&quot;, NORTH]]</mapProjection> <alignToStandardGrid>false</alignToStandardGrid> <standardGridOriginX>0.0</standardGridOriginX> <standardGridOriginY>0.0</standardGridOriginY> <nodataValueAtSea>true</nodataValueAtSea> <saveDEM>false</saveDEM> <saveLatLon>false</saveLatLon> <saveIncidenceAngleFromEllipsoid>false</saveIncidenceAngleFromEllipsoid> <saveLocalIncidenceAngle>false</saveLocalIncidenceAngle> <saveProjectedLocalIncidenceAngle>false</saveProjectedLocalIncidenceAngle> <saveSelectedSourceBand>true</saveSelectedSourceBand> <saveLayoverShadowMask>false</saveLayoverShadowMask> <outputComplex>false</outputComplex> <applyRadiometricNormalization>false</applyRadiometricNormalization> <saveSigmaNought>false</saveSigmaNought> <saveGammaNought>false</saveGammaNought> <saveBetaNought>false</saveBetaNought> <incidenceAngleForSigma0>Use projected local incidence angle from DEM</incidenceAngleForSigma0> <incidenceAngleForGamma0>Use projected local incidence angle from DEM</incidenceAngleForGamma0> <auxFile>Latest Auxiliary File</auxFile> <externalAuxFile/> </parameters> </node> <node id="subset"> <operator>Subset</operator> <sources> <sourceProduct refid="terrain-correction"/> </sources> <parameters class="com.bc.ceres.binding.dom.XppDomElement"> <sourceBands/> <region>0,0,0,0</region> <referenceBand/> <geoRegion>POLYGON ((13.847999572753906 42.349998474121094, 13.552000045776367 42.349998474121094, 13.552000045776367 41.930999755859375, 13.847999572753906 41.930999755859375, 13.847999572753906 42.349998474121094, 13.847999572753906 42.349998474121094))</geoRegion> <subSamplingX>1</subSamplingX> <subSamplingY>1</subSamplingY> <fullSwath>false</fullSwath> <tiePointGridNames/> <copyMetadata>true</copyMetadata> </parameters> </node> <node id="write"> <operator>Write</operator> <sources> <sourceProduct refid="subset"/> </sources> <parameters class="com.bc.ceres.binding.dom.XppDomElement"> <writeEntireTileRows>false</writeEntireTileRows> <file>coin.dim</file> <deleteOutputOnFailure>true</deleteOutputOnFailure> <formatName>BEAM-DIMAP</formatName> <clearCacheAfterRowWrite>false</clearCacheAfterRowWrite> </parameters> </node> <applicationData id="Presentation"> <Description/> <node id="read_calibration"> <displayPosition x="296.0" y="98.0"/> </node> <node id="read_coherence"> <displayPosition x="175.0" y="159.0"/> </node> <node id="band-merge"> <displayPosition x="497.0" y="126.0"/> </node> <node id="terrain-correction"> <displayPosition x="639.0" y="118.0"/> </node> <node id="subset"> <displayPosition x="857.0" y="127.0"/> </node> <node id="write"> <displayPosition x="1055.0" y="131.0"/> </node> </applicationData> </graph>

Any help is really appreciated, I’ve been looking at this for quite a while before getting here.

This error is often caused by limited memory or another preceding error.

In your case the error is:
java.lang.NullPointerException at org.esa.s1tbx.sar.gpf.geometric.RangeDopplerGeocodingOp.computeTileStack(RangeDopplerGeocodingOp.java:955)

Looking at the code indicates that you are still suing S1TBX 8.0.4, because in 8.0.5 the error cannot happen line 955.
Maybe an update can solve the issue, if not I think @lveci or @jun_lu can provide more information.

I’ve updated to 8.0.5 and got the same behaviour.

Then I removed the bandmerge operator and TC’ed the coherence, all good
Repeated with the intensity, all good.
So I moved the band_merge node to after the TCs/Subsets and the processing is ok.

I wonder what role the BandMerge Operator had that lead to the exception

Thanks @marpet :slight_smile:

1 Like

Is this issue related to multithreading?

No, I don’t think so. It seems something is not properly initialised.
But @lveci knows the code better. IHe can explain better what’s going wrong here.

Did someone find a solution for this problem ? I encountered a similar behaviour

Java error messages can have many causes – you need to examine the log files
to narrow down the source of the error.

A lot has changed over the last year, so unless you have not updated SNAP you should assume your “similar behaviour” is a new discovery and provide details of your SNAP version and the processing that gave the error along with your messages.log file (the Help menu will show you the location of the file).

…I would add that since the current SNAP version is only supported one, better check with that one if the problem is still there.

My snap version is: 9.0.0
JRE: OpenJDK Runtime Environment 1.8.0_242-b20

I have 16 Gb RAM

I use snap in python with the recommended installation explained here:

> Blockquote

This problems occurs after I processed several (about 7-8) tiles sequentially (in a loop). If I process them just one a time without processing several afterwards this behaviour is not occuring for the same tiles

The stack trace is:

SEVERE: org.esa.snap.core.util.SystemUtils$SnapImagingListener: JAI error occurred: 'Problem occurs when computing a tile by the owner.' at com.sun.media.jai.util.SunTileScheduler@110b919b
java.lang.IllegalArgumentException: Empty region!
	at javax.imageio.ImageReader.computeRegions(ImageReader.java:2702)
	at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.getDestination(TIFFImageReader.java:2201)
	at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1817)
	at it.geosolutions.imageioimpl.plugins.tiff.TIFFRenderedImage.read(TIFFRenderedImage.java:300)
	at it.geosolutions.imageioimpl.plugins.tiff.TIFFRenderedImage.getData(TIFFRenderedImage.java:284)
	at org.esa.s1tbx.commons.io.ImageIOFile.getData(ImageIOFile.java:297)
	at org.esa.s1tbx.commons.io.ImageIOFile.readImageIORasterBand(ImageIOFile.java:248)
	at org.esa.s1tbx.io.sentinel1.Sentinel1ProductReader.readBandRasterDataImpl(Sentinel1ProductReader.java:162)
	at org.esa.snap.core.dataio.AbstractProductReader.readBandRasterData(AbstractProductReader.java:277)
	at org.esa.snap.core.image.BandOpImage.computeProductData(BandOpImage.java:68)
	at org.esa.snap.core.image.RasterDataNodeOpImage.computeRect(RasterDataNodeOpImage.java:127)
	at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
	at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
	at javax.media.jai.OpImage.getTile(OpImage.java:1129)
	at javax.media.jai.PlanarImage.cobbleUShort(PlanarImage.java:3052)
	at javax.media.jai.PlanarImage.getData(PlanarImage.java:2175)
	at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
	at org.esa.snap.core.datamodel.Band.readRasterData(Band.java:309)
	at org.esa.snap.core.dataio.ProductSubsetBuilder.readBandRasterDataRegion(ProductSubsetBuilder.java:393)
	at org.esa.snap.core.dataio.ProductSubsetBuilder.readBandRasterDataImpl(ProductSubsetBuilder.java:330)
	at org.esa.snap.core.dataio.AbstractProductReader.readBandRasterData(AbstractProductReader.java:277)
	at org.esa.snap.core.gpf.common.SubsetOp.computeTile(SubsetOp.java:295)
	at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:82)
	at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
	at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
	at javax.media.jai.OpImage.getTile(OpImage.java:1129)
	at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
	at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:449)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:435)
	at org.esa.snap.core.gpf.Operator.getSourceTile(Operator.java:459)
	at org.esa.s1tbx.calibration.gpf.Sentinel1RemoveThermalNoiseOp.computeTileImage(Sentinel1RemoveThermalNoiseOp.java:605)
	at org.esa.s1tbx.calibration.gpf.Sentinel1RemoveThermalNoiseOp.computeTile(Sentinel1RemoveThermalNoiseOp.java:574)
	at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:82)
	at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
	at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
	at javax.media.jai.OpImage.getTile(OpImage.java:1129)
	at javax.media.jai.PlanarImage.cobbleFloat(PlanarImage.java:3254)
	at javax.media.jai.PlanarImage.getData(PlanarImage.java:2181)
	at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:449)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:435)
	at org.esa.snap.core.gpf.Operator.getSourceTile(Operator.java:459)
	at org.esa.s1tbx.calibration.gpf.RemoveGRDBorderNoiseOp$1.process(RemoveGRDBorderNoiseOp.java:547)
	at org.esa.snap.core.util.ThreadRunnable.run(ThreadRunnable.java:23)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

SEVERE: org.esa.snap.core.util.SystemUtils$SnapImagingListener: JAI error occurred: 'Problem occurs when computing a tile by the owner.' at com.sun.media.jai.util.SunTileScheduler@110b919b
org.esa.snap.core.gpf.OperatorException: Empty region!
	at org.esa.s1tbx.calibration.gpf.Sentinel1RemoveThermalNoiseOp.computeTileImage(Sentinel1RemoveThermalNoiseOp.java:710)
	at org.esa.s1tbx.calibration.gpf.Sentinel1RemoveThermalNoiseOp.computeTile(Sentinel1RemoveThermalNoiseOp.java:574)
	at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:82)
	at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
	at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
	at javax.media.jai.OpImage.getTile(OpImage.java:1129)
	at javax.media.jai.PlanarImage.cobbleFloat(PlanarImage.java:3254)
	at javax.media.jai.PlanarImage.getData(PlanarImage.java:2181)
	at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:449)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:435)
	at org.esa.snap.core.gpf.Operator.getSourceTile(Operator.java:459)
	at org.esa.s1tbx.calibration.gpf.RemoveGRDBorderNoiseOp$1.process(RemoveGRDBorderNoiseOp.java:547)
	at org.esa.snap.core.util.ThreadRunnable.run(ThreadRunnable.java:23)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)


My installation of esa snap for python:

[type or paste code here](https://senbox.atlassian.net/wiki/spaces/SNAP/pages/50855941/Configure+Python+to+use+the+SNAP-Python+snappy+interface)

Python loops in ESA SNAP snappy does not work reliably because memory management between Java and Python is not coordinated. In general it is more reliable to process the tiles one-by-one with a loop in a batch script.

1 Like

Thanks for the help! :slight_smile:

We are bringing the snapista Python-wrapper onboard soon to ease scripting of SNAP-processing from Python. Stay tuned!

Good to have Snapista widely available. It would be nice to have a short document describing use cases where different tool chains are appropriate:

  • reading a product in Python in order to use Python tools, e.g., pandas and matplotlib, to create artifacts

  • adding numpy arrays to existing products

  • scripting a sequence of steps that has been done in the GUI