Subject: bug#5723: 23.1.94; make-network-process and emacs hangs

From: YAMAMOTO Mitsuharu <[email-masked]>
Date: Thu, 18 Mar 2010 18:06:20 +0900

>>>>> On Thu, 18 Mar 2010 08:43:45 +0100, Helmut Eller <[email-masked]> said:

> * YAMAMOTO Mitsuharu [2010-03-18 02:57+0100] writes:
>> If your case blocks at `connect', then it can't be quit with C-g
>> regardless of SYNC_INPUT on those ports/systems, because atimer is
>> turned off during the `connect' call.

> Why is the timer turned off around connect?  Handling SIGALARM
> during connect doesn't seem much different from handling SIGIO.

I think your argument makes sense.

I don't know the reason why the timer is turned off around connect.
The related code was added by the following change:

  committer: Ken Raeburn <[email-masked]>
  timestamp: Sat 2000-06-24 06:06:53 +0000
  message:
    * process.c (Fopen_network_stream): Turn off atimers for duration of call to
    connect.  (Patch from Gerd.)

  http://cvs.savannah.gnu.org/viewvc/emacs/src/process.c?root=emacs&r1=1.314&r2=1.315

And as of this change, SIGIO was also disabled.

25249 kwzh@gn |       /* Kernel bugs (on Ultrix at least) cause lossage (not just EINTR)
25249 kwzh@gn | 	 when connect is interrupted.  So let's not let it get interrupted.
25249 kwzh@gn | 	 Note we do not turn off polling, because polling is only used
25249 kwzh@gn | 	 when not interrupt_input, and thus not normally used on the systems
25249 kwzh@gn | 	 which have this bug.  On systems which use polling, there's no way
25249 kwzh@gn | 	 to quit if polling is turned off.  */
25249 kwzh@gn |       if (interrupt_input)
25249 kwzh@gn | 	unrequest_sigio ();
25249 kwzh@gn | 
25249 kwzh@gn |       immediate_quit = 1;
25249 kwzh@gn |       QUIT;
25249 kwzh@gn | 
29922 raeburn |       /* This turns off all alarm-based interrupts; the
29922 raeburn | 	 bind_polling_period call above doesn't always turn all the
29922 raeburn | 	 short-interval ones off, especially if interrupt_input is
29922 raeburn | 	 set.
29922 raeburn | 
29922 raeburn | 	 It'd be nice to be able to control the connect timeout
29922 raeburn | 	 though.  Would non-blocking connect calls be portable?  */
29922 raeburn |       turn_on_atimers (0);
25249 kwzh@gn |       ret = connect (s, lres->ai_addr, lres->ai_addrlen);
29922 raeburn |       turn_on_atimers (1);

Does anyone have the mailing list archive around 2000-06?  It's not
found at list.gnu.org.

				     YAMAMOTO Mitsuharu
				[email-masked]