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

next in thread | previous in thread | raw e-mail | index | archive | help
Ivan Radovanovic <radovanovic@gmail.com> has reassigned Bugzilla Automation
<bugzilla@FreeBSD.org>'s request for maintainer-feedback to mono@FreeBSD.org:
Bug 198727: [PATCH] lang/mono FileSystemWatcher (kevent) deadlock problem
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198727



--- Description ---
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)



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