planetfederal / geoserver-exts

Other
31 stars 40 forks source link

Explicilty disabled JAI's native media lib for unit tests in import/core #25

Closed tkunicki closed 10 years ago

tkunicki commented 11 years ago

Explicitly disable use of JAI's native media library even if it's present.

Notes

jdeolive commented 11 years ago

Hey tom, can you provide a bit more info about your environment? What version of OSX and more importantly what version and vendor of the jvm? Asking because i run osx (10.7) and haven't seen any jai related failures in unit tests.

jdeolive commented 11 years ago

Also something to note is that we have recently moved the importer from this repository into the main geoserver community repository:

https://github.com/geoserver/geoserver/tree/master/src/community/importer

So generally any development importer related (aside from mapstory) should go on there.

@ischneider WHat do you think about this? Should we remove the importer module on the master branch? Or would that make maintaining back and forward ports more difficult?

tkunicki commented 11 years ago

Hey Justin,

I am running 10.8.4 with JDK 1.6.0_51 and 1.7.0_25. OS X's JAI implementation (in /System/Library/Java/Extensions) has always been a problem for me so I usually move it aside. I am on a new machine so I wasn't reminded to do this until I came across this issue...

My issue is in org.geoserver.importer.ImporterDataTest with testImportGeoTiff giving the following exception:

java.awt.image.RasterFormatException: Incorrect scanline stride: 1024
    at sun.awt.image.ShortComponentRaster.verify(ShortComponentRaster.java:828)
    at sun.awt.image.ShortComponentRaster.<init>(ShortComponentRaster.java:201)
    at sun.awt.image.ShortInterleavedRaster.<init>(ShortInterleavedRaster.java:131)
    at sun.awt.image.ShortInterleavedRaster.<init>(ShortInterleavedRaster.java:97)
    at java.awt.image.Raster.createWritableRaster(Raster.java:983)
    at org.geoserver.jai.ConcurrentTileFactory.createTile(ConcurrentTileFactory.java:260)
    at javax.media.jai.PlanarImage.createWritableRaster(PlanarImage.java:1995)
    at javax.media.jai.PlanarImage.getExtendedData(PlanarImage.java:2469)
    at javax.media.jai.BorderExtenderCopy.extend(BorderExtenderCopy.java:209)
    at javax.media.jai.PlanarImage.copyExtendedData(PlanarImage.java:2415)
    at javax.media.jai.PlanarImage.getExtendedData(PlanarImage.java:2472)
    at javax.media.jai.ScaleOpImage.computeTile(ScaleOpImage.java:1265)
    at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:912)
    at javax.media.jai.OpImage.getTile(OpImage.java:1139)
    at javax.media.jai.PlanarImage.getData(PlanarImage.java:2098)
    at javax.media.jai.RenderedOp.getData(RenderedOp.java:2287)
    at com.sun.imageio.plugins.png.PNGImageWriter.encodePass(PNGImageWriter.java:818)
    at com.sun.imageio.plugins.png.PNGImageWriter.write_IDAT(PNGImageWriter.java:942)
    at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1158)
    at org.geotools.image.ImageWorker.writePNG(ImageWorker.java:2762)
    at org.geoserver.wms.map.PNGMapResponse.formatImageOutputStream(PNGMapResponse.java:118)
    at org.geoserver.wms.map.RenderedImageMapResponse.write(RenderedImageMapResponse.java:122)
    at org.geoserver.ows.Dispatcher.response(Dispatcher.java:919)
    at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:276)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.geoserver.test.GeoServerAbstractTestSupport$3.service(GeoServerAbstractTestSupport.java:1248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at com.mockrunner.mock.web.MockFilterChain.doFilter(MockFilterChain.java:46)
    at org.geoserver.test.GeoServerAbstractTestSupport.dispatch(GeoServerAbstractTestSupport.java:1267)
    at org.geoserver.test.GeoServerAbstractTestSupport.dispatch(GeoServerAbstractTestSupport.java:1202)
    at org.geoserver.test.GeoServerAbstractTestSupport.getAsServletResponse(GeoServerAbstractTestSupport.java:610)
    at org.geoserver.test.GeoServerAbstractTestSupport.getAsServletResponse(GeoServerAbstractTestSupport.java:593)
    at org.geoserver.importer.ImporterTestSupport.runChecks(ImporterTestSupport.java:92)
    at org.geoserver.importer.ImporterDataTest.testImportGeoTIFF(ImporterDataTest.java:400)
    [snip]

If I move aside OS X media lib jar and native library, the test passes but gives an informational exception on attempt to load the media lib classes. The property above forces the tests to run with JAI in java-only mode w/o any exceptions. I like to minimize exceptions in unit test output (no "broken windows")

ischneider commented 11 years ago

@ischneider WHat do you think about this? Should we remove the importer module on the master branch? Or would that make maintaining back and forward ports more difficult?

It appears there are no commits on master that aren't in the 2.3.x branch (for the importer module). So dropping the importer in master is fine with me. We can just forward-port in the community module the 6 commits from 2.3.x (and any others found in the meantime).

As for the JAI stuff, I have nothing :confused:

tkunicki commented 11 years ago

Should I close this and resubmit to the community module? Are there any requested changes? e.g. create profile for ox x only? It would think we would want platform consistency across unit tests. But we might also consider profiles to turn JAI native support on and off for tests against various platforms. Java's JAI has some issues

Justin, do you look to see if you have the Apple JAI implementation in your JDK by default in /System/Library/Java/Extensions? I would expect that you may have removed as the implementation is somewhat problematic with GeoServer, etc. (in my experience)

jdeolive commented 11 years ago

I have never had to disable the jai extensions on osx, but i have never used anything newer than osx 10.7. Given that i don't recall running into this problem I suspect it may be specific to osx 10.8. Have you encountered this in anything downstream like the geotools or geoserver builds?

Regarding where to submit this pr i woudl say the community module would be the best place. However you'll probably encounter some pushback to disabling jai since none of our existing unit tests do that. What I would do is reach out to the geotools-devel group and see if any other devs have encountered this problem in geotools or any downstream projects. It may be that no devs are running 10.8. If that is the case then we should consider adding the profile.

On Fri, Aug 23, 2013 at 12:22 PM, Tom Kunicki notifications@github.comwrote:

Should I close this and resubmit to the community module? Are there any requested changes? e.g. create profile for ox x only? It would think we would want platform consistency across unit tests. But we might also consider profiles to turn JAI native support on and off for tests against various platforms. Java's JAI has some issues

Justin, do you look to see if you have the Apple JAI implementation in your JDK by default in /System/Library/Java/Extensions? I would expect that you may have removed as the implementation is somewhat problematic with GeoServer, etc. (in my experience)

— Reply to this email directly or view it on GitHubhttps://github.com/opengeo/geoserver-exts/pull/25#issuecomment-23181845 .

Justin Deoliveira OpenGeo - http://opengeo.org Enterprise support for open source geospatial.

tkunicki commented 11 years ago

For my own sanity... I just did a fresh install of OS X 10.7 in a VM, updated to latest revision, and installed a fresh dev environment. JAI is still an issue leading to the same test failure in importer/core. For reference both 10.7 and 10.8 are running an Apple built JAI 1.1.2.