-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GAP package sglppow
causes stuck subprocess and fgets() failed with errno 5
#4136
Comments
I had observed the same problem, and mentioned it first in a comment for #3478 and then in oscar-system/GAP.jl/issues/971; the solution seemed to be to use GAP 4.13, which we do now. |
On Linux one can easily reproduce this multiple time by executing The That GAP package also does this: BindGlobal( "CloseSingular", function ( )
if IsStream( Sing_Proc ) then
if not IsClosedStream( Sing_Proc ) then
WriteLine( Sing_Proc, ";quit;" );
CloseStream( Sing_Proc );
else
Info( InfoSingular, 2, "Singular already closed." );
fi;
fi;
# after closing Singular, the names become out of date.
SingularNamesThisRing := ShallowCopy( SingularNames );
end );
# Kill Singular when Gap terminates
InstallAtExit( CloseSingular ); So when we exit, it calls In my tests, inserting a 10 milliseconds delay between Indeed the GAP kernel code behind static Obj FuncCLOSE_PTY_IOSTREAM(Obj self, Obj stream)
{
UInt pty = HashLockStreamIfAvailable(stream);
// Close down the child
int status;
kill(PtyIOStreams[pty].childPID, SIGTERM);
int retcode = close(PtyIOStreams[pty].ptyFD);
if (retcode)
Pr("Strange close return code %d\n", retcode, 0);
// GAP (or another library) might wait on this PID before
// we handle it. If that happens, waitpid will return -1.
retcode = waitpid(PtyIOStreams[pty].childPID, &status, WNOHANG);
if (retcode == 0) {
// Give process a second to quit
sleep(1);
retcode = waitpid(PtyIOStreams[pty].childPID, &status, WNOHANG);
}
if (retcode == 0) {
// Hard kill process
kill(PtyIOStreams[pty].childPID, SIGKILL);
retcode = waitpid(PtyIOStreams[pty].childPID, &status, 0);
}
PtyIOStreams[pty].inuse = 0;
FreeStream(pty);
HashUnlock(PtyIOStreams);
return 0;
} I gotta read up on POSIX semantics to figure out what we really should be doing there (I didn't write that code). |
(To clarify: I wrote "pipe" above, but GAP doesn't really open a pipe, it uses pseudo ttys instead) |
... to avoid hang when calling StopSingular(). See also <oscar-system/Oscar.jl#4136>
... to avoid hang when calling StopSingular(). See also <oscar-system/Oscar.jl#4136>
... to avoid hang when calling StopSingular(). See also <oscar-system/Oscar.jl#4136>
Describe the bug
As reported on slack by @paemurru, since today when exiting julia we get a weird error message:
It does not happen every time but quite often.
This seems to be caused by #3517, once I comment this line
the issue disappears.
This error print is not from the julia process but from a (stuck?)
singular
subprocess that is started when Oscar is loaded:I do not see this subprocess once I remove the
sglppow
package fromOscar.jl
.Attaching
strace
to thesingular
subprocess shows that this is indeed the source of this message:To Reproduce
System (please complete the following information):
Oscar from today, e.g. 55ea957 or 38f37bc.
You might need to have some version of
singular
in the path for this to happen.cc: @paemurru @ThomasBreuer
The text was updated successfully, but these errors were encountered: