From owner-freebsd-mono@FreeBSD.ORG Wed Mar 18 21:22:12 2015 Return-Path: Delivered-To: freebsd-mono@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25EBBAD9 for ; Wed, 18 Mar 2015 21:22:12 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A37D0D5E for ; Wed, 18 Mar 2015 21:22:11 +0000 (UTC) Received: by wibg7 with SMTP id g7so70596282wib.1 for ; Wed, 18 Mar 2015 14:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=9w3giJGRy6ULXzSNVh6sfA5i8+JsAjW1BTf2VA+5k70=; b=mjGzUfESpXzTpfQJFA/eR527+jI3h/Pal2KwRb5g63AewYjwZt70PF6hpl6BT1CUTR AIc8szPUI9D1QNrdh+y4qX2czSRwbKD4t1F2qFjmt+cnk99f1+FkSNN0qp3sllYTTPUH 09D5meMheGEgwhEHKCfw2+g879ms/u+8FLp56UU0yn7uZWqW7TwBqEO6+a/O0x/nNe2B eq1LwQ2DIXGX0b3JkDL9NL983PCrzimbwzrA8XTB7iOaRZCBZ86hbCOndzCZVXN49E4n 044+WNRXR01oDgWfqiTITU7i6/hc71MUfG4MKHfck0oh3MvY9BoeTts9NrJQ44fK+8sG rSgA== X-Received: by 10.194.170.193 with SMTP id ao1mr146521447wjc.52.1426713730164; Wed, 18 Mar 2015 14:22:10 -0700 (PDT) Received: from zmaj.softwarehood.com (212-200-205-182.dynamic.isp.telekom.rs. [212.200.205.182]) by mx.google.com with ESMTPSA id fs8sm4781920wib.8.2015.03.18.14.22.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Mar 2015 14:22:09 -0700 (PDT) Message-ID: <5509EC80.1060105@gmail.com> Date: Wed, 18 Mar 2015 22:22:08 +0100 From: Ivan Radovanovic User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130812 Thunderbird/17.0.8 MIME-Version: 1.0 To: freebsd-mono@freebsd.org Subject: Re: ASP.Net and file changes on FreeBSD References: <54F96252.9040705@gmail.com> <55095322.2070604@gmail.com> <5509E8B8.3090602@gmail.com> In-Reply-To: <5509E8B8.3090602@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-mono@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Mono and C# applications on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2015 21:22:12 -0000 On 03/18/15 22:06, Ivan Radovanovic napisa: > On 03/18/15 11:27, Ivan Radovanovic napisa: >> On 03/06/15 09:16, Ivan Radovanovic napisa: >>> Hi, >>> >>> I am running latest ASP.Net using latest mono from ports (3.10) on >>> FreeBSD 10.1 and it seems it is unable to detect changes on (some?) >>> files. What confuses me is that if I run xsp for testing project it is >>> unable to realize that project DLL is recompiled, or if I change >>> web.config it won't restart application manually, or if aspx file is >>> changed it won't recompile it, but if I add new aspx file then it will >>> try to compile that. It seems to me like it is able to detect file >>> addition but not change. >>> >>> Is there some workaround for this? >>> >>> Kind regards, >>> Ivan >>> >>> P.S. >>> Is there some dedicated website/forum for mono on FreeBSD - I saw some >>> page on mono project site but that is completely outdated and I also saw >>> BSD# page on google, but that also seems little bit old? I did little >>> bit of work on having up-to-date xsp/fast-cgi and monodevelop to >>> compile/work on freebsd so I would like to pass that to somebody from >>> freebsd-mono group so it could eventually reach ports :-) >> >> This is actually more interesting problem than what I expected, here are >> conclusions up to this point: >> >> * 3.10.0 has completely broken kevent implentation of FileSystemWatcher >> - so it couldn't restart application because it is not able to detect >> any file changes (I gave up on patching this implementation with latest >> code when I saw that 3.12.1 is ported to FreeBSD) >> >> * 3.12.1 has proper support for FileSystemWatcher, but I suspect >> something in System.Web.dll is broken (for example it properly detects >> dll change (writes message about that), but doesn't restart >> application), I am still unable to pinpoint exact problem there >> >> * 3.2.3 has partially working FileSystemWatcher (using kevent) - it is >> not able to catch file changes but only file creations/deletions, for >> that reason changes using editors like ee which really change file >> contents (not changing inode number) go undetected, but changes with >> editors which recreate file (like monodevelop or gedit for example) are >> properly captured and handled. This version also properly restarts >> application when dll is changed. >> >> I was using identical xsp for all mono versions to rule out differences >> there (I didn't do any tests using fastcgi server or mod_mono - will >> probably do that once I have xsp working as expected). > > There were 2 problems here (applies to 3.12.1): > > * FileSystemWatcher implementation 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), so instead of using (almost) blocking version > of kevent I put reasonable timeout there (instead of 500 seconds they > had I put 0.5 seconds) > > * HttpApplicationFactory wasn't able to restart application domain > because of deadlock within FileSystemWatcher (basically file changed > notification is executed from watcher's thread and then there is attempt > to disable watcher from that same thread). I resolved this by creating > separate thread to post events. > > As far as I can tell at least xsp now works as expected (restaring > application on DLL changes, recompiling changed files if .aspx file is > changed), I will probably test at least fastcgi server soon as well, and > I will try to find solution which would work with blocking kevent. > > Attached is patch for latest mono version in ports (3.12.1) - patch file > should be saved to files subdirectory of port and port should be rebuilt > after that. Previous patch had one mistake (timespec struct in fact uses nanoseconds, not microseconds (mono guys named member tv_usec, so I naturally assumed microseconds were used)) - I realized that when I checked CPU usage. This is final patch attached.