http://bugs.winehq.org/show_bug.cgi?id=35561
Bug ID: 35561 Summary: Some MSYS2 commands generate a stackdump Product: Wine Version: 1.7.12 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: irwin@beluga.phys.uvic.ca Classification: Unclassified
Created attachment 47484 --> http://bugs.winehq.org/attachment.cgi?id=47484 strace log of execution of mintty
The general problem is I cannot start MSYS2 (the successor to MSYS) using its msys2_shell.bat startup batch file (see directions at http://sourceforge.net/p/msys2/wiki/MSYS2 installation/ concerning how to start MSYS2). That batch file (which executes a number of different MSYS2 commands) exits almost immediately with a stack dump.
Alexey Pavlov, the developer of MSYS2, suggested I narrow down the problem by attempting to execute the MSYS2 version of mintty.exe directly, and if that did not work (which was the case) then run that app via the MSYS2 strace.exe facility to help figure out what the exact problem is. MSYS2 strace.exe did appear to work and I attach its log (and also the associated stackdump for mintty.exe).
Here are some additional details in case there are any difficulties replicating this issue.
I have used 3 different versions of 32-bit Wine which I built myself on my Debian Wheezy system. Those are Unpatched Wine-1.6.1, patched Wine-1.6.1, and patched Wine-1.7.12. The patch used was "Hackish patch to fix APC problem" taken from http://bugs.winehq.org/show_bug.cgi?id=24018. The reason why that extremely small patch is relevant is MSYS2 is essentially a simplified modern Cygwin (as opposed to MSYS which is essentially a simplified ancient version of Cygwin). Because the patched versions give improved results (see below), apparently the modern bits of Cygwin that are still part of MSYS2 trigger at least the APC Wine bug for modern Cygwin that did not occur for older Cygwin versions.
The version of MSYS2 I am using is msys2-base-i686-20140205.tar.xz. Unpacking that created a top-level directory name of msys32 which I have changed to MSYS2-20140205 to help keep better track of which version of MSYS2 I am trying.
I ran the MSYS2 version of strace with the patched versions of Wine as follows:
wine@raven> wineserver -k wine@raven> wineserver -p wine@raven> wineconsole --backend=curses cmd Microsoft Windows 5.1.2600 (1.7.12)
Z:\home\wine\newstart>PATH=Z:\home\wine\newstart\MSYS2-20140205\bin;%PATH% Z:\home\wine\newstart>MSYS2-20140205\bin\strace.exe MSYS2-0140205\bin\mintty.exe > strace.log 1069046 [main] mintty 44 cygwin_exception::open_stackdumpfile: Dumping stack trace to mintty.exe.stackdump
The mintty terminal momentarily appeared before the stackdump occurred. After that stack dump strace did not return (i.e., everything was hung), and the last line in strace.log at that point was
616 1255194 [main] mintty 44 pinfo::exit: Calling ExitProcess n 0x8B, exitcode 0x8B00
I exited the combination of mintty, strace, cmd, and wineconsole the brute-force way by typing "wineserver -k" in a different Linux xterm which added nothing else to strace.log.
The strace and stackdump results for patched wine-1.6.1 and patched wine-1.7.12 were virtually identical (except for numerical data like PID numbers). I have attached the wine-1.7.12 versions.
When initially investigating this issue I was using unpatched wine-1.6.1. The result of everything I tried was Wine error boxes concerning dll problems. Those error boxes reminded me very much of my troubles in trying to run modern Cygwin from Wine so I applied the APC-related patch, and sure enough, that got rid of the error boxes, and I could get a lot further before I ran into a different problem which is what I have described above.
http://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #1 from Alan W. Irwin irwin@beluga.phys.uvic.ca --- Created attachment 47485 --> http://bugs.winehq.org/attachment.cgi?id=47485 stackdump created by running mintty
http://bugs.winehq.org/show_bug.cgi?id=35561
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download Status|UNCONFIRMED |NEW URL| |http://sourceforge.net/proj | |ects/msys2/files/Base/i686/ | |msys2-base-i686-20140205.ta | |r.xz CC| |focht@gmx.net Summary|Some MSYS2 commands |Some MSYS2 commands |generate a stackdump |generate a stackdump | |(queued user APC not | |executed) Ever confirmed|0 |1
--- Comment #2 from Anastasius Focht focht@gmx.net --- Hello folks,
see also bug 34865 which was resolved 'upstream' because the vendor used a different cygwin version not containing the 'experimental' APC patch (which ought reduce some performance bottleneck during creation of early threads).
The APC call in question is used here:
http://sourceforge.net/p/mingw/msys2-runtime/ci/master/tree/winsup/cygwin/cy...
http://sourceforge.net/p/mingw/msys2-runtime/ci/master/tree/winsup/cygwin/cy...
Regards
http://bugs.winehq.org/show_bug.cgi?id=35561
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |source CC| |austinenglish@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #3 from Alan W. Irwin irwin@beluga.phys.uvic.ca --- (In reply to comment #2)
see also bug 34865 which was resolved 'upstream' because the vendor used a different cygwin version not containing the 'experimental' APC patch (which ought reduce some performance bottleneck during creation of early threads).
I assume you got this bad APC result because you didn't try the "Hackish patch to fix APC problem" referred to above. Do you confirm the further MSYS2 mintty issue I found (where strace.log does not mention apc) when that Wine patch is applied?
I have very little understanding of that APC patch (it was written by someone else), but from my experience it it does appear to allow users to get much further with Cygwin intialization and now MYS2 initialization than previously.
http://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #4 from Anastasius Focht focht@gmx.net --- Hello Alan,
--- quote --- I assume you got this bad APC result because you didn't try the "Hackish patch to fix APC problem" referred to above. --- quote ---
I don't need to try it because I know what it does (putting the main thread as early as possible in alertable wait state, allowing the queued APC to run).
The patch is correctly dubbed as 'hack' and is unlikely to be included in mainline as-is.
--- quote --- Do you confirm the further MSYS2 mintty issue I found (where strace.log does not mention apc) when that Wine patch is applied? --- quote ---
No, I thought this bug was about the missing user APC execution. I basically misread the whole comment and interpreted things like "you have to apply patch 'foo'", buried within the comment text as actual issue reported here.
Since this bug is now more or less about _two_ issues it might be better to split this up into two bugs. One for the missing user APC execution and another for the issue following (having dependency to APC bug).
Regards
http://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #5 from Alan W. Irwin irwin@beluga.phys.uvic.ca --- (In reply to comment #4)
Hello Alan,
--- quote --- I assume you got this bad APC result because you didn't try the "Hackish patch to fix APC problem" referred to above. --- quote ---
I don't need to try it because I know what it does (putting the main thread as early as possible in alertable wait state, allowing the queued APC to run).
The patch is correctly dubbed as 'hack' and is unlikely to be included in mainline as-is.
--- quote --- Do you confirm the further MSYS2 mintty issue I found (where strace.log does not mention apc) when that Wine patch is applied? --- quote ---
No, I thought this bug was about the missing user APC execution. I basically misread the whole comment and interpreted things like "you have to apply patch 'foo'", buried within the comment text as actual issue reported here.
Since this bug is now more or less about _two_ issues it might be better to split this up into two bugs. One for the missing user APC execution and another for the issue following (having dependency to APC bug).
Regards
Hi Anastasius:
I agree splitting this report into two bug reports is the right thing to do. However, will you do that please? I am primarily a free software developer on Linux that just uses Wine to build and test my software on Windows. So I don't have much understanding of Wine internals or Windows. Therefore, I don't have a clue about APC except to try the hackish patch to see if it works (which it appeared to). So please go ahead and make a new bug report about the APC issues as you understand them, but please also include the hackish patch in that report so it doesn't get lost (as it mostly is currently in http://bugs.winehq.org/show_bug.cgi?id=24018 since that bug has been closed). That would then reserve this current bug report for the second issue that showed up after the hackish patch was applied.
Of course, I realize that Wine developers may decide to just forget about this second issue until the APC bug has a solid fix. But a further comment here by you concerning whether you feel the hackish patch is good enough (or not) to justify immediate work on this second issue would help to inform their decision.
https://bugs.winehq.org/show_bug.cgi?id=35561
Qian Hong fracting@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fracting@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #6 from Qian Hong fracting@gmail.com --- Created attachment 50783 --> https://bugs.winehq.org/attachment.cgi?id=50783 Hack: treat PAGE_WRITECOPY like PAGE_READWRITE
Hi Alan,
I can confirm this bug, the attach hack helps me for avoiding crashing, could you have a try?
https://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #7 from Alan W. Irwin irwin@beluga.phys.uvic.ca --- Hi Qian:
Thanks for your interest in this bug. However, could you give more details? For example, what version of Wine and whether you applied the "hackish patch to fix the APC problems" at http://bugs.winehq.org/show_bug.cgi?id=24018 before applying your patch. Note that bug 24018 was closed at the time because it was thought it was too general and not because the APC issue, for example, was actually fixed. It has been a long time since then so I don't know whether the APC issue has been fixed or not hence my question to you concerning it.
Note, I am not a wine developer, but I do report bugs such as this one that I discover when attempting to use it. So if you are a wine developer I wish you the best in solving both this bug and the APC bug but at this time I am completely tied up with development of my own Linux projects so it will probably be a couple of months before I attempt to test those projects on MSYS/Wine (known to work within the last year), MSYS2/Wine (broken as here the last time I tried it), and Cygwin/Wine (broken as in bug 24018 the last time I tried it).
https://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #8 from Qian Hong fracting@gmail.com --- Hi Alan, (In reply to Alan W. Irwin from comment #7)
Hi Qian:
Thanks for your interest in this bug. However, could you give more details? For example, what version of Wine and whether you applied the "hackish patch to fix the APC problems" at http://bugs.winehq.org/show_bug.cgi?id=24018 before applying your patch. Note that bug 24018 was closed at the time because it was thought it was too general and not because the APC issue, for example, was actually fixed. It has been a long time since then so I don't know whether the APC issue has been fixed or not hence my question to you concerning it.
1. This patch could be apply on most recent Wine version. I'm testing on wine 1.7.36. 2. Yes, the APC patch is still required.
Both of bugs are difficult to fix for me, I'll keep an eye here, hopefully I can made a clean test case to demonstrate the APC bug and submit a new bug for that. (In theory that APC bug should be submitted earlier than this one)
https://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #9 from Alan W. Irwin irwin@beluga.phys.uvic.ca --- (In reply to Qian Hong from comment #8)
- This patch could be apply on most recent Wine version. I'm testing on
wine 1.7.36. 2. Yes, the APC patch is still required.
Both of bugs are difficult to fix for me, I'll keep an eye here, hopefully I can made a clean test case to demonstrate the APC bug and submit a new bug for that. (In theory that APC bug should be submitted earlier than this one)
I think a separate bug report for the apc issue would be quite useful. I was asked to do that myself, but I didn't feel qualified (didn't know how to make a clean test case for the APC issue).
https://bugs.winehq.org/show_bug.cgi?id=35561
--- Comment #10 from Qian Hong fracting@gmail.com --- According to my test this bug is fixed in wine-staging:
https://github.com/wine-compholio/wine-staging/tree/master/patches/ntdll-WRI...
To enable the WRITECOPY feature, one should set environment variable STAGING_WRITECOPY=1 before start.
https://bugs.winehq.org/show_bug.cgi?id=35561
Michael Müller michael@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |STAGED CC| |michael@fds-team.de, | |sebastian@fds-team.de Staged patchset| |https://github.com/wine-com | |pholio/wine-staging/tree/ma | |ster/patches/ntdll-WRITECOP | |Y
https://bugs.winehq.org/show_bug.cgi?id=35561
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |ntdll
https://bugs.winehq.org/show_bug.cgi?id=35561
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=35561
Andrey andrey.gursky@e-mail.ua changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |andrey.gursky@e-mail.ua
https://bugs.winehq.org/show_bug.cgi?id=35561
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=24018 Staged patchset|https://github.com/wine-com |https://github.com/wine-sta |pholio/wine-staging/tree/ma |ging/wine-staging/tree/mast |ster/patches/ntdll-WRITECOP |er/patches/ntdll-APC_Start_ |Y |Process
--- Comment #11 from Anastasius Focht focht@gmx.net --- Hello folks,
since there was already discussion in the past and bug 29384 already tracks the improper handling of WRITECOPY memory protection, making this ticket about the unprocessed user APCs (continuation/revival of bug 24018 -> https://bugs.winehq.org/show_bug.cgi?id=24018#c20).
Changing referenced Wine-Staging patchset to proper one (albeit currently disabled).
--- quote --- Basic summary: user APCs which are queued in DllMain and in TLS callbacks need to be executed after all dlls are loaded and loader lock is released but before process entry. --- quote ---
Any discussion related to WRITECOPY feature should be done in bug 29384
$ wine --version wine-3.4
Regards
https://bugs.winehq.org/show_bug.cgi?id=35561
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|STAGED |RESOLVED Resolution|--- |FIXED CC| |z.figura12@gmail.com Fixed by SHA1| |b45d6125493e19e7e2befe071b7 | |052bad4d2859f
--- Comment #12 from Zebediah Figura z.figura12@gmail.com --- APC problem is fixed by https://source.winehq.org/git/wine.git/commitdiff/b45d6125493e19e7e2befe071b7052bad4d2859f.
https://bugs.winehq.org/show_bug.cgi?id=35561
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #13 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 4.17.
https://bugs.winehq.org/show_bug.cgi?id=35561
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mail@georg.so
--- Comment #14 from Zebediah Figura z.figura12@gmail.com --- *** Bug 35344 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=35561
Zebediah Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mail@kirill-mueller.de
--- Comment #15 from Zebediah Figura z.figura12@gmail.com --- *** Bug 34865 has been marked as a duplicate of this bug. ***