From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: trunk r116499: Improve dbus error handling; detect bus failure Date: Mon, 24 Feb 2014 05:48:45 -0800 Message-ID: <530B4DBD.1090901@dancol.org> References: <87ha7ogbz8.fsf@gmx.de> <530B01C3.5010209@dancol.org> <878ut0gaay.fsf@gmx.de> <8761o4ivj3.fsf@micropit.couberia.selfip.net> <530B4022.5000007@dancol.org> <87zjlgejyo.fsf@gmx.de> <87vbw4ejpb.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1393249736 16229 80.91.229.3 (24 Feb 2014 13:48:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Feb 2014 13:48:56 +0000 (UTC) Cc: =?ISO-8859-1?Q?Peter_M=FCnster?= , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 24 14:49:03 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WHvu3-0004eL-5M for ged-emacs-devel@m.gmane.org; Mon, 24 Feb 2014 14:49:03 +0100 Original-Received: from localhost ([::1]:57730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHvu2-00038j-Pt for ged-emacs-devel@m.gmane.org; Mon, 24 Feb 2014 08:49:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHvtv-00037N-1a for emacs-devel@gnu.org; Mon, 24 Feb 2014 08:49:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHvtq-0004FC-8s for emacs-devel@gnu.org; Mon, 24 Feb 2014 08:48:55 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:44631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHvtp-0004F1-Tw for emacs-devel@gnu.org; Mon, 24 Feb 2014 08:48:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=xZHW/r8TQ2X45WfRmNxsecZzIaBT2g8fdzdRRTrvjV4=; b=A4z5rkIqCD/7hrQDlV5SGiLPSNqkQEQj8urRqd5Oi0HKDuLd4HiNX6RMw+Ym/YQL6zpLgIEqyOIBTRldOU5ZD7WkmXdQDyX5yK4pC2eopxYLo7gMZ/VGOurvLVaeFYu/sX+qHtOs9vukc5cq/bhQvVdSF6xp0SpLM073ML/PdT5ReI315bGvhh8B2B8V8/YISnCpNg3xeQ0/qSrQrgAUbEGWLqJfau6VLv7V2ZfkaFMGXHk1J0UWEAci8wl/JlkjrWiIvByj9qghBfPkoZVruH09liKkGGnzPENzSQ7fwRI1k1zlCwGgXOqi3fOTsCjQp1pOSpR1jm/azWByBN0k4g==; Original-Received: from c-76-104-210-106.hsd1.wa.comcast.net ([76.104.210.106] helo=[192.168.1.50]) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1WHvtm-00036F-PM; Mon, 24 Feb 2014 05:48:46 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <87vbw4ejpb.fsf@gmx.de> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:169837 Archived-At: On 02/24/2014 05:14 AM, Michael Albinus wrote: > Michael Albinus writes: > >> --8<---------------cut here---------------start------------->8--- >> Debugger entered--Lisp error: (dbus-error "call timed out") >> signal(dbus-error ("call timed out")) >> byte-code(...) >> dbus-list-names(:session) >> dbus-register-method(:session "a.b" "/a/b" "a.b" "c" ignore) >> eval((dbus-register-method :session "a.b" "/a/b" "a.b" "c" (quote ignore)) nil) >> eval-last-sexp-1(nil) >> eval-last-sexp(nil) >> call-interactively(eval-last-sexp nil nil) >> command-execute(eval-last-sexp) >> --8<---------------cut here---------------end--------------->8--- >> >> *Messages* contains the traces. > > PS: The *Messages* buffer shows, that the result for dbus-list-names(:session) > has arrived. Maybe your new mechanism has kicked off the result from > `dbus-return-values-table', or it could not be read due to the changed layout. Thanks for coming up with that. I can only repro this problem with dbus-debug turned on, but I think this issue is what Peter's been hitting too. It's actually a core Emacs event loop bug that we never noticed before due to checking read-event's return value and breaking the loop early if it ever returns a dbus event. The problem is this code from read_char in keyboard.c: if (NILP (c)) { c = read_decoded_event_from_main_queue (end_time, local_getcjmp, prev_event, used_mouse_menu); if (end_time && timespec_cmp (*end_time, current_timespec ()) <= 0) goto exit; if (EQ (c, make_number (-2))) { /* This is going to exit from read_char so we had better get rid of this frame's stuff. */ UNGCPRO; return c; } } c here is our dbus event. We managed to successfully read the event, but by the time we returned from read_decoded_event_from_main_queue, we've exceeded the allowed timeout, so we jump directly to exit, completely bypassing the part of read_char that sends the event to special_event_map. As a result, we drop the event on the floor and never process it. The race is small, but because we're using very small timeout values, we hit it more than some other code might. I apparently have a fast enough machine that I never hit this problem during testing. :-) Can you try this patch? === modified file 'src/keyboard.c' --- src/keyboard.c 2014-02-08 04:02:16 +0000 +++ src/keyboard.c 2014-02-24 13:47:18 +0000 @@ -2891,8 +2891,12 @@ { c = read_decoded_event_from_main_queue (end_time, local_getcjmp, prev_event, used_mouse_menu); - if (end_time && timespec_cmp (*end_time, current_timespec ()) <= 0) - goto exit; + if (NILP(c) && end_time && + timespec_cmp (*end_time, current_timespec ()) <= 0) + { + goto exit; + } + if (EQ (c, make_number (-2))) { /* This is going to exit from read_char