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.

java.lang.VerifyError: Illegal type at constant pool entry 156 in class 'etc'

See original GitHub issue

Hi there, I’m using the following code to read a Databuffer flux in string boot using coroutines and accumulate bytes in an intermediate buffer (because S3 multipart async upload requires 5MB part minimum). Using fold in the flow from created from the flux produces this exception.

This run perfectly when launching the server using ./gradlew bootRun but breaks when running java -jar xxx.jar when the jar was produced via ./gradlew bootJar because the BootRun task adds -Xverify:none and -XX:TieredStopAtLevel=1 to the jvm args.

Exception in thread "sdk-async-response-0-0" kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for CancellableContinuation(DispatchedContinuation[Unconfined, Continuation at com.talkdesk.api.reporting.exploreemail.services.ExternalStorageService.initiateMultipartUpload(ExternalStorageService.kt:147)@4cdabf65]){CreateMultipartUploadResponse(Bucket=td-infra-stg-us-east-1-s3-reportingexplore-email-files, Key=The-A-Team/2019-09-13/ca513e2283a0406ba7bfc950d659c429.csv, UploadId=a93JiolPp5fFcjTkb0AUxf7WmRwqW_xAx.lM47PvPaO.q6vXDuoMifUX8mKpWM1NFx2vmvmh9bpW_hiiki6loL9JRoYlEGLoh3OFuo8G6bLVIjUDuVP5p8lV2HUhyZC_, ServerSideEncryption=AES256)}@6ff72e73. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
	at kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx_coroutines_core(Dispatched.kt:278)
	at kotlinx.coroutines.DispatchedKt.resumeUnconfined(Dispatched.kt:415)
	at kotlinx.coroutines.DispatchedKt.dispatch(Dispatched.kt:298)
	at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:250)
	at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:260)
	at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:189)
	at kotlinx.coroutines.future.ContinuationConsumer.accept(Future.kt:178)
	at kotlinx.coroutines.future.ContinuationConsumer.accept(Future.kt:170)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncApiCallTimeoutTrackingStage.lambda$execute$2(AsyncApiCallTimeoutTrackingStage.java:69)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryExecutor.retryResponseIfNeeded(AsyncRetryableStage.java:136)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryExecutor.retryIfNeeded(AsyncRetryableStage.java:120)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.AsyncRetryableStage$RetryExecutor.lambda$execute$0(AsyncRetryableStage.java:107)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
	at software.amazon.awssdk.core.internal.http.pipeline.stages.MakeAsyncHttpRequestStage.lambda$executeHttpRequest$1(MakeAsyncHttpRequestStage.java:138)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.VerifyError: Illegal type at constant pool entry 156 in class REDACTED$upload$$inlined$fold$1
Exception Details:
  Location:
    REDACTED$upload$$inlined$fold$1.emit(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; @274: invokestatic
  Reason:
    Constant pool index 156 is invalid
  Bytecode:
    ${REDACTED}
  Stackmap Table:
    same_frame(@36)
    append_frame(@46,Object[#48])
    append_frame(@84,Object[#5],Object[#5])
    full_frame(@225,{Object[#2],Object[#5],Object[#79],Object[#48],Object[#5],Object[#5],Object[#48],Object[#5],Integer,Object[#79],Object[#81],Object[#83],Object[#74],Integer,Integer},{})
    same_locals_1_stack_item_frame(@227,Object[#83])
    full_frame(@386,{Object[#2],Object[#5],Object[#79],Object[#48],Object[#5],Object[#5]},{})
    full_frame(@481,{Object[#2],Object[#5],Object[#79],Object[#48],Object[#5],Object[#5],Object[#48],Object[#5],Top,Object[#79],Object[#81],Object[#83],Object[#74],Top,Integer,Top,Object[#83],Object[#207]},{Object[#5]})
    chop_frame(@499,1)
    full_frame(@550,{Object[#2],Object[#5],Object[#79],Object[#48],Object[#5],Object[#5]},{})

	at REDACTED.upload$suspendImpl(ExternalStorageService.kt:174)
	at REDACTED$upload$2.invokeSuspend(ExternalStorageService.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.ResumeModeKt.resumeMode(ResumeMode.kt:67)
	at kotlinx.coroutines.DispatchedKt.resume(Dispatched.kt:319)
	at kotlinx.coroutines.DispatchedKt.resumeUnconfined(Dispatched.kt:49)
	... 29 more

Dependencies:

id("org.springframework.boot") version "2.2.0.M5"
id("io.spring.dependency-management") version "1.0.8.RELEASE"
kotlin("jvm") version "1.3.50"
kotlin("plugin.spring") version "1.3.41"
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-data-jdbc")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.3.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:1.3.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive:1.3.1")
val flow = WebClient
                .builder()
                .baseUrl("some_url")
                .build()
                .get()
                .retrieve()
                .bodyToFlux(DataBuffer::class.java)
                .asFlow()

flow.fold(ByteBuffer.allocate(intermediateBufferLength), { buffer, value -> {
            
///Eventually I call the AWS async client

s3AsyncClient.uploadPart(
        UploadPartRequest.builder()
                .bucket(bucketName)
                .key(key)
                .partNumber(partNumber)
                .uploadId(uploadId)
                .build(),
        asyncRequestBody
).await()

})

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
qwwdfsadcommented, Jan 15, 2020

@mkulak Thanks for the reproducer! As a workaround, you can replace body.map { Buffer.buffer(it) } with

private fun ByteArray.toBuffer() = Buffer.buffer(this)

// sendRequest body, line 36
body.map { it.toBuffer() }

in sendRequest

It appears to be a problem during inlining of bytecode complied with different javac version

0reactions
vikasrathorecommented, Apr 1, 2020

@qwwdfsad please check this i am getting this issue in production build Fatal Exception: java.lang.VerifyError: kotlinx/coroutines/bv$c

Read more comments on GitHub >

github_iconTop Results From Across the Web

JVM Verify Error 'Illegal type at constant pool' - Stack Overflow
The compiler has no problem parsing, linking or compiling the code, but when it comes to executing it, the JVM throws the following...
Read more >
constant pool errors with -target 1.7 and static default methods
VerifyError : Illegal type at constant pool entry 7 in class Dummy Exception Details: Location: Dummy.main([Ljava/lang/String;)V @24: invokestatic Reason: ...
Read more >
Illegal type in constant pool - Oracle Communities
I need your help. Which generally is the root cause of the following message: "Exception in thread "main" java.lang.VerifyError: (class: test ...
Read more >
New src/share/vm/classfile/classFileParser.cpp
153 "This JVM does not support constant tag %u in class file %s" : 154 "Class ... 443 "Bad method handle kind at...
Read more >
The class File Format - Mobilefish.com
Signatures are used to encode Java programming language type information ... 2 In retrospect, making 8-byte constants take two constant pool entries was...
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