JHSDB(1)

πŸ“¦ version 22.0.2.0, in opensuse-leap 16.0

πŸ’… JHSDB(1) β€” the manual, but make it make sense πŸ’…

Okay so bestie, this is the jhsdb command, and it's from the JDK (specifically JDK 22, dated 2024, but we'll get to that later). Think of this as your ultimate cheat sheet for attaching to Java processes and doing postmortem detective work on crashed JVMs. Periodt.


✨ NAME ✨

jhsdb β€” attach to a Java process or launch a postmortem debugger to analyze the content of a core dump from a crashed Java Virtual Machine (JVM). πŸ’€πŸ”


🌸 SYNOPSIS 🌸

Okay so here's the deal, these are all the ways you can call this tool:

jhsdb clhsdb [--pid pid | --exe executable --core coredump]

jhsdb hsdb [--pid pid | --exe executable --core coredump]

jhsdb debugd (--pid pid | --exe executable --core coredump) [options]

jhsdb jstack (--pid pid | --exe executable --core coredump | --connect
[server-id@]debugd-host) [options]

jhsdb jmap (--pid pid | --exe executable --core coredump | --connect
[server-id@]debugd-host) [options]

jhsdb jinfo (--pid pid | --exe executable --core coredump | --connect
[server-id@]debugd-host) [options]

jhsdb jsnap (--pid pid | --exe executable --core coredump | --connect
[server-id@]debugd-host) [options]

And here's what all those bits mean, explained like your bestie would:

  • pid β€” The process ID to which the jhsdb tool should attach. Lowkey important: the process must be a Java process, no cap. To get a list of Java processes running on a machine, use the ps command or, if the JVM processes are not running in a separate docker instance, the jps command. πŸ’»βœ¨
  • executable β€” The Java executable file from which the core dump was produced. Basically, which Java was running when things went πŸ’€.
  • coredump β€” The core file to which the jhsdb tool should attach. It's giving forensic evidence at the scene. πŸ•΅οΈβ€β™€οΈ
  • [server-id@]debugd-host β€” An optional server ID and the address of the remote debug server (debugd). Like, if you're connecting to your friend's debug server, you use this.
  • options β€” The command-line options for a jhsdb mode. See Options for the debugd Mode, Options for the jstack Mode, Options for the jmap Mode, Options for the jinfo Mode, and Options for the jsnap Mode below. πŸ“‹
Note, bestie: Either the pid or the pair of executable and core files or the [server-id@]debugd-host must be provided for debugd, jstack, jmap, jinfo and jsnap modes. No exceptions, fr fr. πŸ™…β€β™€οΈ

πŸ¦‹ DESCRIPTION πŸ¦‹

So you can use the jhsdb tool to attach to a Java process or to launch a postmortem debugger to analyze the content of a core-dump from a crashed Java Virtual Machine (JVM). This command is experimental and unsupported, which honestly is giving "use at your own risk" energy. πŸ§ͺ✨

Warning warning warning! 🚨 Attaching the jhsdb tool to a live process will cause the process to hang and the process will probably crash when the debugger detaches. This is not a drill, bestie. It's literally in the manual. Don't say I didn't warn you. πŸ˜­πŸ’€

The jhsdb tool can be launched in any one of the following modes:

  • jhsdb clhsdb β€” Starts the interactive command-line debugger. Old school but slaps.
  • jhsdb hsdb β€” Starts the interactive GUI debugger. For when you want vibes AND visuals. πŸ–₯️✨
  • jhsdb debugd β€” Starts the remote debug server. The main character of remote debugging. πŸ‘‘
  • jhsdb jstack β€” Prints stack and locks information. Like a little snapshot of what's going on. πŸ“Έ
  • jhsdb jmap β€” Prints heap information. All the memory tea. β˜•
  • jhsdb jinfo β€” Prints basic JVM information. The essentials, no fluff.
  • jhsdb jsnap β€” Prints performance counter information. Numbers that go brrr. πŸ“Š
  • jhsdb command --help β€” Displays the options available for the command. When in doubt, ask for help. πŸ™‹β€β™€οΈ

πŸ’– OPTIONS FOR THE DEBUGD MODE πŸ’–

Okay so debugd is the remote debug server mode, and here are all the flags you can use with it:

  • --serverid server-id β€” An optional unique ID for this debug server. This is required if multiple debug servers are run on the same machine. So like, if you've got multiple servers, you gotta give them names so they don't get confused. 🏷️
  • --rmiport port β€” Sets the port number to which the RMI connector is bound. If not specified, a random available port is used. Slay, it picks for you. 🎲
  • --registryport port β€” Sets the RMI registry port. This option overrides the system property sun.jvm.hotspot.rmi.port. If not specified, the system property is used. If the system property is not set, the default port 1099 is used. So there's a whole hierarchy of who decides, and this flag is the boss. πŸ‘‘
  • --hostname hostname β€” Sets the hostname the RMI connector is bound. The value could be a hostname or an IPv4/IPv6 address. This option overrides the system property java.rmi.server.hostname. If not specified, the system property is used. If the system property is not set, a system hostname is used. Again, hierarchy. The more you know. 🌐

πŸŽ€ OPTIONS FOR THE JINFO MODE πŸŽ€

jinfo is like the info-dump mode, and here's what you can ask for:

  • --flags β€” Prints the VM flags. All the settings. 🚩
  • --sysprops β€” Prints the Java system properties. The system tea. β˜•
  • no option β€” Prints the VM flags and the Java system properties. Both. Together. Iconic. ✨

⭐ OPTIONS FOR THE JMAP MODE ⭐

jmap is all about the heap, bestie. Here are your options:

  • no option β€” Prints the same information as Solaris pmap. Old school reference, but okay. πŸ—ΊοΈ
  • --heap β€” Prints the java heap summary. The TL;DR of your heap. πŸ“
  • --binaryheap β€” Dumps the java heap in hprof binary format. For when you need the raw data. πŸ’Ύ
  • --dumpfile name β€” The name of the dumpfile. Name your dump, bestie. 🏷️
  • --histo β€” Prints the histogram of java object heap. A little chart of what's taking up space. πŸ“Š
  • --clstats β€” Prints the class loader statistics. All the class loader numbers. πŸ“ˆ
  • --finalizerinfo β€” Prints the information on objects awaiting finalization. The objects in limbo. πŸ‘»

🌈 OPTIONS FOR THE JSTACK MODE 🌈

jstack is for stack and lock info, and here's what you can toggle:

  • --locks β€” Prints the java.util.concurrent locks information. Lock talk. πŸ”’
  • --mixed β€” Attempts to print both java and native frames if the platform allows it. Best of both worlds, if your platform is cool with it. 🀝

🧚 OPTIONS FOR THE JSNAP MODE 🧚

jsnap is the performance counter mode, and it's simple:

  • --all β€” Prints all performance counters. All of them. No filter. πŸ’…

And that's the whole vibe, bestie. This iconic manual page is from JDK 22, dated 2024, and it's literally the moment for anyone doing JVM detective work. Go forth and debug responsibly. πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from