Cygwin issue: cygheap base mismatch detected

Hi all,

I have been using Cygwin to test build of my project on Windows for a long time, and a few days ago I encountered the following issue: attempt to run cygwin bash ends with the following error:

0 [main] bash (896) C:\tools\cygwin\bin\bash.exe: *** fatal error - cygheap base mismatch detected - 0x180331408/0x18032D408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version *should*
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution. Rebooting is also suggested if you
are unable to find another cygwin DLL.

I looked for other versions of cygwin1.dll, and found one (excluding version from Cygwin itself):

562949953643359   3408 -rwxr-xr-x   1  travis   197121    3488471 Nov 14  2015 C:\\/ProgramData/chocolatey/lib/rsync/cwRsync_5.5.0_x86_Free/bin/cygwin1.dll
281474977157515   3416 -rwxr-xr-x   1  travis   197121    3496926 Apr 30 18:10 C:\\/tools/cygwin/bin/cygwin1.dll

However, it doesn’t seem to be the one causing the problem, because it’s not in the some system directory and not in the PATH:

/bin:/usr/bin:/c/tools/ruby26/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/ProgramData/GooGet:/c/Program Files/Google/Compute Engine/metadata_scripts:/c/Program Files (x86)/Google/Cloud SDK/google-cloud-sdk/bin:/c/Program Files/Google/Compute Engine/sysprep:/c/Program Files/Docker:/c/ProgramData/chocolatey/bin:/c/Program Files/CMake/bin:/c/Program Files/Git/cmd:/c/Program Files/LLVM/bin:/c/Program Files/dotnet:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit:/c/Users/travis/AppData/Local/Microsoft/WindowsApps:/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin

What else can cause this? May be some sort of ASLR was turned on recently on Windows VM (I read about similar issues with cygwin1.dll when ASLR is enabled)? Here is a link to failed job:

https://travis-ci.org/oleg-derevenetz/bwping/jobs/595070010

Thanks in advance for your help.

That topic is about MinGW rather than Cygwin but the cause is exactly the same.

Yes, thank you! That’s really was the case, I forgot that git-bash itself is Cygwin-based too… Now I’m running Cygwin bash via cmd.exe /c “/path/to/cygwin/bash.exe -l -c …” and everything seems to work fine.

Imprint