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.

JDWP exit error JVMTI_ERROR_NONE(0): getting frame location [stepControl.c:641]

See original GitHub issue

Hi, I have a issue with reloading a class when debugging with intelliJ

java source code:

package com.example;

import static net.bytebuddy.implementation.bytecode.assign.Assigner.Typing.DYNAMIC;

import java.lang.reflect.Method;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.asm.Advice.AllArguments;
import net.bytebuddy.asm.Advice.OnMethodEnter;
import net.bytebuddy.asm.Advice.OnMethodExit;
import net.bytebuddy.asm.Advice.Origin;
import net.bytebuddy.asm.Advice.Return;
import net.bytebuddy.asm.Advice.Thrown;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.dynamic.loading.ClassReloadingStrategy;

public class Main {

    public static void main(String[] args) {
        reloadClass(); // debug breakpoint here
        myMethod(); // debug breakpoint here
    }

    static void myMethod() {
        System.out.println("myMethod");
    }

    static void reloadClass() {
        try {
            ByteBuddyAgent.install();

            new ByteBuddy()
                .redefine(Main.class)
                .visit(Advice.to(MyAspect.class)
                    .on(MethodDescription::isMethod))
                .make()
                .load(Main.class.getClassLoader(), ClassReloadingStrategy.fromInstalledAgent());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }

    static class MyAspect {

        @OnMethodEnter(suppress = Throwable.class)
        public static void onEnter() {
            System.out.println("onEnter");
        }

        @OnMethodExit(suppress = Throwable.class, onThrowable = Throwable.class)
        public static void onExit(@Origin Method method,
                                  @AllArguments Object[] arguments,
                                  @Return(typing = DYNAMIC) Object returned,
                                  @Thrown Throwable exception) {
            System.out.println("onExit");
        }

    }

}

gradle source code:

plugins {
    id 'java'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    implementation "net.bytebuddy:byte-buddy:1.10.14"
    implementation "net.bytebuddy:byte-buddy-agent:1.10.14"
}

logs:

1:46:27 AM: Executing task 'Main.main()'...

Starting Gradle Daemon...
Connected to the target VM, address: '127.0.0.1:58808', transport: 'socket'
Gradle Daemon started in 1 s 278 ms
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
Connected to the VM started by ':Main.main()' (localhost:58813). Open the debugger session tab

> Task :Main.main()
JDWP exit error JVMTI_ERROR_NONE(0): getting frame location [stepControl.c:641]
Unhandled exception
Type=Segmentation error vmState=0x00000000

BUILD SUCCESSFUL in 8s
2 actionable tasks: 1 executed, 1 up-to-date
1:46:36 AM: Task execution finished 'Main.main()'.
Disconnected from the target VM, address: '127.0.0.1:58808', transport: 'socket'

byte-buddy and byte-buddy-agent version = 1.10.14

intelliJ IDEA version = 2020.2 ultimate edition

java version:

openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
Eclipse OpenJ9 VM (build openj9-0.15.1, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20190717_298 (JIT enabled, AOT enabled)
OpenJ9   - 0f66c6431
OMR      - ec782f26
JCL      - f147086df1 based on jdk8u222-b10)

gradle version:

------------------------------------------------------------
Gradle 5.1.1
------------------------------------------------------------

Build time:   2019-01-10 23:05:02 UTC
Revision:     3c9abb645fb83932c44e8610642393ad62116807

Kotlin DSL:   1.1.1
Kotlin:       1.3.11
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_222 (Eclipse OpenJ9 openj9-0.15.1)
OS:           Mac OS X 10.15.6 x86_64

I found a possibly similar question on stackoverflow with your comment:

I do not see how this can be an issue that is caused by Byte Buddy and in IntelliJ - which I use - I have not observed anything like that.

Is the issue with byte-buddy or is this expected behavior in debug or am I doing something wrong?

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
raphwcommented, Oct 24, 2020

Thanks, that’s a bug in the JVM, I filed it as https://bugs.openjdk.java.net/browse/JDK-8255376

0reactions
tsarenkotxtcommented, Oct 24, 2020

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

JDWP exit error JVMTI_ERROR_NONE(0) if redefining class ...
... under some conditions this error is raised: JDWP exit error JVMTI_ERROR_NONE(0): getting frame location [stepControl.c:641]
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