question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native Build fails by ByteBuffer usage via google-cloud-pubsub

See original GitHub issue

Describe the bug On Java non native mode works fine, but fails at native image generation by : Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a direct/mapped ByteBuffer in the image heap. A direct ByteBuffer has a pointer to unmanaged C memory, and C memory from the image generator is not available at image run time.A mapped ByteBuffer references a file descriptor, which is no longer open and mapped at run time. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image run time by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point. Detailed message: Trace: Object was reached by reading field io.grpc.netty.shaded.io.netty.buffer.PoolChunk.memory of constant io.grpc.netty.shaded.io.netty.buffer.PoolChunk@1f2001b6 reached by reading field io.grpc.netty.shaded.io.netty.buffer.PoolChunkList.head of constant io.grpc.netty.shaded.io.netty.buffer.PoolChunkList@3faa2618 reached by .... Expected behavior Be able to compile native image witn google-pubsub maven dependecies

Actual behavior fails

To Reproduce Steps to reproduce the behavior:

  1. Clone this repohttps://github.com/danipenaperez/issue-quarkus-google-pubsub (it is so simple ,generated from quarkus greeting artifact example) , and added google-pub-sub library. Only one java class exists.
  2. Execute native compilation : mvn package -Pnative
  3. See the failed stack trace

Configuration

# Add your application.properties here, if applicable.
defaults from greeting artifact generation quarkus

Screenshots (If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver:Linux dpena 4.4.0-189-generic #219-Ubuntu SMP Tue Aug 11 12:26:50 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • Output of java -version: openjdk version “11.0.1” 2018-10-16 OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-3ubuntu116.04ppa1)

  • GraalVM version (if different from Java): graalvm-ce-java11-20.1.0

  • Quarkus version or git rev: 1.7.0.Final

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

Additional context (Add any other context about the problem here.)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
loicmathieucommented, Sep 11, 2020

@danipenaperez google-cloud-pubsub is not yet supported by Quarkus, there is no extension for it.

Normally, you would need to refer this issue on Google Cloud PubSub side or try to make native works by yourself …

But, your are lucky 😉 I start working on adding support for Google Cloud PubSub some times ago and we might have an extension soon or later on Quarkus. The PR is #9745

0reactions
gastaldicommented, Oct 21, 2020

Closing this issue as it’s supported by the extension mentioned in https://github.com/quarkusio/quarkus/issues/12047#issuecomment-697627732

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to convert payload of type <class-name> to byte[] for ...
maps payloads of type byte[], ByteString, ByteBuffer, and String to Pub/Sub messages. Change: pubSubTemplate.publish(topicName, data);. To:
Read more >
Fixing Java's ByteBuffer native memory "leak" (evanjones.ca)
Run services with -Djdk.nio.maxCachedBufferSize=262144 to avoid this problem.] The full story. The Java NIO APIs use ByteBuffers as the source ...
Read more >
Class PubsubMessage (1.121.1) | Java client library
A message that is published by publishers and consumed by subscribers. The message must contain either a non-empty data field or at least...
Read more >
Spring Cloud GCP
Write and read from Spring Resources backed up by Google Cloud Storage. Exchange messages with Spring Integration using Google Cloud Pub/Sub on the...
Read more >
So You Want to Optimize gRPC - Part 2
How fast is gRPC? Pretty fast if you understand how modern clients and servers are built. In part 1, I showed how to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found