It's possible but according to the documentation "wait" is only supposed to return a WIFCONTINUED status if the WCONTINUED flag is included. I've run some checks and "wait" sees the stopped process but doesn't return a result when the process is continued. I think it might be worth tightening up the code a little; currently "status" is not initialised but it ought to be valid if "wait" returns a non-zero value. Otherwise I can't really see what to do about this.

David

On 25/04/2016 14:20, James Clarke wrote:
Linux (since 2.6.10) does have a WIFCONTINUED(status), which checks if status 
== 0xffff; could this be the source of it?

James

On 25 Apr 2016, at 14:07, David Matthews <[email protected]> wrote:

I've found something to suggest that the 255 value can come from an invalid value being 
passed to "exit".  I don't understand, though, what this value says about the 
status of the process.  Has it exited or not?  It really seems to be an incompatibility 
between the design of the ML basis library which requires the exit status to match one of 
the cases and Linux which can generate a value that doesn't.

You can certainly handle the exception and use a value that makes sense.  From 
the Poly/ML side, though, I'd like to find out what this value actually 
represents and include it in the datatype.  It is possible that this is a bug 
in the code but I can't see how it can arise.

David

On 25/04/2016 13:16, Michael Norrish wrote:
I agree that it does seem to only happen on Linux.

There's code doing waiting at line 303 of

   
https://github.com/HOL-Theorem-Prover/HOL/blob/master/tools/Holmake/poly/ProcessMultiplexor.sml

In the Poly sources, the fromStatus function is also called in doWait (a few 
lines further down in basis/Posix.sml)

The HOL code does also call fromStatus, but after the call to waitpid_nh.  As 
it happens, the status codes are coming from poly/ml executables being called 
via fork/exec.

Could I just catch the Fail exn, and make the status a W_EXITSTATUS 
(Word8.fromInt 255)?  (Not that I think the child poly should be failing...)

Michael

On 25 Apr 2016, at 21:40, David Matthews <[email protected]> wrote:

Searching for Fail in the Posix code shows one situation where it could be 
raised.  Posix.Process.fromStatus converts a value of type OS.Process.status 
into a value of type exit_status.  exit_status is defined as
datatype exit_status =
   W_EXITED
|  W_EXITSTATUS of Word8.word
|  W_SIGNALED of signal
|  W_STOPPED of signal

The breaking out of the OS.Process.status is done in the run-time system using 
the WIFEXITED, WIFSIGNALED and WIFSTOPPED macros.  If none of these applies 
then the Fail exception will be raised.

I've run some tests on Debian Linux and it looks as though the value of 255 
fails to match any of these.  That doesn't seem to happen on Mac OS.  That 
raises the question of where this value is coming from and how it should be 
treated.  Does this seem to fit with your code?  Are you using 
Posix.Process.fromStatus and where is the value coming from?

David

On 21/04/2016 12:34, Michael Norrish wrote:
As can be seen in

   https://travis-ci.org/HOL-Theorem-Prover/HOL/jobs/124717527

our use of Posix waiting is occasionally causing a Fail exception to be raised 
from inside the Posix implementation (there's no Fail exception with that 
message in our source code, and our code *is* doing a wait at that point).

I'm afraid this doesn't seem easy to reproduce.

Michael


________________________________

The information in this e-mail may be confidential and subject to legal 
professional privilege and/or copyright. National ICT Australia Limited accepts 
no liability for any damage caused by this email or its attachments.
_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml


_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

_______________________________________________
polyml mailing list
[email protected]
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to