Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarkus Tika Native Image Build Error #26853

Closed
mustafacalik opened this issue Jul 21, 2022 · 13 comments
Closed

Quarkus Tika Native Image Build Error #26853

mustafacalik opened this issue Jul 21, 2022 · 13 comments
Assignees
Labels

Comments

@mustafacalik
Copy link

mustafacalik commented Jul 21, 2022

Describe the bug

I use quarkus-tika and quarkus-awt dependecies. While i don't define parser parameter in application.properties, it gives the folowing error.

quarkus.tika.parsers=pdf

<dependency>
  <groupId>io.quarkiverse.tika</groupId>
  <artifactId>quarkus-tika</artifactId>
  <version>1.0.3</version>
</dependency>
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-awt</artifactId>
  <version>2.10.1.Final</version>
</dependency>

Fatal error: org.graalvm.compiler.debug.GraalError: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image runtime. To see how this object got instantiated use --trace-object-instantiation=org.apache.sis.internal.system.DelayedExecutor.

As a solution, i gave the package as initilize-at-run-time parameter but after that it continues to give error

quarkus.native.additional-build-args=--initialize-at-run-time=org.apache.sis.internal.system\,ucar.nc2.grib.grib2

Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: ucar.nc2.grib.grib2.Grib2JpegDecoder.<init>(int, boolean). This error is reported at image build time because class ucar.nc2.grib.grib2.Grib2DataReader2 is registered for linking at image build time by command line
Detailed message:
Trace: 
        at parsing ucar.nc2.grib.grib2.Grib2DataReader2.getData40(Grib2DataReader2.java:727)
Call path from entry point to ucar.nc2.grib.grib2.Grib2DataReader2.getData40(RandomAccessFile, Grib2Drs$Type40): 
        at ucar.nc2.grib.grib2.Grib2DataReader2.getData40(Grib2DataReader2.java:716)
        at ucar.nc2.grib.grib2.Grib2DataReader2.getData(Grib2DataReader2.java:109)
        at ucar.nc2.grib.grib2.Grib2Record.readData(Grib2Record.java:321)
        at ucar.nc2.grib.collection.Grib2Iosp.readData(Grib2Iosp.java:405)
        at ucar.nc2.grib.collection.GribIosp$DataReader.read(GribIosp.java:940)
        at ucar.nc2.grib.collection.GribIosp.readDataFromCollection(GribIosp.java:860)
        at ucar.nc2.grib.collection.GribIosp.readData(GribIosp.java:810)
        at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:1986)
        at ucar.nc2.Variable.reallyRead(Variable.java:860)
        at ucar.nc2.Variable._read(Variable.java:831)
        at ucar.nc2.Variable.read(Variable.java:709)
        at ucar.nc2.NCdumpW.printVariableData(NCdumpW.java:386)
        at ucar.nc2.dt.grid.GridCoordSys.showCoords(GridCoordSys.java:1405)
        at ucar.nc2.dt.grid.GridCoordSys.show(GridCoordSys.java:1355)
        at ucar.nc2.dt.grid.GridCoordSys.toString(GridCoordSys.java:1345)
        at sun.java2d.loops.GraphicsPrimitive.simplename(GraphicsPrimitive.java:599)
        at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY_GraphicsPrimitive_simplename_202a3eedb200439fc8661f318bfce7d323ea7603(generated:0)

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

remove quarkus.tika.parsers and mvn clean install -Dnative

Output of uname -a or ver

No response

Output of java -version

openjdk 11.0.13 2021-10-19

GraalVM version (if different from Java)

graalvm-ce-java11-22.1.0

Quarkus version or git rev

2.10.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3

Additional information

No response

@mustafacalik mustafacalik added the kind/bug Something isn't working label Jul 21, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 21, 2022

/cc @Karm, @galderz, @sberyozkin, @zakkak

@mustafacalik mustafacalik changed the title Quarkus Tika Ntiva Image Build Error Quarkus Tika Native Image Build Error Jul 21, 2022
@zakkak
Copy link
Contributor

zakkak commented Jul 21, 2022

Hello @mustafacalik

I tried reproducing this with no success, can you please provide more details on how to reproduce?

What I tried:

wget "https://code.quarkus.io/d?e=awt&e=io.quarkiverse.tika%3Aquarkus-tika&cn=code.quarkus.io" -O code.zip
unzip code.zip 
cd code-with-quarkus
mvn clean install -Dnative

The application.properties when doing this is empty, so quarkus.tika.parsers is not set. I tried setting it to pdf as well and still couldn't reproduce.

@zakkak zakkak added triage/needs-reproducer We are waiting for a reproducer. area/native-image labels Jul 21, 2022
@mustafacalik
Copy link
Author

When I tried it with "https://code.quarkus.io/d?e=awt&e=io.quarkiverse.tika%3Aquarkus-tika&cn=code.quarkus.io", i didn't get any error building as native image.
But when I added a code block to use Tika parser, i continued to give same error.

To reproduce it add the folowing dependency and code block.

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-reactive</artifactId>
    </dependency>
@Path("/parse")
public class TikaParserResource {
    private static final Logger log = Logger.getLogger(TikaParserResource.class);

    @Inject
    TikaParser parser;

    @POST
    @Path("/text")
    @Produces(MediaType.TEXT_PLAIN)
    public String extractText(InputStream stream) {
        Instant start = Instant.now();
        String text = "empty";
        try {
            text = parser.getText(stream);
        } catch (Exception e) {
            log.info("error" + e);
            text = "error";
        }
        Instant finish = Instant.now();
        log.info(Duration.between(start, finish).toMillis() + " mls have passed");
        return text;
    }
}

@sberyozkin
Copy link
Member

@mustafacalik Thanks, let me move this issue to the quarkus-tika project

@sberyozkin
Copy link
Member

@gsmet, I can not select/choose https://github.com/quarkiverse/quarkus-tika in Transfer Issue, can you please add it to the list of repositories there if possible ?

@knuspertante
Copy link

I have the same issue ;-) See: #25526 it comes only for quarkus version > 2.7 and --link-at-build-time

Probably this oracle/graal#4661 will help.

@gsmet
Copy link
Member

gsmet commented Jul 28, 2022

@sberyozkin you can only transfer issues inside the same organization. Given quarkiverse is a separate org, you will have to copy the information and close this one.

@mustafacalik
Copy link
Author

I have the same issue ;-) See: #25526 it comes only for quarkus version > 2.7 and --link-at-build-time

Probably this oracle/graal#4661 will help.

I have tried with quarkus 2.7.5.Final and GraalVM 22.1.0 but no change. The problem continues to exist.

@knuspertante
Copy link

Are you sure, that you are using GraalVM 22.1.0? Could you pls try it again with --allow-incomplete-classpath as additional build arg?

@galderz
Copy link
Member

galderz commented Jul 29, 2022

@sberyozkin I've assigned the issue to you for now so that it's clear who's on it. Ping me if need a hand (@zakkak is away next few weeks).

@knuspertante
Copy link

@galderz I think this issue could be closed because @mustafacalik opened a new issue here quarkiverse/quarkus-tika#51

This issue could be also related: quarkiverse/quarkus-tika#36

@sberyozkin
Copy link
Member

Ok @knuspertante, thanks

@sberyozkin
Copy link
Member

sberyozkin commented Jul 29, 2022

Thanks @galderz - I'm finding it hard right now to find the time for dealing with Tika issues, but we are quite close on the Tika 2 update, will try Guillaume's suggestion once I'm back from PTO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants