SBCL crashes when run-program is called repeatedly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Test case: The following function calls run-program repeatedly.
(defun bug (n)
(dotimes (i n)
(format t "~6D~%" i)
(sb-
When calling (bug 10000), SBCL crashes at iteration 1016 like this:
fatal error encountered in SBCL pid 275652 tid 275652:
can't run-program
Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb> ba
Backtrace:
0: fp=0x7fd2e5bff140 pc=0x563afa1d1851 Foreign function (null)
1: fp=0x7fd2e5bff2a0 pc=0x563afa1d2317 Foreign function ldb_monitor
2: fp=0x7fd2e5bff2b0 pc=0x563afa1cd34a Foreign function (null)
3: fp=0x7fd2e5bff3a0 pc=0x563afa1cd4e3 Foreign function (null)
4: fp=0x7fd2e5bff490 pc=0x563afa1dc3e1 Foreign function spawn
5: fp=0x7fd2e5bff590 pc=0x52f41b79 SB-IMPL::SPAWN
6: fp=0x7fd2e5bff618 pc=0x52a2b220 (FLET "WITHOUT-
7: fp=0x7fd2e5bff6a0 pc=0x52a2b039 SB-THREAD:
8: fp=0x7fd2e5bff8e8 pc=0x534281de SB-EXT::RUN-PROGRAM
9: fp=0x7fd2e5bff920 pc=0x5342b33c CL-USER::BUG
10: fp=0x7fd2e5bff9e8 pc=0x52b4c4b7 SB-INT:
11: fp=0x7fd2e5bffa00 pc=0x52a49e23 EVAL
12: fp=0x7fd2e5bffa50 pc=0x52ba0955 SB-EXT:
13: fp=0x7fd2e5bffaa0 pc=0x532c4724 SB-IMPL::REPL-FUN
14: fp=0x7fd2e5bffba0 pc=0x52ba2b6b (LAMBDA () :IN SB-IMPL:
15: fp=0x7fd2e5bffc10 pc=0x52e347c8 SB-IMPL:
16: fp=0x7fd2e5bffca8 pc=0x52ba289d SB-IMPL:
17: fp=0x7fd2e5bffdc0 pc=0x52ba1eaa SB-IMPL:
18: fp=0x7fd2e5bffe60 pc=0x52f458a9 (FLET SB-UNIX::BODY :IN SB-IMPL:
19: fp=0x7fd2e5bfff28 pc=0x52f456a7 (FLET "WITHOUT-
20: fp=0x7fd2e5bfffc8 pc=0x52f45453 SB-IMPL:
It doesn't matter what program is run by the function.
If :output is nil, the bug is not triggered.
SBCL version: 2.2.5
> uname -a
Linux calvin 5.16.0-
*features*
(:X86-64 :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-
:LITTLE-ENDIAN :PACKAGE-
:SB-UNICODE :SBCL :UNIX)
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
You are running out of FDs for the streams. You need
(let ((process (sb-ext:run-program "/usr/bin/touch" (list "/dev/null") :output :stream))) process- close process))
(sb-ext: