You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@streampipes.apache.org by Philipp Zehnder <ze...@apache.org> on 2020/09/13 16:43:25 UTC

NullPointer in Image Enrichment Processor

Hi,

we currently have a bug in our image enrichment processor.
Everything works fine when we running in development, but in docker some libraries are missing, see [1].

Unfortunately, it did not work to just install those libraries, I had to change the base image.
With ARG BASE_IMAGE=openjdk:8-jre it is working. 

Now my question is, can we change the base image of streampipes-pipeline-elements-all-jvm & streampipes-processors-image-processing-jvm or does anybody have some experience with missing libraries in alpine images and knows what else we could do?

Philipp


[1] https://stackoverflow.com/questions/30626136/cannot-load-font-in-jre-8/50802170

Re: NullPointer in Image Enrichment Processor

Posted by Patrick Wiener <wi...@apache.org>.
Hi,

I fixed the issue. It happened that the below changes worked.

I’ll commit the changes accordingly.

Patrick

> Am 14.09.2020 um 11:38 schrieb Patrick Wiener <wi...@apache.org>:
> 
> That was my thought - and it would make it „harder“ to automate things again. Now that we got a common base image as well this would break things.
> I investigated a litlle bit yesterday. Often when using alpine, because it is so stripped down in favor of lower footprint and so on, you have to reinstall
> necessary pkgs using the alpine package manager or event compile them for alpine architecture (if needed).
> 
> What I found so far was to add this, but I would need to run tests to see if it works or if additional changes are needed.
> 
> RUN apk --update add --no-cache \
>    fontconfig \
>    ttf-dejavu
> 
> 
> Patrick
> 
>> Am 14.09.2020 um 11:22 schrieb Dominik Riemer <ri...@apache.org>:
>> 
>> Hi Philipp,
>> 
>> we should try to avoid changing the base image as we changed it to OpenJ9 to decrease the memory footprint - when we change it back we would need to re-run tests on systems like Raspberry PI to make sure the minimum hardware requirements are still met.
>> 
>> Is there another way to import the fonts or to change the code so that the image enricher works without access to local font libraries?
>> 
>> Dominik
>> 
>> On 2020/09/13 17:06:10, Patrick Wiener <wi...@apache.org> wrote: 
>>> It would be really helpful if you could post a snippet of the concrete failure log.
>>> 
>>> Patrick
>>> 
>>> 
>>>> Am 13.09.2020 um 18:43 schrieb Philipp Zehnder <ze...@apache.org>:
>>>> 
>>>> Hi,
>>>> 
>>>> we currently have a bug in our image enrichment processor.
>>>> Everything works fine when we running in development, but in docker some libraries are missing, see [1].
>>>> 
>>>> Unfortunately, it did not work to just install those libraries, I had to change the base image.
>>>> With ARG BASE_IMAGE=openjdk:8-jre it is working. 
>>>> 
>>>> Now my question is, can we change the base image of streampipes-pipeline-elements-all-jvm & streampipes-processors-image-processing-jvm or does anybody have some experience with missing libraries in alpine images and knows what else we could do?
>>>> 
>>>> Philipp
>>>> 
>>>> 
>>>> [1] https://stackoverflow.com/questions/30626136/cannot-load-font-in-jre-8/50802170
>>> 
>>> 
> 


Re: NullPointer in Image Enrichment Processor

Posted by Philipp Zehnder <ze...@apache.org>.
Hi,

yes I tried that as well, but unfortunately it did not work. So I guess other libraries are missing as well.

Here is the error log when running it in a docker container:

