medley icon indicating copy to clipboard operation
medley copied to clipboard

Why is CLOSEALL no longer supported?

Open rmkaplan opened this issue 3 years ago • 6 comments

It bombs out if MULTIPLE-STREAMS-PER-FILE-ALLOWED is true.

What's wrong with closing all the streams, even if some files have been opened with multiple streams? Close them all.

rmkaplan avatar Aug 05 '22 06:08 rmkaplan

oh, maybe people didn't realize how unsafe it was?

for example Issue #319

Use (MAPC (OPENP) #'CLOSEF?)

masinter avatar Aug 05 '22 21:08 masinter

CLOSEALL won't do it if the stream has the CLOSEALL property (probably should be DONTCLOSEALL).

But it seems that this has nothing to do with whether there are multiple streams per file. It is perhaps unsafe for certain streams to be closed. The MAPC, which is what I do, has the same danger (more so, since it doesn't test a streamprop)

rmkaplan avatar Aug 05 '22 22:08 rmkaplan

CLOSEALL is up there with HARDRESET and is possibly more dangerous -- it closes all the streams of all the processes. Issue #319 comes up as something that can happen -- when you restart after a SaveVM or Sysout or Logout and you had a dribble file open, you get a stack overflow from trying to print the warning that a file was closed, but printing the warning to a closed file causes another error which tries to ... etc.

Allowing multiple streams per file was an attempt to solve a problem of making lisp thread-safe to a degree (without PREEMPTIVE scheduling) so each process could use files without worrying that some other process would open the same file and move around the file pointer (or close the file).

masinter avatar Aug 06 '22 17:08 masinter

There may be streams that are dangerous to close, and some of those may not even be registered in the list of open files that the various devices maintain (which is what CLOSEALL should look at, not the \OPENFILES variable). But the dangerous ones should be marked as not-closeall-able when they are created. Probably just the special streams that are set up in CLSTREAMS, and the dribble stream. I

On Aug 6, 2022, at 10:17 AM, Larry Masinter @.***> wrote:

CLOSEALL is up there with HARDRESET and is possibly more dangerous -- it closes all the streams of all the processes. Issue #319 https://github.com/Interlisp/medley/issues/319 comes up as something that can happen -- when you restart after a SaveVM or Sysout or Logout and you had a dribble file open, you get a stack overflow from trying to print the warning that a file was closed, but printing the warning to a closed file causes another error which tries to ... etc.

Allowing multiple streams per file was an attempt to solve a problem of making lisp thread-safe to a degree (without PREEMPTIVE scheduling) so each process could use files without worrying that some other process would open the same file and move around the file pointer (or close the file).

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/880#issuecomment-1207249825, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJLXK3GAC6BNTBGYZTTVX2M37ANCNFSM55U65WUQ. You are receiving this because you authored the thread.

rmkaplan avatar Aug 06 '22 18:08 rmkaplan

In fact, it would be better and a little bit safer if closeall also takes a host argument (CLOSEALL 'DSK), in addition to whatever filters there might be

rmkaplan avatar Aug 06 '22 19:08 rmkaplan

You asked why things were the way they were, and I was trying to answer the question. man CLOSEALL doesn't give any hints -- maybe in some release note?

masinter avatar Aug 06 '22 19:08 masinter

added in #1164

masinter avatar Apr 20 '23 16:04 masinter