all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 22534@debbugs.gnu.org, Michael Albinus <michael.albinus@gmx.de>
Subject: bug#22534: File notify broken on Windows
Date: Thu, 11 Feb 2016 16:19:49 +0100	[thread overview]
Message-ID: <CAFgFV9Oyhc5h2kUhnGpmzpBJGomVRwyUsW_iGpziJ9oxdN5NCA@mail.gmail.com> (raw)
In-Reply-To: <83io1w9y1l.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 7998 bytes --]

Some information regarding the original problem.

I have turned on some tracing and this is what I get with
file-notify-test02-events
along these lines:

$ git diff -w origin/emacs-25 src/w32notify.c
diff --git a/src/w32notify.c b/src/w32notify.c
index 71787c4..66ad277 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -207,6 +207,7 @@ watch_completion (DWORD status, DWORD bytes_ret,
OVERLAPPED *io_info)
      freed by someone already?  In any case, we cannot do anything
      with this request, so just punt and skip it.  FIXME: should we
      raise the 'terminate' flag in this case?  */
+  DebPrint(("status = %lx, io_info = %lx\n", status, io_info));
   if (!io_info)
     return;

@@ -227,6 +228,7 @@ watch_completion (DWORD status, DWORD bytes_ret,
OVERLAPPED *io_info)
          by its buffers; this is done by the main thread in
          remove_watch.  Calling malloc/free from a thread other than
          the main thread is a no-no.  */
+      DebPrint(("Operation aborted."));
       dirwatch->dir = NULL;
       dirwatch->terminate = 1;
     }
@@ -406,11 +408,13 @@ remove_watch (struct notification *dirwatch)
             break;
           Sleep (10);
        }
+      DebPrint(("status = %lx, exit_code = %lx\n", status, exit_code));
       if ((status == FALSE && (err = GetLastError ()) ==
ERROR_INVALID_HANDLE)
           || exit_code == STILL_ACTIVE)
        {
           if (!(status == FALSE && err == ERROR_INVALID_HANDLE))
             {
+              DebPrint(("Terminating thread.\n"));
               TerminateThread (dirwatch->thr, 0);
               if (dirwatch->dir)
                CloseHandle (dirwatch->dir);
@@ -523,7 +527,7 @@ generate notifications correctly, though.  */)
   char *errstr;

   CHECK_LIST (filter);
-
+  DebPrint(("AddWatch\n"));
   /* The underlying features are available only since XP.  */
   if (os_subtype == OS_9X
       || (w32_major_version == 5 && w32_minor_version < 1))

I also forced DebPrint to write on stderr.


When run in batch mode:

$ make SELECTOR='(quote (eql file-notify-test02-events))'   -C
test/automated file-notify-tests
make : on entre dans le répertoire «
/d/Source/emacs/build-emacs-25/test/automated »
make[1] : on entre dans le répertoire «
/d/Source/emacs/build-emacs-25/test/automated »
make[2] : on entre dans le répertoire «
/d/Source/emacs/build-emacs-25/test/automated »
Compiling ../../../emacs/test/automated/file-notify-tests.el
make[2] : on quitte le répertoire «
/d/Source/emacs/build-emacs-25/test/automated »
Testing ../../../emacs/test/automated/file-notify-tests.elc
Running 1 tests (2016-02-11 16:14:39+0100)
AddWatch
status = 0, io_info = 3dd8090
status = 0, io_info = 3dd8090
status = 0, io_info = 3dd8090
status = 3e3, io_info = 3dd8090
Operation aborted.
status = 1, exit_code = 0
AddWatch
status = 0, io_info = 3dd8210
status = 0, io_info = 3dd8210
status = 0, io_info = 3dd8210
status = 3e3, io_info = 3dd8210
Operation aborted.
status = 1, exit_code = 0
AddWatch
status = 0, io_info = 3dd8000
status = 0, io_info = 3dd8000
watch_worker, abnormal exit: 5
QueueUserAPC failed (31)!
status = 1, exit_code = 1
Test file-notify-test02-events backtrace:
  #[0 "\306\307\310C\307C\3111(\312\313\314\315$\317\"\32
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test file-notify-test02-events "Check fi
  ert-run-or-rerun-test([cl-struct-ert--stats (eql file-notify-test02-
  ert-run-tests((eql file-notify-test02-events) #[385 "\306\307\"\203
  ert-run-tests-batch((eql file-notify-test02-events))
  ert-run-tests-batch-and-exit((eql file-notify-test02-events))
  eval((ert-run-tests-batch-and-exit (quote (eql file-notify-test02-ev
  command-line-1(("-L" ";../../../emacs/test/automated" "-l" "ert" "-l
  command-line()
  normal-top-level()
Test file-notify-test02-events condition:
    (ert-test-failed
     ((should
       (file-notify--test-with-events-check events))
      :form
      (file-notify--test-with-events-check
       ((created changed deleted)))
      :value nil :explanation "Received events `(created changed)' do not
match expected events `(created changed deleted)'"))
   FAILED  1/1  file-notify-test02-events

Ran 1 tests, 0 results as expected, 1 unexpected (2016-02-11 16:15:20+0100)

1 unexpected results:
   FAILED  file-notify-test02-events

When I run in normal mode:

$ src/emacs -Q -l ../emacs/test/automated/file-notify-tests.el
AddWatch
status = 0, io_info = 42dd0a0
status = 0, io_info = 42dd0a0
status = 0, io_info = 42dd0a0
status = 0, io_info = 42dd0a0
status = 3e3, io_info = 42dd0a0
Operation aborted.status = 1, exit_code = 0
AddWatch
status = 0, io_info = 42dcc50
status = 0, io_info = 42dcc50
status = 0, io_info = 42dcc50
status = 0, io_info = 42dcc50
status = 3e3, io_info = 42dcc50
Operation aborted.status = 1, exit_code = 0
AddWatch
status = 0, io_info = 42dd310
status = 0, io_info = 42dd310
status = 0, io_info = 42dd310
watch_worker, abnormal exit: 5
QueueUserAPC failed (31)!
status = 1, exit_code = 1
AddWatch
status = 0, io_info = 42dd2b0
status = 0, io_info = 42dd2b0
status = 0, io_info = 42dd2b0
status = 0, io_info = 42dd2b0
status = 0, io_info = 42dd2b0
status = 0, io_info = 42dd2b0
status = 0, io_info = 42dd2b0
status = 0, io_info = 42dd2b0
watch_worker, abnormal exit: 5
QueueUserAPC failed (31)!
status = 1, exit_code = 1
AddWatch
status = 0, io_info = 42dcec0
status = 0, io_info = 42dcec0
status = 0, io_info = 42dcec0
status = 0, io_info = 42dcec0
status = 5, io_info = 42dcec0
watch_worker, abnormal exit: 5
QueueUserAPC failed (31)!
status = 1, exit_code = 1
AddWatch
status = 0, io_info = 42dcec0
status = 0, io_info = 42dcec0
status = 3e3, io_info = 42dcec0
Operation aborted.status = 1, exit_code = 0

and the test is passed.


The first diagnostic is that QueueUserAPC shouldn't fail with error 31.
This happens because the worker thread is already terminating, but that
does not leave
a chance for watch_end to run.

Fabrice

2016-02-10 20:15 GMT+01:00 Eli Zaretskii <eliz@gnu.org>:

> > From: Fabrice Popineau <fabrice.popineau@gmail.com>
> > Date: Mon, 8 Feb 2016 20:15:59 +0100
> > Cc: Michael Albinus <michael.albinus@gmx.de>, 22534@debbugs.gnu.org
> >
> >  > From: Fabrice Popineau <fabrice.popineau@gmail.com>
> >  > Date: Mon, 8 Feb 2016 11:43:10 +0100
> >  > Cc: Eli Zaretskii <eliz@gnu.org>, 22534@debbugs.gnu.org
> >  >
> >  > > events: ((created changed deleted)) ((17491048 created
> >  > >
> c:/Users/Fabrice/AppData/Local/Temp/file-notify-test-parent20748Ali/file-notify-test20748Nvo)
> >  > > (17491048 changed
> >  > >
> c:/Users/Fabrice/AppData/Local/Temp/file-notify-test-parent20748Ali/file-notify-test20748Nvo))
> >  >
> >  > Fails also for me in batch mode. Surprisingly, it doesn't fail always,
> >  > sometimes (about 1 in 10 runs) it succeeds here, and fails in the next
> >  > step. Strange.
> >  >
> >  > I see the same. The deleted notifications number vary. When you
> expect 2, sometimes I see 1.
> >  > When you expect one, sometimes I see it. But not frequently.
> >
> >  Did you try adding calls to read-event after the functions that are
> >  supposed to produce these events?
> >
> > Yes, but with no results.
>
> Strange.  I see none of that on my machine.  Maybe it's because my
> disk is SSD, maybe because this is XP.  Who knows?
>
> Michael, I think it's time to do what you suggested:
>
> > If we do not care the missing `deleted' event in batch mode, I could
> > make it optional in the test.
>
> Re this:
>
> > But maybe it is an indication for a serious problem in w32notify.
>
> It might, but it's unlikely, and I won't have time to dig into this in
> the following weeks, so I guess this will have to wait for a recipe I
> can reproduce on one of my machines.
>
> Thanks.
>

[-- Attachment #2: Type: text/html, Size: 10895 bytes --]

  reply	other threads:[~2016-02-11 15:19 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02  6:23 bug#22534: File notify broken on Windows Fabrice Popineau
2016-02-02 16:15 ` Eli Zaretskii
2016-02-02 23:36   ` Fabrice Popineau
2016-02-03  8:07     ` Michael Albinus
2016-02-03 12:15       ` Fabrice Popineau
2016-02-04  9:49         ` Fabrice Popineau
2016-02-04 18:47           ` Eli Zaretskii
2016-02-05  5:59             ` Fabrice Popineau
2016-02-05 10:10               ` Eli Zaretskii
2016-02-05 15:34                 ` Fabrice Popineau
2016-02-05 17:18                   ` Michael Albinus
2016-02-05 19:43                     ` Eli Zaretskii
2016-02-05 21:58                       ` Michael Albinus
2016-02-06 16:53                       ` Eli Zaretskii
2016-02-06 19:24                         ` Michael Albinus
2016-02-06 19:55                           ` Eli Zaretskii
2016-02-07 13:37                             ` Fabrice Popineau
2016-02-07 17:46                               ` Eli Zaretskii
2016-02-07 18:37                                 ` Michael Albinus
2016-02-07 19:34                                 ` Fabrice Popineau
2016-02-08 10:27                                   ` Michael Albinus
2016-02-08 10:43                                     ` Fabrice Popineau
2016-02-08 18:09                                       ` Eli Zaretskii
2016-02-08 19:14                                         ` Michael Albinus
2016-02-08 19:36                                           ` Eli Zaretskii
2016-02-08 20:00                                             ` Michael Albinus
2016-02-08 20:18                                               ` Eli Zaretskii
2016-02-08 20:51                                                 ` Michael Albinus
2016-02-08 21:03                                                   ` Eli Zaretskii
2016-02-08 21:13                                                     ` Michael Albinus
2016-02-09  3:35                                                       ` Eli Zaretskii
2016-02-09  8:13                                                         ` Michael Albinus
2016-02-09 10:08                                                           ` Michael Albinus
2016-02-09 17:09                                                             ` Eli Zaretskii
2016-02-09 18:47                                                               ` Michael Albinus
2016-02-10 11:25                                                                 ` Michael Albinus
2016-02-08 19:15                                         ` Fabrice Popineau
2016-02-10 19:15                                           ` Eli Zaretskii
2016-02-11 15:19                                             ` Fabrice Popineau [this message]
2016-02-12  8:38                                               ` Eli Zaretskii
2016-02-15 15:31                                             ` Michael Albinus
2016-02-15 15:59                                               ` Eli Zaretskii
2016-02-15 17:52                                                 ` Michael Albinus
2016-02-15 19:46                                                   ` Fabrice Popineau
2016-02-08 10:21                               ` Michael Albinus
2016-02-08 10:40                                 ` Fabrice Popineau
2016-02-08 14:33                                   ` Fabrice Popineau
2016-02-05 19:31                   ` Eli Zaretskii
2016-02-05 17:23                 ` Michael Albinus
     [not found] ` <CAFgFV9P2D6-dcuHnZ2VQ6F2sW85Aj3AZWL85RJxai-LyuE87xw@mail.gmail.com>
     [not found]   ` <CAFgFV9MghLviOcmwmDmasZNmkDjZfoBSuwFOoSHXQNtxxkg9mA@mail.gmail.com>
     [not found]     ` <83egcbun0o.fsf@gnu.org>
     [not found]       ` <CAFgFV9Og72xHW5O9JE8og=7NrTgeMvx01bg_HBOYzduH1vjLfQ@mail.gmail.com>
     [not found]         ` <8360xnukzx.fsf@gnu.org>
     [not found]           ` <CAFgFV9N-+bZf-bBXFaDNsv3dvFQjJbpggPMJrcZ30M-HSaZDwg@mail.gmail.com>
     [not found]             ` <83a8mvprbg.fsf@gnu.org>
     [not found]               ` <CAFgFV9Patgn1GJrDkSeMKsS4cewdQRp4F8VYoftybTQ5TmfPAg@mail.gmail.com>
     [not found]                 ` <83oabbnxvs.fsf@gnu.org>
     [not found]                   ` <CAFgFV9N55HuPkF+mVx6Eh9szUUxhu+BkF-2KJ7nx46-3wsph5Q@mail.gmail.com>
     [not found]                     ` <83io1glmkg.fsf@gnu.org>
     [not found]                       ` <CAFgFV9PxijF1Q3WPo1Ebfqe4cJQVYyiu4bOm41QV4L_OvYZ35w@mail.gmail.com>
     [not found]                         ` <87y4abtwhq.fsf@gmx.de>
     [not found]                           ` <8337sjjsql.fsf@gnu.org>
     [not found]                             ` <CAFgFV9MkwdPHxf_6VqYZdBt8vXwbBUxcOivkCyZWYTvi0H24XQ@mail.gmail.com>
     [not found]                               ` <87ziuc3gay.fsf@gmx.de>
     [not found]                                 ` <83twkkwxdi.fsf@gnu.org>
     [not found]                                   ` <CAFgFV9MdwHK8OG69Dpw6wPj6FK9Fi5c3vQ_jFZaz1BfgGLBLbw@mail.gmail.com>
     [not found]                                     ` <83mvqcwa2v.fsf@gnu.org>
     [not found]                                       ` <CAFgFV9NTSw1LKn_CzrKxNmZvRMbqrctSEer_8oaniH+Lti=n6g@mail.gmail.com>
2016-03-08  7:44                                         ` Michael Albinus
     [not found]                                         ` <83r3fil7z3.fsf@gnu.org>
     [not found]                                           ` <CAFgFV9Pkmz0E7h4mfCLCcxmt29dbDNfAOOp=mbPKnCpPt1B3LQ@mail.gmail.com>
     [not found]                                             ` <83bn6ljbku.fsf@gnu.org>
     [not found]                                               ` <CAFgFV9PnLRZ=2-C4S9jSMpmDUxijCUQQnu-YnAv2-ifm+6kZBA@mail.gmail.com>
     [not found]                                                 ` <83fuvm8wjx.fsf@gnu.org>
2016-03-19 14:51                                                   ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFgFV9Oyhc5h2kUhnGpmzpBJGomVRwyUsW_iGpziJ9oxdN5NCA@mail.gmail.com \
    --to=fabrice.popineau@gmail.com \
    --cc=22534@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.