You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2017/03/06 21:10:33 UTC
[jira] [Updated] (SOLR-10228) XLSXWriter can fail on some JVMs if
no fonts are available due to JVM/OS pacakging of fonts - causes errors in
TestXLSXResponseWriter
[ https://issues.apache.org/jira/browse/SOLR-10228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hoss Man updated SOLR-10228:
----------------------------
Labels: (was: Java9)
Description:
I found this while trying to setup some automated testing against JDK9, but it can also affect users of java8/java7 depending on how their JDK/JRE is packaged.
Some JVM packagers (in particular debian JVM "*-headless" packages) do not install any fonts along with the JDK/JRE, nor do these pacakges depend on any other packages providing {{fontconfig}} support for the JVM to pick up dynamically.
This can cause problems when using
XLSXWriter -- notably in the form of errors that look like this...
{noformat}
[junit4] > Throwable #1: java.lang.InternalError: java.lang.reflect.InvocationTargetException
[junit4] > at __randomizedtesting.SeedInfo.seed([C8331E32DDBEC2E6:3E224C5FC7B09A3D]:0)
[junit4] > at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
[junit4] > at java.base/java.security.AccessController.doPrivileged(Native Method)
[junit4] > at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
[junit4] > at java.desktop/java.awt.Font.getFont2D(Font.java:495)
[junit4] > at java.desktop/java.awt.Font.canDisplayUpTo(Font.java:2244)
[junit4] > at java.desktop/java.awt.font.TextLayout.singleFont(TextLayout.java:469)
[junit4] > at java.desktop/java.awt.font.TextLayout.<init>(TextLayout.java:530)
[junit4] > at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:254)
[junit4] > at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
[junit4] > at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:77)
[junit4] > at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:653)
[junit4] > at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:646)
[junit4] > at org.apache.solr.handler.extraction.XLSXWriter$SerialWriteWorkbook.<init>(XLSXResponseWriter.java:112)
[junit4] > at org.apache.solr.handler.extraction.XLSXWriter.<init>(XLSXResponseWriter.java:165)
[junit4] > at org.apache.solr.handler.extraction.XLSXResponseWriter.write(XLSXResponseWriter.java:66)
[junit4] > at org.apache.solr.handler.extraction.TestXLSXResponseWriter.getWSResultForQuery(TestXLSXResponseWriter.java:237)
[junit4] > at org.apache.solr.handler.extraction.TestXLSXResponseWriter.getWSResultForQuery(TestXLSXResponseWriter.java:232)
[junit4] > at org.apache.solr.handler.extraction.TestXLSXResponseWriter.testPseudoFields(TestXLSXResponseWriter.java:211)
[junit4] > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit4] > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[junit4] > at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[junit4] > at java.base/java.lang.reflect.Method.invoke(Method.java:547)
[junit4] > at java.base/java.lang.Thread.run(Thread.java:844)
[junit4] > Caused by: java.lang.reflect.InvocationTargetException
[junit4] > at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[junit4] > at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[junit4] > at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[junit4] > at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:473)
[junit4] > at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
[junit4] > ... 55 more
[junit4] > Caused by: java.lang.NullPointerException
[junit4] > at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1288)
[junit4] > at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
[junit4] > at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
[junit4] > at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:765)
[junit4] > at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:440)
[junit4] > at java.base/java.security.AccessController.doPrivileged(Native Method)
[junit4] > at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:385)
[junit4] > at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
[junit4] > at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
[junit4] > ... 60 more
{noformat}
The solution is to ensure your JVM has proper font support -- most likely by ensuring the neccessarily font packages are installed (in the case of debian, installing the {{libfontconfig1}} package should fix this problem.)
was:
I found this while trying to setup some automated testing against JDK9, but i suspect it would affect anyone using any "headless" of java...
{noformat}
[junit4] Tests with failures [seed: C8331E32DDBEC2E6]:
[junit4] - org.apache.solr.handler.extraction.TestXLSXResponseWriter.testStructuredDataViaBaseWriters
[junit4] - org.apache.solr.handler.extraction.TestXLSXResponseWriter.testPseudoFields
{noformat}
The root problems appear to be NPEs resulting from AWT Font classes not being available when XLSXWriter tries to initialize POI ... which bubbles up to the test as a java.lang.InternalError (full sack traces to follow in a comment)
Summary: XLSXWriter can fail on some JVMs if no fonts are available due to JVM/OS pacakging of fonts - causes errors in TestXLSXResponseWriter (was: XLSXWriter fails on headless jvm due to missing awt fonts - causes errors in TestXLSXResponseWriter )
The undelrying problem is more nuanced then I initailly realized, and has nothing to do with being "headless"
* our build system already runs all our test JVMs using {{-Djava.awt.headless=true}} -- so that's not relevant ({{GraphicsEnvironment.isHeadless()}} is always true in our tests)
* the root problem i was seeing appears to be specific to how the JDK/JVM can be packaged, and whether or not any fonts are available for it to use...
** https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793210
** https://github.com/docker-library/openjdk/issues/73
I've updated the summary to try and make this more clear to other people who might make the same mistaken assumption I did about the solr code not working on "headless" JVMs
> XLSXWriter can fail on some JVMs if no fonts are available due to JVM/OS pacakging of fonts - causes errors in TestXLSXResponseWriter
> --------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SOLR-10228
> URL: https://issues.apache.org/jira/browse/SOLR-10228
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: contrib - Solr Cell (Tika extraction)
> Environment: debian openjdk-9-jdk-headless b158
> Reporter: Hoss Man
>
> I found this while trying to setup some automated testing against JDK9, but it can also affect users of java8/java7 depending on how their JDK/JRE is packaged.
> Some JVM packagers (in particular debian JVM "*-headless" packages) do not install any fonts along with the JDK/JRE, nor do these pacakges depend on any other packages providing {{fontconfig}} support for the JVM to pick up dynamically.
> This can cause problems when using
> XLSXWriter -- notably in the form of errors that look like this...
> {noformat}
> [junit4] > Throwable #1: java.lang.InternalError: java.lang.reflect.InvocationTargetException
> [junit4] > at __randomizedtesting.SeedInfo.seed([C8331E32DDBEC2E6:3E224C5FC7B09A3D]:0)
> [junit4] > at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
> [junit4] > at java.base/java.security.AccessController.doPrivileged(Native Method)
> [junit4] > at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
> [junit4] > at java.desktop/java.awt.Font.getFont2D(Font.java:495)
> [junit4] > at java.desktop/java.awt.Font.canDisplayUpTo(Font.java:2244)
> [junit4] > at java.desktop/java.awt.font.TextLayout.singleFont(TextLayout.java:469)
> [junit4] > at java.desktop/java.awt.font.TextLayout.<init>(TextLayout.java:530)
> [junit4] > at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:254)
> [junit4] > at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
> [junit4] > at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:77)
> [junit4] > at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:653)
> [junit4] > at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:646)
> [junit4] > at org.apache.solr.handler.extraction.XLSXWriter$SerialWriteWorkbook.<init>(XLSXResponseWriter.java:112)
> [junit4] > at org.apache.solr.handler.extraction.XLSXWriter.<init>(XLSXResponseWriter.java:165)
> [junit4] > at org.apache.solr.handler.extraction.XLSXResponseWriter.write(XLSXResponseWriter.java:66)
> [junit4] > at org.apache.solr.handler.extraction.TestXLSXResponseWriter.getWSResultForQuery(TestXLSXResponseWriter.java:237)
> [junit4] > at org.apache.solr.handler.extraction.TestXLSXResponseWriter.getWSResultForQuery(TestXLSXResponseWriter.java:232)
> [junit4] > at org.apache.solr.handler.extraction.TestXLSXResponseWriter.testPseudoFields(TestXLSXResponseWriter.java:211)
> [junit4] > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> [junit4] > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> [junit4] > at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> [junit4] > at java.base/java.lang.reflect.Method.invoke(Method.java:547)
> [junit4] > at java.base/java.lang.Thread.run(Thread.java:844)
> [junit4] > Caused by: java.lang.reflect.InvocationTargetException
> [junit4] > at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> [junit4] > at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> [junit4] > at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> [junit4] > at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:473)
> [junit4] > at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
> [junit4] > ... 55 more
> [junit4] > Caused by: java.lang.NullPointerException
> [junit4] > at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1288)
> [junit4] > at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
> [junit4] > at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
> [junit4] > at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:765)
> [junit4] > at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:440)
> [junit4] > at java.base/java.security.AccessController.doPrivileged(Native Method)
> [junit4] > at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:385)
> [junit4] > at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
> [junit4] > at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
> [junit4] > ... 60 more
> {noformat}
> The solution is to ensure your JVM has proper font support -- most likely by ensuring the neccessarily font packages are installed (in the case of debian, installing the {{libfontconfig1}} package should fix this problem.)
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org