1 | 1 patch for repository dev.allmydata.org:/home/darcs/tahoe/trunk: |
---|
2 | |
---|
3 | Sun Feb 20 21:41:37 PST 2011 "Brian Warner <warner@lothar.com>" |
---|
4 | * web/filenode.py: avoid calling req.finish() on closed HTTP connections |
---|
5 | |
---|
6 | |
---|
7 | New patches: |
---|
8 | |
---|
9 | [web/filenode.py: avoid calling req.finish() on closed HTTP connections |
---|
10 | "Brian Warner <warner@lothar.com>"**20110221054137 |
---|
11 | Ignore-this: 913ed1839612bf30c50a54ac541da286 |
---|
12 | ] { |
---|
13 | hunk ./src/allmydata/web/filenode.py 447 |
---|
14 | req.setHeader("content-length", str(contentsize)) |
---|
15 | if req.method == "HEAD": |
---|
16 | return "" |
---|
17 | + |
---|
18 | + # Twisted >=9.0 throws an error if we call req.finish() on a closed |
---|
19 | + # HTTP connection. It also has req.notifyFinish() to help avoid it. |
---|
20 | + finished = [] |
---|
21 | + def _request_finished(ign): |
---|
22 | + finished.append(True) |
---|
23 | + if hasattr(req, "notifyFinish"): |
---|
24 | + req.notifyFinish().addBoth(_request_finished) |
---|
25 | + |
---|
26 | d = self.filenode.read(req, first, size) |
---|
27 | hunk ./src/allmydata/web/filenode.py 457 |
---|
28 | + |
---|
29 | + def _finished(ign): |
---|
30 | + if not finished: |
---|
31 | + req.finish() |
---|
32 | def _error(f): |
---|
33 | hunk ./src/allmydata/web/filenode.py 462 |
---|
34 | - log.msg("error during GET", facility="tahoe.webish", failure=f, |
---|
35 | - level=log.UNUSUAL, umid="xSiF3w") |
---|
36 | + lp = log.msg("error during GET", facility="tahoe.webish", failure=f, |
---|
37 | + level=log.UNUSUAL, umid="xSiF3w") |
---|
38 | + if finished: |
---|
39 | + log.msg("but it's too late to tell them", parent=lp, |
---|
40 | + level=log.UNUSUAL, umid="j1xIbw") |
---|
41 | + return |
---|
42 | req._tahoe_request_had_error = f # for HTTP-style logging |
---|
43 | if req.startedWriting: |
---|
44 | # The content-type is already set, and the response code has |
---|
45 | hunk ./src/allmydata/web/filenode.py 486 |
---|
46 | # sensible error message. |
---|
47 | eh = MyExceptionHandler() |
---|
48 | eh.renderHTTP_exception(ctx, f) |
---|
49 | - d.addCallbacks(lambda ign: req.finish(), _error) |
---|
50 | + d.addCallbacks(_finished, _error) |
---|
51 | return req.deferred |
---|
52 | |
---|
53 | |
---|
54 | } |
---|
55 | |
---|
56 | Context: |
---|
57 | |
---|
58 | [Add unit tests for cross_check_pkg_resources_versus_import, and a regression test for ref #1355. This requires a little refactoring to make it testable. |
---|
59 | david-sarah@jacaranda.org**20110221015817 |
---|
60 | Ignore-this: 51d181698f8c20d3aca58b057e9c475a |
---|
61 | ] |
---|
62 | [allmydata/__init__.py: .name was used in place of the correct .__name__ when printing an exception. Also, robustify string formatting by using %r instead of %s in some places. fixes #1355. |
---|
63 | david-sarah@jacaranda.org**20110221020125 |
---|
64 | Ignore-this: b0744ed58f161bf188e037bad077fc48 |
---|
65 | ] |
---|
66 | [Refactor StorageFarmBroker handling of servers |
---|
67 | Brian Warner <warner@lothar.com>**20110221015804 |
---|
68 | Ignore-this: 842144ed92f5717699b8f580eab32a51 |
---|
69 | |
---|
70 | Pass around IServer instance instead of (peerid, rref) tuple. Replace |
---|
71 | "descriptor" with "server". Other replacements: |
---|
72 | |
---|
73 | get_all_servers -> get_connected_servers/get_known_servers |
---|
74 | get_servers_for_index -> get_servers_for_psi (now returns IServers) |
---|
75 | |
---|
76 | This change still needs to be pushed further down: lots of code is now |
---|
77 | getting the IServer and then distributing (peerid, rref) internally. |
---|
78 | Instead, it ought to distribute the IServer internally and delay |
---|
79 | extracting a serverid or rref until the last moment. |
---|
80 | |
---|
81 | no_network.py was updated to retain parallelism. |
---|
82 | ] |
---|
83 | [TAG allmydata-tahoe-1.8.2 |
---|
84 | warner@lothar.com**20110131020101] |
---|
85 | Patch bundle hash: |
---|
86 | 6652e330681c75536e57f8cbce87d1a2c9c47521 |
---|