1

I've run jcmd <pid> VM.info diagnostic command on my Clojure application running in a Docker container - here's the basic system info:

# JRE version: OpenJDK Runtime Environment (11.0.1+13) (build 
11.0.1+13-Ubuntu-3ubuntu3.18.10.1)
# Java VM: OpenJDK 64-Bit Server VM (11.0.1+13-Ubuntu-3ubuntu3.18.10.1, 
mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)

One thing I've noticed is the Internal exceptions (10 events) section where I've found several instances of following exception:

Classes redefined (0 events):
No events

Internal exceptions (10 events):
Event: 4103.838 Thread 0x00007f800400c800 Exception <a 'java/lang/ClassCastException'{0x00000000c78ba0b0}: class clojure.lang.Keyword cannot be cast to class java.lang.CharSequence (clojure.lang.Keyword is in unnamed module of loader 'app'; java.lang.CharSequence is in module java.base of loader
...

Now I'm wondering what these "Internal exceptions" really are. Is that something thrown in my application code and perhaps silently ignored? Can I get more info (perhaps a stacktrace) about them?

I tried to dig into JDK source code but couldn't find as many details about the "Internal exceptions". The only thing I've found is the VMError::print_vm_info method and related _exceptions field in events.cpp

Juraj Martinka
  • 3,991
  • 2
  • 23
  • 25
  • This looks very much like these exceptions are internal to the clojure implementation, not to the JDK implementation. – Holger Apr 05 '19 at 11:55
  • That's true but still not very helpful because I have no clue where to start my investigation (my own clojure app? myriad of 3rd party libs? clojure lang itself?) It'd be very helpful if there was some way to get more information about those exceptions. – Juraj Martinka Apr 05 '19 at 13:52
  • I suppose, neither your application nor the JDK code would ever deal with a `clojure.lang.Keyword`, so it’s most likely the clojure implementation which tries to cast a `clojure.lang.Keyword` to `CharSequence`. Perhaps, there is a version where `clojure.lang.Keyword` truly implements `CharSequence` and you’ve linked incompatible library versions. – Holger Apr 05 '19 at 13:56
  • 1
    You can trace the source of such exceptions with [JVMTI agent](https://github.com/odnoklassniki/jvm-serviceability-examples/blob/master/src/demo4/agent/extrace.cpp). See [this answer](https://stackoverflow.com/a/23567931/3448419) for details. – apangin Apr 05 '19 at 16:25
  • What exactly are you hoping to find out? What event has caused you to run `jcmd VM.info`? If you are just running this for fun, and these exceptions are not something that surface as errors in your program, I would guess that there is nothing going on. For example, I just ran this command on a perfectly-well-behaved java process, and it shows 10 "internal exceptions" that don't seem to matter. If they *are* surfacing as errors in your program, I'd try to debug them from that angle first instead of from `jcmd`. – amalloy Apr 06 '19 at 00:00
  • @amalloy originally, I ran this only for "fun" - it wasn't something visible on the surface (or in logs). However, the system is quite complex and error can be hidden somewhere deep inside it; so it might be a real issue which has been silently ignored. – Juraj Martinka Apr 08 '19 at 08:16
  • @apangin Thanks for the idea - this looks like what I'm after. – Juraj Martinka Apr 08 '19 at 11:51

0 Answers0