Menu

#208 bash launched by 32-bit cmd cannot fork

1.0
closed
nobody
None
2017-02-05
2015-11-08
No

If I launch \windows\syswow64\cmd and try to have 64-bit bash do something where it would try to spawn a subprocess, it explodes. This seems to be the same problem reported via https://cygwin.com/ml/cygwin/2013-07/msg00720.html. I installed this bash via the instructions at http://msys2.github.io/ , msys2-x86_64-20150916.exe.

Instead of getting these crashes, I would expect to be able to freely launch subprocesses from a 64-bit bash spawned by a 32-bit cmd with no problems, just like in Linux spawning things via different process bitinesses transparently works. In the meantime I'm going to have to figure out hacks to wrap bash invocations from 32-bit programs in \windows\sysnative\cmd /c.

Microsoft Windows [Version 10.0.10586]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\windows\syswow64>bash -c '( ls; )'
      0 [main] bash 456 C:\msys64\usr\bin\bash.exe: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x600000 - 0x800000, (child has 0x400000 - 0x600000), Win32 error 487
Stack trace:
Frame        Function    Args
00000000000  0018007205E (00180215F9C, 00180215E46, 00000400000, 000005FEE10)
00000000000  00180046E02 (000005FFE78, 00000000000, 00000000000, 00000002000)
00000000000  00180046E42 (00000600000, 00000800000, 00000400000, 00000600000)
00000000000  0018004716A (00000000000, 00100401000, 00000354000, 00000000000)
00000000000  001800471AE (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  001004D2521 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00100401010 (00000000000, 00000000000, 00000000000, 00100401000)
00000000000  7FFAFFF48102 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  7FFB02A3C264 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
      0 [main] bash 1248 fork: child -1 - forked process 456 died unexpectedly, retry 0, exit code 0x100, errno 11
bash: fork: retry: No child processes
1010089 [main] bash 540 C:\msys64\usr\bin\bash.exe: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x600000 - 0x800000, (child has 0x400000 - 0x600000), Win32 error 487
Stack trace:
Frame        Function    Args
00000000000  0018007205E (00180215F9C, 00180215E46, 00000400000, 000005FEE10)
00000000000  00180046E02 (000005FFE78, 00000000000, 00000000000, 00000002000)
00000000000  00180046E42 (00000600000, 00000800000, 00000400000, 00000600000)
00000000000  0018004716A (00000000000, 00100401000, 0000024E000, 00000000000)
00000000000  001800471AE (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  001004D2521 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00100401010 (00000000000, 00000000000, 00000000000, 00100401000)
00000000000  7FFAFFF48102 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  7FFB02A3C264 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
1033874 [main] bash 1248 fork: child -1 - forked process 540 died unexpectedly, retry 0, exit code 0x100, errno 11
bash: fork: retry: No child processes
3043866 [main] bash 13300 C:\msys64\usr\bin\bash.exe: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x600000 - 0x800000, (child has 0x400000 - 0x600000), Win32 error 487
Stack trace:
Frame        Function    Args
00000000000  0018007205E (00180215F9C, 00180215E46, 00000400000, 000005FEE10)
00000000000  00180046E02 (000005FFE78, 00000000000, 00000000000, 00000002000)
00000000000  00180046E42 (00000600000, 00000800000, 00000400000, 00000600000)
00000000000  0018004716A (00000000000, 00100401000, 0000025E000, 00000000000)
00000000000  001800471AE (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  001004D2521 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00100401010 (00000000000, 00000000000, 00000000000, 00100401000)
00000000000  7FFAFFF48102 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  7FFB02A3C264 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
3073952 [main] bash 1248 fork: child -1 - forked process 13300 died unexpectedly, retry 0, exit code 0x100, errno 11
bash: fork: retry: No child processes
7092151 [main] bash 6892 C:\msys64\usr\bin\bash.exe: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x600000 - 0x800000, (child has 0x400000 - 0x600000), Win32 error 487
Stack trace:
Frame        Function    Args
00000000000  0018007205E (00180215F9C, 00180215E46, 00000400000, 000005FEE10)
00000000000  00180046E02 (000005FFE78, 00000000000, 00000000000, 00000002000)
00000000000  00180046E42 (00000600000, 00000800000, 00000400000, 00000600000)
00000000000  0018004716A (00000000000, 00100401000, 000003C8000, 00000000000)
00000000000  001800471AE (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  001004D2521 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00100401010 (00000000000, 00000000000, 00000000000, 00100401000)
00000000000  7FFAFFF48102 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  7FFB02A3C264 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
7149854 [main] bash 1248 fork: child -1 - forked process 6892 died unexpectedly, retry 0, exit code 0x100, errno 11
bash: fork: retry: No child processes
15166852 [main] bash 12152 C:\msys64\usr\bin\bash.exe: *** fatal error in forked process - fork: can't reserve memory for parent stack 0x600000 - 0x800000, (child has 0x400000 - 0x600000), Win32 error 487
Stack trace:
Frame        Function    Args
00000000000  0018007205E (00180215F9C, 00180215E46, 00000400000, 000005FEE10)
00000000000  00180046E02 (000005FFE78, 00000000000, 00000000000, 00000002000)
00000000000  00180046E42 (00000600000, 00000800000, 00000400000, 00000600000)
00000000000  0018004716A (00000000000, 00100401000, 00000352000, 00000000000)
00000000000  001800471AE (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  001004D2521 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00100401010 (00000000000, 00000000000, 00000000000, 00100401000)
00000000000  7FFAFFF48102 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  7FFB02A3C264 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
15202643 [main] bash 1248 fork: child -1 - forked process 12152 died unexpectedly, retry 0, exit code 0x100, errno 11
bash: fork: Resource temporarily unavailable

C:\windows\syswow64>

My current workaround:

C:\WINDOWS\syswow64>%WINDIR%\sysnative\cmd /c bash -c "( ls | head -n 1; )"
0409

Discussion

  • David Macek

    David Macek - 2015-12-02

    There is unfortunately a regression introduced in Windows 10 TH2 (v1511) very similar to the one you referenced. See https://cygwin.com/ml/cygwin/2015-12/msg00016.html.

    Are running this version of Windows?

     
  • Vladimír Čunát

    I'm getting this in wine64.

     
  • David Macek

    David Macek - 2015-12-03

    I'm not sure your error is the same as this one -- there are various reasons for fork errors and this one seems to be due to a recent change in Windows, which doesn't seem related to wine64.

    I suggest asking @fracting (hangs out in #msys2 or #cygwin-developers).

     
  • Nathan Phillip Brink

    I'm running Windows 10 build 10586 as shown in cmd’s output.

     
  • David Macek

    David Macek - 2015-12-06

    Ah yes, thanks. My eyes are trained to ignore those two lines. :)

    I still think it could be the same issue. New msys2-runtime should be out in a few days. I'll try to let you know.

     
  • David Macek

    David Macek - 2017-02-05
    • status: open --> closed
     
  • David Macek

    David Macek - 2017-02-05

    It was fixed soon after. Closing.

     
MongoDB Logo MongoDB