11:34:57.847 SP [kafka-producer-network-thread | producer-1] INFO  org.apache.kafka.clients.Metadata - Cluster ID: dFBvvenoRiW54LWyHcwwfw
Exception in thread "Thread-5" java.lang.NullPointerException
        at sun.awt.FontConfiguration.getVersion(Unknown Source)
        at sun.awt.FontConfiguration.readFontConfigFile(Unknown Source)
        at sun.awt.FontConfiguration.init(Unknown Source)
        at sun.awt.X11FontManager.createFontConfiguration(Unknown Source)
        at sun.font.SunFontManager$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Unknown Source)
        at sun.font.SunFontManager.<init>(Unknown Source)
        at sun.awt.FcFontManager.<init>(Unknown Source)
        at sun.awt.X11FontManager.<init>(Unknown Source)
        at java.lang.J9VMInternals.newInstanceImpl(Native Method)
        at java.lang.Class.newInstance(Unknown Source)
        at sun.font.FontManagerFactory$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Unknown Source)
        at sun.font.FontManagerFactory.getInstance(Unknown Source)
        at sun.font.SunFontManager.getInstance(Unknown Source)
        at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
        at sun.java2d.SunGraphics2D.getFontMetrics(Unknown Source)
        at org.apache.streampipes.processors.imageprocessing.jvm.processor.imageenrichment.ImageEnricher.onEvent(ImageEnricher.java:72)
        at org.apache.streampipes.wrapper.standalone.runtime.StandaloneEventProcessorRuntime.process(StandaloneEventProcessorRuntime.java:59)
        at org.apache.streampipes.wrapper.standalone.routing.StandaloneSpInputCollector.send(StandaloneSpInputCollector.java:54)
        at org.apache.streampipes.wrapper.standalone.routing.StandaloneSpInputCollector.lambda$onEvent$0(StandaloneSpInputCollector.java:48)
        at org.apache.streampipes.wrapper.standalone.routing.StandaloneSpInputCollector$$Lambda$793/00000000340C6450.accept(Unknown Source)
        at java.util.concurrent.ConcurrentHashMap.forEach(Unknown Source)
        at org.apache.streampipes.wrapper.standalone.routing.StandaloneSpInputCollector.onEvent(StandaloneSpInputCollector.java:48)
        at org.apache.streampipes.wrapper.standalone.routing.StandaloneSpInputCollector.onEvent(StandaloneSpInputCollector.java:29)
        at org.apache.streampipes.messaging.kafka.SpKafkaConsumer.run(SpKafkaConsumer.java:101)
        at java.lang.Thread.run(Unknown Source)

Philipp

> On 14. Sep 2020, at 11:38, Patrick Wiener <wi...@apache.org> wrote:
> 
> That was my thought - and it would make it „harder“ to automate things again. Now that we got a common base image as well this would break things.
> I investigated a litlle bit yesterday. Often when using alpine, because it is so stripped down in favor of lower footprint and so on, you have to reinstall
> necessary pkgs using the alpine package manager or event compile them for alpine architecture (if needed).
> 
> What I found so far was to add this, but I would need to run tests to see if it works or if additional changes are needed.
> 
> RUN apk --update add --no-cache \
>    fontconfig \
>    ttf-dejavu
> 
> 
> Patrick
> 
>> Am 14.09.2020 um 11:22 schrieb Dominik Riemer <ri...@apache.org>:
>> 
>> Hi Philipp,
>> 
>> we should try to avoid changing the base image as we changed it to OpenJ9 to decrease the memory footprint - when we change it back we would need to re-run tests on systems like Raspberry PI to make sure the minimum hardware requirements are still met.
>> 
>> Is there another way to import the fonts or to change the code so that the image enricher works without access to local font libraries?
>> 
>> Dominik
>> 
>> On 2020/09/13 17:06:10, Patrick Wiener <wi...@apache.org> wrote: 
>>> It would be really helpful if you could post a snippet of the concrete failure log.
>>> 
>>> Patrick
>>> 
>>> 
>>>> Am 13.09.2020 um 18:43 schrieb Philipp Zehnder <ze...@apache.org>:
>>>> 
>>>> Hi,
>>>> 
>>>> we currently have a bug in our image enrichment processor.
>>>> Everything works fine when we running in development, but in docker some libraries are missing, see [1].
>>>> 
>>>> Unfortunately, it did not work to just install those libraries, I had to change the base image.
>>>> With ARG BASE_IMAGE=openjdk:8-jre it is working. 
>>>> 
>>>> Now my question is, can we change the base image of streampipes-pipeline-elements-all-jvm & streampipes-processors-image-processing-jvm or does anybody have some experience with missing libraries in alpine images and knows what else we could do?
>>>> 
>>>> Philipp
>>>> 
>>>> 
>>>> [1] https://stackoverflow.com/questions/30626136/cannot-load-font-in-jre-8/50802170
>>> 
>>> 
> 


Re: NullPointer in Image Enrichment Processor

