Re: incorrect value with socket stream and open-stream-p
"John DeSoi (as john at desoi dot dev)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <0100019cc912cf1f-b456a143-a496-4f3e-b5d8-72a847171cff-000000@email.amazonses.com> |
Hi Martin, I think I figured it out. I was testing use of a weak hash table free function to cleanup database connections not closed due to programming or other errors. My connection instance had the only reference to the socket stream. Perhaps the stream gets closed automatically when it has no references? I solved it by creating a second reference to the socket stream that persists until it its removed from the database connection after disconnect. Thanks very much for your help. John DeSoi, Ph.D. > On Mar 6, 2026, at 2:11 PM, Martin Simmons <[email protected]> wrote: > > Connecting, using and disconnecting a socket stream from different processes > should be OK as long as you don't do that simultaneously. Looking at the > code, I can't see any way that OPEN-STREAM-P could return nil (and I/O could > get STREAM-CLOSED-ERROR) if nothing has called CLOSE on the stream. > > The STREAM::OPEN-P slot in COMM:SOCKET-STREAM isn't actually used to record > that state, so it will always be T. > > What is the printed representation of the STREAM::BUFFER-STATE slot when you > get the unexpected error?