desktop: Desktop barfs with cygheap base mismatch detected

Description

During clone of a repo desktop barfs, complaining

      1 [main] sh (21312) C:\Users\bdorrans\AppData\Local\GitHubDesktop\app-1.0.4\resources\app\git\usr\bin\sh.exe: *** fatal error - cygheap base mismatch detected - 0x2FA7408/0x2D97408.
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.

There is no cygwin1.dll anywhere on any disk that I can find.

Git standalone, version 2.14.2.windows.3, 32bit is installed. It is higher in the path, however uninstalling it and rebooting made no difference.

Version

GitHub Desktop version: [1.04]

OS version: Microsoft Windows [Version 10.0.16299.19]

Steps to Reproduce

  1. Start GitHub desktop
  2. Click clone a repository
  3. Choose repository
  4. Click Clone
  5. Watch the spinnies
  6. Get the error screen
  7. Cry

Expected behavior: Clone to work

Actual behavior: Clone barfs

Reproduces how often: Every time

Logs

2017-10-18.desktop.production.log

Additional Information

Running the bundled shell C:\Users\bdorrans\AppData\Local\GitHubDesktop\app-1.0.4\resources\app\git\usr\bin\sh.exe and then trying git gives the same error.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 42 (19 by maintainers)

Most upvoted comments

Oh god, this will make @shiftkey happy. It was me. Kind of.

So Fall Edition added some protections that came from EMET, and it has one to force ASLR onto binaries that don’t have it. Which is a good idea, because ASLR is a nice exploit protection. So I turn that on. And guess what started working when I turned it off again …

snip_20171025101340

Force randomization is the setting in question.

I found a “fix”. Add an exclusion for each program that crashes with that message until it works as desired. Example for git add -p with perl excluded: image with sh and perl excluded: image

Just add more until it works 😄

Those cygheap problems typically occur when there are multiple, different msys-2.0.dllfiles in use in the call path (the technical reasons are a bit complicated, and I write this on a phone).

It says cygwin1.dll because nobody fixed that in the MSYS2 runtime yet.

The curious thing is: why is a Shell spawned by the checkout in the first place? Are there hooks in play? Or clean/smudge filters?

You will have to add each and every .exe in <Git>\usr\bin, as all of them link to msys-2.0.dll, and it is that msys-2.0.dll whose initialization causes problems with ASLR.

So I got a chance to play on a machine with a similar issue, and this recipe seemed to work for me (run it in a CMD window, as administrator if necessary):

REM change this to the appropriate Git installation's location:
C:
CD "\Program Files (x86)\Git\usr\bin"

REM make a copy of msys-2.0.dll and change its base address
COPY msys-2.0.dll msys-2.0-copy.dll
.\rebase.exe -b 0x61000000 msys-2.0-copy.dll

REM replace msys-2.0.dll with the modified one
REN msys-2.0.dll msys-2.0-orig.dll
REN msys-2.0-copy.dll msys-2.0.dll

The 0x61000000 address was chosen by Cygwin, I have not had any luck finding any rational explanation how it was picked. If that address does not work for you, you may want to use different ones (if you run BitDefender, for example, the recommendation is 0x35000000).

In case anyone happens on this thread as I did. I was having problems issuing the git submodule add ... command, nothing to do with GitHub Desktop.

The fix is, indeed to add each erroring executable to the Exploit Protection overrides. I added by exe name - e.g. uname.exe rather than path. I disabled the two ASLR settings - not sure if that was needed but it works.

https://superuser.com/questions/1380238/how-can-i-fix-the-error-fatal-error-cygheap-base-mismatch-detected-when-usin

IMG_0508 IMG_0507

Removing github Desktop completely and reinstalling had no effect.

As TotallyInformation said, I had to add the exploit protection overrides for every file in the Cygwin package used by Github. With these exploit protection overrides, Github Desktop now works for me again.

Attached is the XML file I exported from the Windows 10 Exploit Protection setup. Github_exploit_settings.txt

Chris Shaker

This problem suddenly appeared on my system as well today. I think Windows automatically installed the March (2018) Cumulative Update for Windows 10 (1709) overnight… and since then, this happens. Going to check my options in this thread now.

Update: I uninstalled & deleted all files from GitHub Desktop and installed Git for Windows with poshgit.

I can’t believe you just “Worked on my machine” me 🗡

More seriously, how do I help figure out what’s making it barf?

A fresh Windows 10 VM updated to Fall Creator’s Update and then cloning a repository worked for me.

So I’m all…