mmap failure [was: cygrunsrv + sshd + rsync = 20 times too slow -- throttled?]

Ken Brown kbrown@cornell.edu
Mon Sep 6 18:40:40 GMT 2021


On 9/6/2021 2:07 PM, Corinna Vinschen via Cygwin wrote:
> On Sep  6 19:59, Corinna Vinschen via Cygwin wrote:
>> On Sep  6 13:38, Ken Brown via Cygwin wrote:
>>> On 9/6/2021 1:12 PM, Ken Brown via Cygwin wrote:
>>>> On 9/6/2021 11:32 AM, Corinna Vinschen via Cygwin wrote:
>>>>> On Sep  5 09:24, Ken Brown via Cygwin wrote:
>>>>>> On 9/4/2021 8:04 PM, Ken Brown via Cygwin wrote:
>>>>>>> On 9/4/2021 6:58 PM, Ken Brown via Cygwin wrote:
>>>>>>>> Here are the correct commits:
>>>>>>>>
>>>>>>>> 8169e39ab Cygwin: C++17: register keyword is deprecated
>>>>>>>> 3ca80b360 Cygwin: dumper: fix up GCC pragma for g++ 11.2
>>>>>>>> bdb7991db Cygwin: workaround a g++ 11.2 initialization bug
>>>>>>>> 801120c1f Cygwin: loader script: add DWARF 5 sections
>>>>>>>> d5cc66426 Cygwin: testsuite: avoid "conflicting types" gcc warning
>>>>>>>> c2fe205b5 strstr: avoid warnings
>>>>>>>> 76c2c7a89 ldexp/ldexpf: avoid assembler warning
>>>>>>>> eeeb5650c Cygwin: fix declaration of RtlInitEmptyUnicodeString
>>>>>>>>
>>>>>>>>>
>>>>>>>>>> So there appears to be something wrong with cygwin1.dll
>>>>>>>>>> built with the current build tools (gcc 11.2.0, binutils
>>>>>>>>>> 2.37, not sure what else is relevant).
>>>>>>>
>>>>>>> Wait a minute...I'll bet this is related to the MEM_EXTENDED_PARAMETER
>>>>>>> initialization problem that was dealt with in commit bdb7991db.
>>>>>>
>>>>>> More data: When I run the test case under gdb, it succeeds.  When I run it
>>>>>> under strace, I see VirtualAlloc2 in fhandler_dev_zero::mmap failing with
>>>>>> windows error 87.
>>>>>
>>>>> Are the const's I added to the MEM_EXTENDED_PARAMETER data invalid,
>>>>> perhaps?
>>>>
>>>> I tried removing them, and I got the same error.  I also tried removing
>>>> static, and I tried removing both static and const.
>>>
>>> BTW, when I reported that the test case succeeds under gdb, that only
>>> happens when I build the test case without optimization.  If I build with
>>> -O2, it fails under gdb also.  [In all my tests, I built cygwin1.dll without
>>> optimization.] This makes no sense to me at all.
>>
>> Good hint.  I found the culprit.  With optimization, the code doesn't
>> set the "Reserved" bits in the first struct of MEM_EXTENDED_PARAMETER
>> to 0.
> 
> No, wait.  I get what you say.  The optimzation settings of the test
> case should have no influence on the code inside the DLL.  That doesn't
> make sense for sure.  However, I ran the testcase under GDB, I could
> reproduce the issue, and I could fix it by setting mmap_ext.Reserved = 0;
> Go figure!

I don't get it, but I can confirm that the problem is fixed.

Thanks.

Ken


More information about the Cygwin mailing list