[Samba] IIS Change Notifications
agrath at gmail.com
Sat Jan 8 19:13:37 MST 2011
Good afternoon all,
I'm a web developer (c#) who also manages a small hosting environment.
Roughly, our configuration is:
Two IIS7 (Windows Server 2008 Web) servers which share configuration data
and site files from a SMB share located on a ubuntu server.
The ubuntu server is currently running 3.0.28a which is quite old, but read
We've been having a problem with the change notifications from the ubuntu
filesystem reaching IIS.
The symptoms are that if a file is changed on disk (such as a binary/dll or
web.config or similar) are changed, IIS does not flush the appdomain and
reload these files, it continues on using the old files until either
1) an app pool reset is performed (typically bad for performance and not
something you should do all the time)
2) samba is restarted (definitely not recommended)
3) the file that was changed is deleted and then added again
My test case is a simple .net based application which uses code to set the
colour of a box.
I compiled three different binaries, one for red/green/blue.
I can then switch the binaries out with a simple cp
(e.g. cp red/bin/* test/bin - where test is the wwwroot for my test site)
When I update the binary, IIS doesn't reload it.
I have tested many different configurations.
IIS7 accessing XP file share - works
IIS7 accessing Win7 file share - works
IIS7 accessing 2003 file share - works
IIS7 accessing 2008 file share - works
IIS7 accessing ubuntu samba 3.0.28a share - doesn't work
IIS7 accessing ubuntu samba 4.?? beta share - doesn't work
IIS7 accessing ubuntu samba 4 running SMB2 experimental - doesn't work
IIS7 accessing ubuntu 3.5.6 (built from source) share - doesn't work
Basically, if the share provider is windows (SMB1 or SMB2), it works - if
it's linux/samba it doesn't.
I've done a lot of reading on this topic, and I'm pretty sure that IIS uses
a different change notification mechanism to that of your standard file
browser window; that is, if I have a explorer window looking at the share, I
see the modify date change immediately, however IIS doesn't realise and load
the new binary.
I've done some debugging and at one point I saw messages from inside
notify.c; Client only wanted %d bytes, trying to marshall %d bytes\n; which
results in notify_marshall_changes returning false.
As far as I can tell, this bug has existed for quite some time and probably
hasn't been diagnosed correctly.
I tested explicitly today using a windows 7 desktop (IIS7 installed from
programs and features) with both a local folder (to first confirm that my
binaries would work as expected then a freshly installed 10.10 ubuntu with
samba 3.5.4 (from launchpad/aptitude) followed by a built from source 3.5.6.
I tested with 3.5.6 to confirm it wasn't the 4 byte boundry bug recently
The ubuntu server is running on a VM locally.
IIS7 works much smoother with UNC paths than IIS6, except you have to use
caspol to trust the UNC path if you want to execute asp.net binaries.
I'm not very familiar with C code, especially on linux environments so i'm
not sure how to test/provide the information you need to diagnose this bug.
I am happy to file a bug report, but without a working IIS7 installation, it
will be very hard to replicate.
It's not reasonable to expect the samba developers to install and test an
IIS7 install so I would be happy to work with someone on the problem.
I can verify the problem in the most simple test case, and I have tested a
reasonable subset of samba installs.
My thoughts are it's something to do with watching a folder of files, and
this not propogating correctly - as in my testing the notifications reached
samba and appeared to be sent to windows, just IIS didn't respond to them.
This thread from 2003 describes a very similar issue with classic ASP (the
precursor to .net)
This issue would be great to fix, as it's pretty much the only stumbling
block in using SMB as a file share for IIS, we've been doing this for about
a year now - and it works perfectly once you set it up - with the exception
of the change notifications.
We've been working around it by recycling application pools but as mentioned
above, this isn't really a long-term solution and it means 3rd party
developers need way more access to the hosting environment (to recycle pools
etc) than I consider practical.
Appreciate any advice/help - and happy to provide more debugging information
Sniper Systems Ltd
More information about the samba