﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	launchpad_bug
1681	avoid using win32eventreactor, or suppress spurious warning from it if necessary	zooko	davidsarah	"!FreeStorm's WinXP buildslave emits this warning ([//buildbot-tahoe-lafs/builders/FreeStorm%20WinXP-x86%20py2.6/builds/38/steps/test/logs/stdio log file]):
{{{
c:\python26\lib\site-packages\twisted\internet\win32eventreactor.py:64: UserWarning: Reliable disconnection notification requires pywin32 215 or later
}}}

Here's the [http://twistedmatrix.com/trac/browser/trunk/twisted/internet/win32eventreactor.py?rev=33404#L56 code in Twisted] that emits that warning.

Here's the [http://twistedmatrix.com/trac/changeset/33049 patch in Twisted] that added this warning (in 2011-11-02).

Here's the [http://twistedmatrix.com/trac/ticket/5233 ticket in Twisted] about the issue.

This might mean that we need to undo our removal of the dependency on pywin32 (#1274), because this newer version of Twisted requires pywin32 in order to do something that we want. (Actually, older versions of Twisted just don't do that thing -- they don't notice sometimes on Windows when a TCP connection is closed -- so this isn't a regression, except for the presence of the warning, which we could suppress.)

I really hope we don't have to reintroduce a dependency on pywin32! We worked long and hard to get rid of that dependency. Adding it back in would increase the number of software packages that a Tahoe-LAFS user has to manually install from two (CPython, Tahoe-LAFS) to three (CPython, pywin32, Tahoe-LAFS). It would also cause all Tahoe-LAFS users, regardless of whether they use Windows or not, to see some text saying ""If you are using Windows, install pywin32 as follows..."" in [source:docs/quickstart.rst], or else to see some text saying ""If you are using Windows, go to this other page to read some platform-specific instructions"". I strongly wish to avoid all of the above.

Another alternative is to monkeypatch twisted to use a C extension module, such as is attached to the twisted ticket, or ctypes instead of pywin32.

Another alternative is not to rely on disconnection notification! In my opinion, code which relies on disconnection notification is almost never necessary and is often incorrect, since disconnection notification can never be really reliable (even if both the foolscap bug and the Twisted/pywin32 bug were fixed).

We've already removed almost all such reliance on disconnection notification above the foolscap layer from Tahoe-LAFS. Our motivation in doing that was the discovery of a bug, that we have never yet fixed, in foolscap's {{{notifyOnDisconnect}}}, but also it was in part motivated by my belief that disconnection-notification is an anti-pattern -- a feature that it is often better to do without

There is one remaining place in Tahoe-LAFS where we rely on foolscap's {{{notifyOnDisconnect}}} -- in the user interface to show the user which servers are currently connected. see #816 for the task of removing that place. There is also the fact that Brian may want to rely on disconnection-notification as an optimization in upload -- see [comment:1:ticket:816 #816 comment 1].

Finally, there is the possibility that this issue could cause problems for our code even though our code doesn't rely on foolscap-level {{{notifyOnDisconnect}}}. For example, what about the HTTP connections between the web browser and the Tahoe-LAFS gateway? I would guess that failure to notice a disconnect will not cause a problem for any of our code (because, like I say, noticing disconnects and responding to them usefully is a dicey proposition at the best of times) but we should probably think it through if we're going to suppress the warning and commit to relying on a version of Twisted which doesn't notice (some) disconnects on Windows."	defect	closed	major	1.9.2	code	1.9.1	fixed	warning windows easy reviewed		
