From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#18861: 25.0.50; gfile-based file notifications are not immediate Date: Mon, 27 Oct 2014 17:29:16 -0700 Message-ID: <87zjchdokj.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414456227 26700 80.91.229.3 (28 Oct 2014 00:30:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 00:30:27 +0000 (UTC) To: 18861@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 28 01:30:19 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Xiufy-0002UP-G8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 01:30:18 +0100 Original-Received: from localhost ([::1]:36511 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xiufy-0007qF-1f for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2014 20:30:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xiufp-0007pu-ED for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 20:30:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xiufj-0006WA-UE for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 20:30:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xiufj-0006Vn-RK for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 20:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xiufj-0001wJ-Bs for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 20:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Oct 2014 00:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18861 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14144561857404 (code B ref -1); Tue, 28 Oct 2014 00:30:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Oct 2014 00:29:45 +0000 Original-Received: from localhost ([127.0.0.1]:37059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiufP-0001vL-UX for submit@debbugs.gnu.org; Mon, 27 Oct 2014 20:29:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50196) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiufN-0001v5-6N for submit@debbugs.gnu.org; Mon, 27 Oct 2014 20:29:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiufC-0006Hg-IV for submit@debbugs.gnu.org; Mon, 27 Oct 2014 20:29:36 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiufC-0006Hb-GP for submit@debbugs.gnu.org; Mon, 27 Oct 2014 20:29:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xiuf7-0007gB-29 for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 20:29:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xiuf1-0006GM-TV for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 20:29:24 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:54463) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xiuf1-0006G9-I1 for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 20:29:19 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E767420CB8 for ; Mon, 27 Oct 2014 20:29:17 -0400 (EDT) Original-Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Mon, 27 Oct 2014 20:29:17 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=x-sasl-enc:from:to:subject:date:message-id:mime-version :content-type; s=mesmtp; bh=/i5TsTruFtzx7C/QNjS10kNYAZY=; b=pjEh BQUygHxe0tujSfqeh3h9of6cbx3VqbYAMfQG25D1CZXrvC1DMfTqkdkugHMH9gpR dFIU8bY03J9oQxdoUP17lQVhamb6YAT7LYqazLyk0FeZSCVhuY2LIBwl0wAx9gat H3DbOHzrsF86fXcfupjckI7TSVlMo0ooOe7zf2k= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:subject:date :message-id:mime-version:content-type; s=smtpout; bh=/i5TsTruFtz x7C/QNjS10kNYAZY=; b=dHWcM3DeGxoHLq/V6f8grNLzbWjm/QlPyg3Di4Czl1W vBUqo8XW6DS8hHE+CcUqiwLnac+h1hZbkVhedjiVVKu1/tvaBi4y4MHR8cHYiTl1 vfbqfSvtokoUim49xBlSm8AVA9bPZI50HR6l/tDAWvIhTJHfLUxdYjTHVJBoUSMw = X-Sasl-enc: WmxjRXYn1Fe5uvQs/nq/PEI4l6jxCOIEb+iSeFwOWydu 1414456157 Original-Received: from shorty.local (unknown [23.243.192.221]) by mail.messagingengine.com (Postfix) with ESMTPA id 9E48AC00006 for ; Mon, 27 Oct 2014 20:29:17 -0400 (EDT) Original-Received: from dima by shorty.local with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1Xiuey-0002h2-8m for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 17:29:16 -0700 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:95176 This is a bug-tracker entry for this mailing list post: http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00941.html Contents of the post: In the last few days I started several threads about various details of file notification and auto-revert behavior. This one is about some incorrect behavior of notifications using the 'gfile' (gio from glib) backend. As in the inotify thread, I set up a simple test. I built emacs using ./configure --with-file-notification=gfile I then ran ./emacs --eval "`cat /tmp/tstnotify.el`" -Q -nw with tstnotify.el being (progn (require 'filenotify) (dolist (fil '("/tmp/tst1" "/tmp/tst2")) (file-notify-add-watch fil '(change attribute-change) (lambda (event) (message "notify event %s" event))) (find-file fil)) (switch-to-buffer "*Messages*")) Here I ask for notifications for two files, and print out the events as they come in. While emacs is running this way, I modify those two files using an external tool. I would expect to see modification events for both of these files, as soon as these modifications happen. Instead, the notifications come in either 30 seconds later, or whenever anything goes through emacs's input queue. So the notification is greatly delayed if the user is not touching their emacs. The reason is that when emacs is idle, it's blocking in the pselect() call in xg_select() in process.c. pselect() is an operating-system call, not a glib one. Later on in xg_select() there's some code to kick the glib event loop, but as long as we're sitting in the pselect(), that secondary event loop remains untouched. Even if you kick the event loop in time, the notification is still delayed a few seconds (I verified this with some test code, outside of emacs; can post if anybody wants it). THIS is a separate issue that is likely a bug in glib. On Linux it uses inotify internally, so if one was using Linux, would there be any reason to use this notification scheme instead of using inotify directly? Are there OSs where emacs supports notifications ONLY through glib?