How can I fix the error "fatal error - cygheap base mismatch detected" when using git on Windows 10?

3

2

When using git on Windows 10 (1803), some commands give the following error:

git submodule add https://github.com/..../......git ......
      3 [main] basename (13656) C:\.....\basename.exe: *** fatal error - cygheap base mismatch detected - 0x64313400/0x11E3400.
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.

How can I resolve this issue?

Julian Knight

Posted 2018-12-02T18:27:33.080

Reputation: 13 389

Answers

2

There are several possible reasons for this error.

For example, you could indeed have a clashing version of the DLL.

However, recent versions of Windows 10 have a set of additional protection features built in that were originally part of Microsoft EMET.

Most notably, the ASLR (Address Space Layout Randomization) security feature is not compatible with the UNIX-like executables included with the Git for Windows installation.

In order to fix this issue, open the Exploit Protection settings, switch to the Program Settings tab and add the executable names listed in the errors (you may have quite a number).

In the example given, you can enter just basename.exe or the full path if you are a little more paranoid.

For each executable, turn off the ASLR protection.

For further reference, please see the following GitHub issue:

https://github.com/desktop/desktop/issues/3096

Julian Knight

Posted 2018-12-02T18:27:33.080

Reputation: 13 389

1This is awesome! Clear and brillant. Thank you for such detailed explanation. Learned a lot today! – menssana – 2019-04-02T17:28:47.677

I have the same problem here: https://stackoverflow.com/questions/56201929/fatal-error-cygheap-base-mismatch-detected-0x13a1410-0x13d1410 . Don't know what are the name of the programs I must add?

– user3486308 – 2019-05-18T19:48:17.917

1Notice the 2nd line of output in the original question? It shows you the exe you need to add. – Julian Knight – 2019-05-19T15:03:15.633

Should I do this for every cygwin exe file? – Anders Lindén – 2019-09-25T12:35:40.933

Yes, I'm afraid so. It can take a while. There is probably a way to script it. – Julian Knight – 2019-09-26T11:11:06.257

I received this error whenever I tried to execute Cygwin .exe files via Git Bash. As soon as I tried the same commands in Powershell, they worked fine. So, in my specific case, the problem seemed to be Git Bash, not Cygwin executables. Rather than fiddle with the ASLR settings, I just switched my tasks to Powershell. – Ben Johnson – 2019-10-13T12:11:23.357

There could, I think, be several reasons for that, the most likely being that PS is using a different set of executables. You might want to do which git, etc. to find out what is being run. But, of course, if it works for you, that's great. – Julian Knight – 2019-10-13T13:32:14.377