Skip to content

Remove an excessive close after the abort call in S3RangeReader - #3324

Merged
pomadchin merged 1 commit into
locationtech:masterfrom
pomadchin:fix/s3-reader
Dec 18, 2020
Merged

pomadchin merged 1 commit into
locationtech:masterfrom
pomadchin:fix/s3-reader

Conversation

@pomadchin

@pomadchin pomadchin commented Dec 18, 2020 •

Copy link
Copy Markdown
Member

Overview

This PR addresses the issue that happens on newer JVMs (it happened to me after upgrading up to AdoptOpenJDK 1.8.0_275 from 1.8.0_265). I'm surprised that this issue is JVM specific. This PR finishes #3079 and adds explanations of the abort() function behavior.

This PR also converts #3239 into a less pressing issue.

Checklist

  • ./CHANGELOG.md updated, if necessary. Link to the issue if closed, otherwise the PR.
  • docs guides update, if necessary
  • New user API has useful Scaladoc strings

Demo

import geotrellis.raster.geotiff._

val rs = GeoTiffRasterSource(
  "s3://geotrellis-test/daunnc/tiledb-benchmark/lc8-utm-1.tif"
)

rs.read() // should not fail

Without this PR the code snippet above fails with the following error:

org.apache.http.ConnectionClosedException: Premature end of Content-Length delimited message body (expected: 168,110; received: 0)
  at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:178)
  at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:198)
  at org.apache.http.impl.io.ContentLengthInputStream.close(ContentLengthInputStream.java:101)
  at org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:142)
  at org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
  at org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:172)
  at java.io.FilterInputStream.close(FilterInputStream.java:181)
  at software.amazon.awssdk.services.s3.checksums.ChecksumValidatingInputStream.close(ChecksumValidatingInputStream.java:162)
  at java.io.FilterInputStream.close(FilterInputStream.java:181)
  at software.amazon.awssdk.core.io.SdkFilterInputStream.close(SdkFilterInputStream.java:83)
  at geotrellis.store.s3.util.S3RangeReader.totalLength$lzycompute(S3RangeReader.scala:59)
  at geotrellis.store.s3.util.S3RangeReader.totalLength(S3RangeReader.scala:44)
  at geotrellis.util.StreamingByteReader.ensureChunk(StreamingByteReader.scala:109)
  at geotrellis.util.StreamingByteReader.get(StreamingByteReader.scala:130)
  at geotrellis.raster.io.geotiff.reader.GeoTiffInfo$.read(GeoTiffInfo.scala:127)
  at geotrellis.raster.io.geotiff.reader.GeoTiffReader$.readMultiband(GeoTiffReader.scala:211)
  at geotrellis.raster.geotiff.GeoTiffRasterSource.$anonfun$tiff$1(GeoTiffRasterSource.scala:40)
  at scala.Option.getOrElse(Option.scala:189)
  at geotrellis.raster.geotiff.GeoTiffRasterSource.tiff$lzycompute(GeoTiffRasterSource.scala:37)
  at geotrellis.raster.geotiff.GeoTiffRasterSource.tiff(GeoTiffRasterSource.scala:34)
  at geotrellis.raster.geotiff.GeoTiffRasterSource.gridExtent$lzycompute(GeoTiffRasterSource.scala:55)
  at geotrellis.raster.geotiff.GeoTiffRasterSource.gridExtent(GeoTiffRasterSource.scala:55)
  at geotrellis.raster.RasterMetadata.extent(RasterMetadata.scala:52)
  at geotrellis.raster.RasterMetadata.extent$(RasterMetadata.scala:52)
  at geotrellis.raster.RasterSource.extent(RasterSource.scala:43)
  at geotrellis.raster.RasterSource.read(RasterSource.scala:134)

@pomadchin
pomadchin requested a review from CloudNiner December 18, 2020 16:56
@jisantuc

Copy link
Copy Markdown
Contributor

confirmed -- on the branch, works on 265 and 275, off the branch fails on 275 but works on 265 😎

@jisantuc jisantuc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@pomadchin
pomadchin removed the request for review from CloudNiner December 18, 2020 20:47
@pomadchin
pomadchin merged commit 8c90b21 into locationtech:master Dec 18, 2020
@pomadchin
pomadchin deleted the fix/s3-reader branch December 18, 2020 20:47
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

Successfully merging this pull request may close these issues.

2 participants