Posted by Patrick Wiener <wi...@apache.org>.
That was my thought - and it would make it „harder“ to automate things again. Now that we got a common base image as well this would break things.
I investigated a litlle bit yesterday. Often when using alpine, because it is so stripped down in favor of lower footprint and so on, you have to reinstall
necessary pkgs using the alpine package manager or event compile them for alpine architecture (if needed).

What I found so far was to add this, but I would need to run tests to see if it works or if additional changes are needed.

RUN apk --update add --no-cache \
    fontconfig \
    ttf-dejavu


Patrick

> Am 14.09.2020 um 11:22 schrieb Dominik Riemer <ri...@apache.org>:
> 
> Hi Philipp,
> 
> we should try to avoid changing the base image as we changed it to OpenJ9 to decrease the memory footprint - when we change it back we would need to re-run tests on systems like Raspberry PI to make sure the minimum hardware requirements are still met.
> 
> Is there another way to import the fonts or to change the code so that the image enricher works without access to local font libraries?
> 
> Dominik
> 
> On 2020/09/13 17:06:10, Patrick Wiener <wi...@apache.org> wrote: 
>> It would be really helpful if you could post a snippet of the concrete failure log.
>> 
>> Patrick
>> 
>> 
>>> Am 13.09.2020 um 18:43 schrieb Philipp Zehnder <ze...@apache.org>:
>>> 
>>> Hi,
>>> 
>>> we currently have a bug in our image enrichment processor.
>>> Everything works fine when we running in development, but in docker some libraries are missing, see [1].
>>> 
>>> Unfortunately, it did not work to just install those libraries, I had to change the base image.
>>> With ARG BASE_IMAGE=openjdk:8-jre it is working. 
>>> 
>>> Now my question is, can we change the base image of streampipes-pipeline-elements-all-jvm & streampipes-processors-image-processing-jvm or does anybody have some experience with missing libraries in alpine images and knows what else we could do?
>>> 
>>> Philipp
>>> 
>>> 
>>> [1] https://stackoverflow.com/questions/30626136/cannot-load-font-in-jre-8/50802170
>> 
>> 


Re: NullPointer in Image Enrichment Processor

Posted by Dominik Riemer <ri...@apache.org>.
Hi Philipp,

we should try to avoid changing the base image as we changed it to OpenJ9 to decrease the memory footprint - when we change it back we would need to re-run tests on systems like Raspberry PI to make sure the minimum hardware requirements are still met.

Is there another way to import the fonts or to change the code so that the image enricher works without access to local font libraries?

Dominik

On 2020/09/13 17:06:10, Patrick Wiener <wi...@apache.org> wrote: 
> It would be really helpful if you could post a snippet of the concrete failure log.
> 
> Patrick
> 
> 
> > Am 13.09.2020 um 18:43 schrieb Philipp Zehnder <ze...@apache.org>:
> > 
> > Hi,
> > 
> > we currently have a bug in our image enrichment processor.
> > Everything works fine when we running in development, but in docker some libraries are missing, see [1].
> > 
> > Unfortunately, it did not work to just install those libraries, I had to change the base image.
> > With ARG BASE_IMAGE=openjdk:8-jre it is working. 
> > 
> > Now my question is, can we change the base image of streampipes-pipeline-elements-all-jvm & streampipes-processors-image-processing-jvm or does anybody have some experience with missing libraries in alpine images and knows what else we could do?
> > 
> > Philipp
> > 
> > 
> > [1] https://stackoverflow.com/questions/30626136/cannot-load-font-in-jre-8/50802170
> 
> 

Re: NullPointer in Image Enrichment Processor

Posted by Patrick Wiener <wi...@apache.org>.
It would be really helpful if you could post a snippet of the concrete failure log.

Patrick


> Am 13.09.2020 um 18:43 schrieb Philipp Zehnder <ze...@apache.org>:
> 
> Hi,
> 
> we currently have a bug in our image enrichment processor.
> Everything works fine when we running in development, but in docker some libraries are missing, see [1].
> 
> Unfortunately, it did not work to just install those libraries, I had to change the base image.
> With ARG BASE_IMAGE=openjdk:8-jre it is working. 
> 
> Now my question is, can we change the base image of streampipes-pipeline-elements-all-jvm & streampipes-processors-image-processing-jvm or does anybody have some experience with missing libraries in alpine images and knows what else we could do?
> 
> Philipp
> 
> 
> [1] https://stackoverflow.com/questions/30626136/cannot-load-font-in-jre-8/50802170