No more STATUS_ACCESS_VIOLATION on Cygwin under Windows7

I recently reinstalled Cygwin 1.7.9-1 on a Windows7 Ultimate edition (64bits), and like many many people, I ran into the problems of randomly thrown exceptions by xterm and alike processes.

For example when starting xterm:

       4 [main] xterm 7156 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    1449 [main] xterm 7156 open_stackdumpfile: Dumping stack trace to xterm.exe.stackdump
       4 [main] xterm 7996 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    1356 [main] xterm 7996 open_stackdumpfile: Dumping stack trace to xterm.exe.stackdump
       4 [main] xterm 5268 exception::handle: Exception: STATUS_ACCESS_VIOLATION
     647 [main] xterm 5268 open_stackdumpfile: Dumping stack trace to xterm.exe.stackdump
       5 [main] xterm 4316 exception::handle: Exception: STATUS_ACCESS_VIOLATION
     739 [main] xterm 4316 open_stackdumpfile: Dumping stack trace to xterm.exe.stackdump
       2 [main] xterm 2752 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    1123 [main] xterm 2752 open_stackdumpfile: Dumping stack trace to xterm.exe.stackdump
       5 [main] xterm 3220 exception::handle: Exception: STATUS_ACCESS_VIOLATION
    1260 [main] xterm 3220 open_stackdumpfile: Dumping stack trace to xterm.exe.stackdump
       6 [main] xterm 6752 fork: child -1 - died waiting for longjmp before initialization, retry 0, exit code 0x600, errno 11
xterm: Error 29, errno 11: Resource temporarily unavailable
Reason: spawn: fork() failed

When googling, some people seem to solve it just by disabling Windows DEP. Well for me it did not work (errors were exactly the same with DEP exceptions for Cygwin processes, and even with DEP completely disabled).

I solved it by executing some Cygwin maintenance that should definitely be integrated in Cygwin’s setup, but is not as of today.
This maintenance task is named rebaseall: you have to first install it as a Cygwin package, and you can find a very useful readme in /usr/share/doc/Cygwin/rebase-X.Y.Z.README file, explaining the ins and outs of this process.

  1. Modify /bin/rebaseall script: This script needs a minor modification to not fail on 64bits MingW DLLs. Change its line 110 from

        sed -e '/cygwin1\.dll$/d' -e '/cyglsa.*\.dll$/d' -e 's/^/\//' >"$TmpFile"
    

    to

        sed -e '/cygwin1\.dll$/d' -e '/mingw\/bin.*\.dll$/d' -e '/cyglsa.*\.dll$/d' -e 's/^/\//' >"$TmpFile"
    
  2. Copy /bin/ash.exe to /usr/bin/ash.exe (eventually create the directory if it does not exist).
  3. Kill all Cygwin related processes. This also includes any xterm, bash, and even XWin.exe server.
  4. Execute /bin/ash.exe
  5. In the ash terminal, execute /bin/rebaseall. It should (and has to) execute without any errors, otherwise it will leave your Cygwin install in a very unstable state. Warnings are acceptable though.
    If it fails because of a used DLL, an executing Cygwin process, or anything, don’t panic: correct the problem (kill running Cygwin processes if any), and try again.
  6. Still in the ash terminal, execute /bin/peflagsall. This should also run without errors, just warnings.

Then you’re goot to go. No need to restart, you should have your Cygwin processes running without exceptions.

Cheers

Muriel

About Muriel Salvan

I am a freelance project manager and polyglot developer, expert in Ruby and Rails. I created X-Aeon Solutions and rivierarb Ruby meetups. I also give trainings and conferences on technical topics. My core development principles: Plugins-oriented architectures, simple components, Open Source power, clever automation, constant technology watch, quality and optimized code. My experience includes big and small companies. I embrace agile methodologies and test driven development, without giving up on planning and risks containment methods as well. I love Open Source and became a big advocate.
Cygwin, Howto , , , , , , , ,

12 comments


  1. Pingback: URL

Leave a Reply

Your email address will not be published.