ghidra-jython-kernel icon indicating copy to clipboard operation
ghidra-jython-kernel copied to clipboard

Fixes timeout issues and garbled output issues

Open rhythmx opened this issue 3 years ago • 0 comments

I've been using this code recently to shoehorn some things into Ghidra by way of Jupyter and have come across a few issues.

  1. The default pexpect.TIMEOUT value causes long-running commands to break the kernel with an exception such as:
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
...
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f8e787d9a20>
command: /usr/lib/jvm/java-11-openjdk/bin/java
...

This can be resolved by adding a very large timeout or catching the exception and retrying the expect call.

  1. A few issues with matching the Python repl prompts ("..." or ">>>") and terminal control characters can quickly cause the Kernel to become de-synchronized and start inserting garbled result blocks into notebooks. This can be resolved with some extra logic around execution and output matching.

rhythmx avatar Apr 13 '22 22:04 rhythmx