ECL swank server can hang when signaling condition
This scenario is rather complex, but I can replicate it almost every time by following this steps.
-
Start ECL with swank. Connect using slime.
-
compile-file the following (broken) code. No need to load it.
(in-package #:cl-user)
(ffi:clines "#include <sstream>")
(ffi:clines "#include <iostream>")
(ffi:clines "#include <cstring>")
(ffi:clines "#include <gc/gc_cpp.h>")
(defun c++hex (x)
(ffi:c-inline (x) (:int) :cstring "{
std::ostringstream out;
out << std::hex << #0;
iambroken :(
@(return) = new (GC) char[out.str().size() + 1];
strcpy(@(return), out.str().c_str());
}"))
-
type inside slime repl unbound symbol. Debugger will pop out. Choose to abort (option 2).
-
Repeat step 3 few times (usually 2 or 3 is enough).
-
After performing step 4, at some point slime repl will stop responding and ECL process will appear to get frozen on blocking read system call (debugged using both strace and GDB).
There is also another way to replicate this issue. Try to simply compile this file few times. At some point you should get to the step 5.
My setup: arch linux x86_64 with GCC 6.3.1 (also replicated on ubuntu with unknown GCC version), head of master from swank repoistory. ECL both 16.1.13 and 16.1.12 built from source using --with-cxx option.