16

I quite satisfied of how GNU tools run in my Cygwin on Windows Seven. I think it's easier just to use GNU/Linux, but my company here has the policy of using Windows Seven for the Programmer programming environment. So, the solution is Cygwin. And I use Emacs intensively for my programming purpose.

But, it seems that Emacs running in Cygwin create a consistent (phrew) crash dump that printed on the console. I had to refresh it using C-l, but that makes me wonder : what is the problem anyway?

Does anyone has the same problem here? And what is the solution. This is my example of running org-googlecl.

Process googlecl-list finished


*  List of blogs with  in the *  List of blogs with  in the title                       :gblog:

12719501 [main] emacs-X11 1168 exception::handle: Exception: STATUS_ACCESS_VIOLATION
                                                                                    12720164 [main] emacs-X11 1168 open_stackdumpfile: Dumping stack trace to emacs-X11.exe.stackdump
                      12889237 [main] emacs-X11 764 exception::handle: Exception: STATUS_ACCESS_VIOLATION
                                                                                                         12889852 [main] emacs-X11 764 open_stackdumpfile: Dumping stack trace to emacs-X11.exe.stackdump

And it always create emacs-X11.exe.stackdump. It always happen when I run another process from within emacs, that is if I run a batch file from Emacs.

Thank you

swdev
  • 4,997
  • 8
  • 64
  • 106

4 Answers4

10

I recently ran into this issue when upgrading my version of Cygwin to 1.7.9-1. pserice's solution looked promising but did not work for me. The solution that worked for me was to run rebaseall:

  1. Close ALL Cygwin processes (use Process Explorer to make sure that nothing has cygwin1.dll loaded in it)
  2. Start > Run > Cmd.exe
  3. cd \cygwin\bin
  4. ash
  5. PATH=.
  6. rebaseall -v

After that, emacs stopped crashing every time it tried to run a subprocess.

Community
  • 1
  • 1
Adam Rosenfield
  • 390,455
  • 97
  • 512
  • 589
  • I too have cygwin 1.7.9-1 and after getting the latest update of a couple of files (I mainly wanted to get mintty) I can't load any file in emacs, as I get many STATUS_ACCESS_VIOLATION messages in the console and the vfork message in emacs itself. rebaseall -v doesn't help. Neither does the suggestion below about DEP, as my machine is set up not to use it (Windows 7 x64). Anyone have any other suggestions? I'm completely at a loss. Thanks! – Eric Dec 23 '11 at 14:33
  • Ok, I think I solved it, in case anyone else has this problem. I had to turn off McAfee Virus Scanning. As soon as I did that and restarted my cygwin environment I was able to run emacs and again load files into buffers. – Eric Dec 23 '11 at 15:10
6

Win7 aborts processes that overwrite parts of the stack. If you trust cygwin executables, you can selectively exclude them as follows:

Computer -> Properties
         -> Advanced System Settings
         -> Performance
         -> Settings...
         -> Data Execution Prevention

I excluded the following:

C:\cygwin\bin\bash.exe
C:\cygwin\bin\emacs.exe
C:\cygwin\bin\emacs-nox.exe
C:\cygwin\bin\emacs-X11.exe
C:\cygwin\bin\startxwin.exe
pserice
  • 61
  • 1
  • Wow, I just know that. Let me try it! – swdev Feb 07 '11 at 06:37
  • Thank you so much for this! I've been Googling forever trying to solve this problem and this was the only thing that worked! – Steph Sep 14 '11 at 01:20
  • Am I right in assuming that if I have "Turn on DEP for essential Windows programs and services only" selected already this solution should not be relevant to me (and thus my stackdumps are caused by something else)? – Mike H-R Oct 27 '14 at 14:02
2

I can't help with the specific issue, but as a possible alternative you could look at running Emacs in a Linux VM hosted on your Windows box. You can use Cygwin's X.org server as the display, so the end result is largely the same as using Cygwin's Emacs.

It means jumping through a few more hoops, but I find it a good solution, and it will hopefully avoid the crashes.

I'm using VirtualBox to host my VM.

Community
  • 1
  • 1
phils
  • 71,335
  • 11
  • 153
  • 198
  • this surely new to me! But my company using windows, so that's mean I've to install linux? thanks. – swdev Jan 21 '11 at 02:06
  • 2
    VirtualBox (and other similar applications) let you run Virtual Machines (VMs) within the host OS. So you can have a Linux VM running within Windows. You would indeed have to install Linux, but you would install it on the virtual machine, not the real machine. By then providing a local X server as a display for 'remote' applications running on your VM, your applications can have local (Windows) windows. – phils Jan 21 '11 at 02:38
  • Hi, I'm about ready to move to this solution as too many segfaults on cygwin have somewhat put me off've it. I've installed VM's before, but I haven't used cygwin's X.org server to display things, are there any instructions you found useful for doing this that you could point me to? – Mike H-R Oct 27 '14 at 15:33
  • I talked about X.org in the linked answer, so I'll just refer you to that. Otherwise the only advice which springs to mind is to be sure to conserve your host's resources by using a sufficiently minimal guest OS, and that in particular, this approach absolutely does *not* require a GUI desktop environment for the guest. At the time I was using the "Ubuntu Server" distribution. – phils Oct 27 '14 at 16:20
  • Thanks, do you have any solutions for [filesystem permissions problems](http://unix.stackexchange.com/questions/164588/in-a-virtualbox-vm-how-do-i-set-the-filesystem-permissions)? the virtualbox shared folder is all 755 for me (so an edit changes the file to these permissions on the host system when I save it) – Mike H-R Oct 28 '14 at 12:00
2

I have had this same problem in running console emacs through cygwin on Windows 7.

My solution to this was to install the native GNU Emacs Windows client: http://ftp.gnu.org/gnu/emacs/windows/ and set cygwin's bash.exe as my shell.

You can see my emacs.d/init.el at https://github.com/tildedave/init.el/blob/master/init.el: here is the part relevant to making sure that the Windows 7 Emacs plays well with cygwin --

(if is-windows 
    (progn 
      (add-hook 'comint-output-filter-functions
                'shell-strip-ctrl-m nil t)
      (add-hook 'comint-output-filter-functions
                'comint-watch-for-password-prompt nil t)
      (setq explicit-shell-file-name "bash.exe")
      (setq shell-file-name explicit-shell-file-name)))

For light-weight in-console editing I use nano, which does not core dump.

tildedave
  • 679
  • 5
  • 8
  • Yes, I think using gnu eamcs windows native client is the best solution. I will have it a go. Thanks for your dot emacs. very helpful! – swdev Jan 21 '11 at 02:03
  • Phew.. thank you. I just finish setting up things. It works well! The bash shell inside emacs, quite good (I just don't like the free cursor movement). Now I just want to make it black again. :) But I think that is subject to change... – swdev Jan 21 '11 at 07:27
  • I accept this answer, as it's the solution to my question, but fortunately, currently I am not using Cygwin Ported Emacs. I use native win32 emacs, but running it as a MS DOS Prompt application – swdev Feb 16 '11 at 12:25