-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Coroutine is (currently) hard to debug #3198
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
Comments
Hi,
The "minimal" and "acceptable" overhead is a very application specific term, that depends on application SLA and other various factors, so I suggest you to figure it yourself whether it's acceptable. On other side, we've optimized debugging agent to some reasonable extent. The slowest part is collection of creation stacktraces, that can (probably even "should" for production environments) be completely disabled either programmatically or using a system property if you are running as
Could you please elaborate on why you need JVMTI library and why agent JAR is not enough?
In typical systems there are from hundreds to thousands coroutines with arbitrary depths. Enabling parent-child relationship (e.g. by properly nesting stacktrace) will render it unusable, taking into account 10-100+ levels of nesting. The better solution, IMO, is to provide a proper, stable and convenient customization points, so this is easily achievable manually if necessary
I think so, not sure what was the original reason
Because there wasn't any real demand on that before and adding this originally was a non-trivial task. For now it seems already here, just not exposed in public API. It would be nice if you could file a separate issue with a short explanation of your use-case, so we can fix it separately from debug agent |
@qwwdfsad thanks for the reply Maintaining a native library is indeed a pain, and that is a reason why bundle it in the library makes it easier for the user. The JVMTI code however should be minimal, just set a flag that can be read inside coroutine debug's java library, and then java code produces a coroutine dump. But you've made a point too, if this easy debug feature is not of much use, it could indeed burden the library. I'll be searching for other ways to monitor SIGQUIT in the meantime. |
I'm closing this as it breaks down into multiple issues -- some of them fixed, some of them are being worked on a separate basis (i.e. #3587), and JVMTI is unlikely to ever implemented by us |
I'm making extensive use of coroutines, replacing
thread
calls and use structured concurrency as suggested. however I found coroutines very hard to debug. usingorg.jetbrains.kotlinx:kotlinx-coroutines-debug:1.6.0
along with-jdk8
,-core
both at1.6.0
, which is the latest version as of writingSIGTRAP
but usingSIGQUIT
matches the convention. see https://github.com/openjdk/jdk8u/blob/8d5c7386c619a2602d9731c4adbbb1b01aeb449f/hotspot/src/share/vm/runtime/os.cpp#L320dumpCoroutinesInfo
is not structured, no parent/child relation. and the printout doesn't end with line feed, which is an oversight maybe?Job.children
but noJob.parent
, is there a reason why? this makes constructing job graph very awkwardThe text was updated successfully, but these errors were encountered: