GNU make losing jobserver tokens

Ken Brown kbrown@cornell.edu
Thu Apr 28 13:42:46 GMT 2022


On 4/27/2022 10:13 AM, Takashi Yano wrote:
> On Fri, 1 Apr 2022 17:45:51 +0900
> Takashi Yano wrote:
>> I have tried to reproduce the issue by building OpenJDK
>> from source, however, I could not.
>>
>> Instead, I encountered another issue.
>>
>> Building OpenJDK sometimes (rarely) failed with error such as:
>>
>>        0 [sig] make 5484 sig_send: error sending signal 11, pid 5484, pipe handle 0x118, nb 0, packsize 176, Win32 error 0
>>   124917 [main] make 5484 sig_send: error sending signal -72, pid 5484, pipe handle 0x118, nb 0, packsize 176, Win32 error 0
>> common/modules/GensrcModuleInfo.gmk:77: *** open: /home/yano/jdk/build/windows-x86-server-release/make-support/vardeps/make/common/modules/GensrcModuleInfo.gmk/jdk.accessibility/ALL_MODULES.vardeps: No such file or directory.  Stop.
>> make[2]: *** [make/Main.gmk:141: jdk.accessibility-gensrc-moduleinfo] Error 2
>> make[2]: *** Waiting for unfinished jobs....
>>
>>
>> I looked into this new problem and found that wait_sig() thread
>> crashes with segfault. It seems that accessing _main_tls causes
>> access violation if a signal is sent just after the process is
>> started.
>>
>> static void WINAPI
>> wait_sig (VOID *)
>> {
>>    [...]
>>        if (!pack.mask)
>> 	{
>> 	  tl_entry = cygheap->find_tls (_main_tls);
>> 	  dummy_mask = _main_tls->sigmask;       // <--- Segfault here
>> 	  cygheap->unlock_tls (tl_entry);
>> 	  pack.mask = &dummy_mask;
>> 	}
>>
>> I also found the following patch resolves the issue.
>>
>> diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
>> index 62df96652..3824af199 100644
>> --- a/winsup/cygwin/sigproc.cc
>> +++ b/winsup/cygwin/sigproc.cc
>> @@ -1325,6 +1325,10 @@ wait_sig (VOID *)
>>     _sig_tls = &_my_tls;
>>     bool sig_held = false;
>>   
>> +  /* Wait for _main_tls initialization. */
>> +  while (!cygwin_finished_initializing)
>> +    Sleep (10);
>> +
>>     sigproc_printf ("entering ReadFile loop, my_readsig %p, my_sendsig %p",
>>   		  my_readsig, my_sendsig);
>>   
>>
>> I guess _main_tls may not be initialized correctly until
>> cygwin_finished_initializing is set.
>>
>> Any comments would be appreciated.

This seems reasonable to me.

Ken


More information about the Cygwin mailing list