Bug #669485 reported by Josh Elsasser on 2010-11-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

The current spawn() function in src/runtime/run-program.c appears to be subtly wrong on OpenBSD when used with a pty, and can cause the parent SBCL process to hang. This happens when the child exits before the parent process closes the *CLOSE-IN-PARENT* descriptors, specifically the descriptor for the slave side of the pty. In this case, the close blocks indefinitely.

Using the recommended method to set the controlling terminal seems to work better, and didn't cause any hangs in my 100,000-iteration test program. Attached is a patch which does this, tested on OpenBSD/amd64 and Linux/i386.

James Y Knight (foom) wrote :

It seems wrong to set the controlling terminal only on OpenBSD, and not on other OSes. That's a rather subtle change in behavior that should be documented and work the same on all Unix-like OSes.

Josh Elsasser (josh-elsasser) wrote :

Unless I'm mistaken, it does set the controlling terminal on other OSes. The method being used even seems to work on OpenBSD, albeit with a race condition:

CL-USER> (values (with-output-to-string (s)
                   (run-program "/usr/bin/tty" nil :pty s :wait t))

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
importance: Undecided → Medium
status: New → Triaged
Changed in sbcl:
status: Triaged → In Progress
tags: removed: review
Nikodemus Siivola (nikodemus) wrote :


Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers