Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Mar 2015 08:39:09 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 198727] [PATCH] lang/mono FileSystemWatcher (kevent) deadlock problem
Message-ID:  <bug-198727-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198727

            Bug ID: 198727
           Summary: [PATCH] lang/mono FileSystemWatcher (kevent) deadlock
                    problem
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: mono@FreeBSD.org
          Reporter: radovanovic@gmail.com
             Flags: maintainer-feedback?(mono@FreeBSD.org)
          Keywords: patch
          Assignee: mono@FreeBSD.org

Created attachment 154559
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=154559&action=edit
patch - ready to go into files directory of port

There were 2 problems with mono's original implementation of kevent
FileSystemWatcher on FreeBSD:

* FileSystemWatcher implementation in mono's HEAD for kevent was relying on
Darwin's specific behavior (when kevent is executed with NULL timeout, if
kqueue FD is closed kevent call on Darwin returns with error, however FreeBSD
doesn't behave that way - in fact according to feedback I got from kernel
developers on FreeBSD close would block waiting for kevent to complete thus
causing deadlock)

* All watcher events were generated from the same thread which detected them
and that presented possibility of deadlock if change handler was to
disable/reset watcher (this manifested in ASP.Net applications not being
restarted after dll changes, and not recompiling individual components on
aspx/ascx file changes)

Attached patch fixes those problems (I was able to verify that after applying
it XSP and mono's fastcgi servers behave in expected way).

Attached patch does several things:

* renames member of imported timespec structure from misleading tv_usec to
proper tv_nsec (value is in nanoseconds, not microseconds)

* adds watcher thread abort in case it doesn't gracefully shutdown within 2
seconds (I think not really needed, but better safe than sorry)

* moves actual event dispatching to separate thread (thus eliminating potential
for deadlock described earlier)

Attached patch is to be applied on latest version of port at this moment
(3.12.1)

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-198727-13>