legacy icon indicating copy to clipboard operation
legacy copied to clipboard

CM.make sometimes exits with status 127

Open pclayton opened this issue 3 years ago • 0 comments

Version

Pre-110.97

Operating System

  • [ ] Any
  • [ ] Linux
  • [ ] macOS
  • [X] Windows
  • [ ] Other Unix

OS Version

Windows 10 and 11, MSYS2

Processor

  • [ ] Any
  • [ ] Arm (using Rosetta)
  • [ ] PowerPC
  • [ ] Sparc
  • [ ] x86 (32-bit)
  • [X] x86-64 (64-bit)
  • [ ] Other

System Component

Compilation manager (CM)

Severity

Minor

Description

Using 110.85, the CM.make command to build a large code base sometimes fails, exiting the session. If the failure occurs, usually no error message is reported and the exit status is 127 but occasionally a segmentation fault is reported and the exit status is 139. Failure seems to be more likely under higher workloads e.g. running a virus scan. Some days the failure occurs a lot, other days rarely. In the worst case, I have found that compiling may take 5 or 6 attempts. The failure has never occurred whilst running under gdb, so this seems to be a 'heisenbug', and running under gdb could be a work-around. Possibly it is a race condition. In the output from gdb (see below) I note that three threads terminate and another three start at the time that the failure occurs.

Given that the failure occurs after the final printing of "required privileges" but before "[New bindings added.]" is printed, it appears that something in the function make_runner used by CM.make is causing this: https://github.com/smlnj/legacy/blob/69d96609f594d00fa05b9d60bfe8c35a2e217aca/base/cm/main/cm-boot.sml#L95-L120

Until I can try the latest release (which is not straightforward) it may not be worth spending much time on this but it would be useful to know:

  1. Is there a way to show get more diagnostic information without recompiling? (#set CM.Control.debug true did not add anything.)
  2. Is there a fix to a similar issue since 110.85? (The SVN repository doesn't seem to be responding any more so I couldn't look through the changes.)

Transcript

When CM.make fails, the output is:

$Execute: required privileges are:
  c-int
  primitive

and the exit status is usually 127. Sometimes a segmentation fault is reported and the exit status is 139.

Expected Behavior

When CM.make succeeds, the output is:

$Execute: required privileges are:
  c-int
  primitive
[New bindings added.]

When running under gdb, in which case CM.make always succeeds, the output is:

$Execute: required privileges are:
  c-int
  primitive
[Thread 14772.0x5a2c exited with code 0]
[Thread 14772.0x44b8 exited with code 0]
[Thread 14772.0x6390 exited with code 0]
[New Thread 14772.0x1ffc]
[New Thread 14772.0x62d0]
[New Thread 14772.0x369c]
[New bindings added.] 

Steps to Reproduce

Unfortunately there is no simple way to reproduce this.

Additional Information

No response

Email address

[email protected]

pclayton avatar Oct 06 '22 14:10 pclayton