Ticket #999: trace-exceptions-option.darcs.patch

File trace-exceptions-option.darcs.patch, 19.3 KB (added by davidsarah, at 2011-09-21T15:54:50Z)

Add --trace-exceptions option to trace raised exceptions on stderr. refs #999

Line 
11 patch for repository http://tahoe-lafs.org/source/tahoe/trunk:
2
3Wed Sep 21 16:47:59 BST 2011  david-sarah@jacaranda.org
4  * Add --trace-exceptions option to trace raised exceptions on stderr. refs #999
5
6New patches:
7
8[Add --trace-exceptions option to trace raised exceptions on stderr. refs #999
9david-sarah@jacaranda.org**20110921154759
10 Ignore-this: c8915d0339c38be57a168b03eddeaca0
11] {
12hunk ./src/allmydata/scripts/common.py 37
13         ["quiet", "q", "Operate silently."],
14         ["version", "V", "Display version numbers."],
15         ["version-and-path", None, "Display version numbers and paths to their locations."],
16+        ["trace-exceptions", None, "Trace raised exceptions, for debugging only."],
17     ]
18     optParameters = [
19         ["node-directory", "d", None, "Specify which Tahoe node directory should be used." + (
20hunk ./src/allmydata/scripts/common.py 60
21         print >>self.stdout, allmydata.get_package_versions_string(show_paths=True, debug=True)
22         self.no_command_needed = True
23 
24+    def opt_trace_exceptions(self):
25+        self._last = (None, None)
26+        def trace_exceptions(frame, event, arg):
27+            if event != 'exception':
28+                return
29+            exc_type, exc_value, exc_traceback = arg
30+            if exc_type in (StopIteration, GeneratorExit, IndexError,):
31+                return
32+            if exc_value in ("'InterfaceClass' object has no attribute '_v_repr'", "_v_attrs",):
33+                return
34+            co = frame.f_code
35+            func_name = co.co_name
36+            line_no = frame.f_lineno
37+            filename = co.co_filename
38+            if func_name == "isTestCase":
39+                return
40+            if filename.endswith("unittest.py") or filename.endswith("pkg_resources.py") \
41+               or "numpy" in filename:
42+                return
43+            if func_name == "read_blacklist" and exc_type == OSError:
44+                return
45+            if (exc_type, exc_value) == self._last:
46+                print >>self.stderr, 'Tracing same at %s:%d in %s' % \
47+                    (func_name, line_no, filename)
48+                return
49+            self._last = (exc_type, exc_value)
50+            print >>self.stderr, 'Tracing %s %r at %s:%d in %s' % \
51+                (exc_type.__name__, exc_value, func_name, line_no, filename)
52+
53+        def trace_calls(frame, event, arg):
54+            if event != 'call':
55+                return
56+            #co = frame.f_code
57+            #func_name = co.co_name
58+            # could do some filtering here
59+            return trace_exceptions
60+
61+        sys.settrace(trace_calls)
62+
63 
64 class BasedirMixin:
65     default_nodedir = _default_nodedir
66}
67
68Context:
69
70[Make platform-detection code tolerate linux-3.0, patch by zooko.
71Brian Warner <warner@lothar.com>**20110915202620
72 Ignore-this: af63cf9177ae531984dea7a1cad03762
73 
74 Otherwise address-autodetection can't find ifconfig. refs #1536
75]
76[test_web.py: fix a bug in _count_leases that was causing us to check only the lease count of one share file, not of all share files as intended.
77david-sarah@jacaranda.org**20110915185126
78 Ignore-this: d96632bc48d770b9b577cda1bbd8ff94
79]
80[docs: insert a newline at the beginning of known_issues.rst to see if this makes it render more nicely in trac
81zooko@zooko.com**20110914064728
82 Ignore-this: aca15190fa22083c5d4114d3965f5d65
83]
84[docs: remove the coding: utf-8 declaration at the to of known_issues.rst, since the trac rendering doesn't hide it
85zooko@zooko.com**20110914055713
86 Ignore-this: 941ed32f83ead377171aa7a6bd198fcf
87]
88[docs: more cleanup of known_issues.rst -- now it passes "rst2html --verbose" without comment
89zooko@zooko.com**20110914055419
90 Ignore-this: 5505b3d76934bd97d0312cc59ed53879
91]
92[docs: more formatting improvements to known_issues.rst
93zooko@zooko.com**20110914051639
94 Ignore-this: 9ae9230ec9a38a312cbacaf370826691
95]
96[docs: reformatting of known_issues.rst
97zooko@zooko.com**20110914050240
98 Ignore-this: b8be0375079fb478be9d07500f9aaa87
99]
100[docs: fix formatting error in docs/known_issues.rst
101zooko@zooko.com**20110914045909
102 Ignore-this: f73fe74ad2b9e655aa0c6075acced15a
103]
104[merge Tahoe-LAFS v1.8.3 release announcement with trunk
105zooko@zooko.com**20110913210544
106 Ignore-this: 163f2c3ddacca387d7308e4b9332516e
107]
108[docs: release notes for Tahoe-LAFS v1.8.3
109zooko@zooko.com**20110913165826
110 Ignore-this: 84223604985b14733a956d2fbaeb4e9f
111]
112[tests: bump up the timeout in this test that fails on FreeStorm's CentOS in order to see if it is just very slow
113zooko@zooko.com**20110913024255
114 Ignore-this: 6a86d691e878cec583722faad06fb8e4
115]
116[interfaces: document that the 'fills-holes-with-zero-bytes' key should be used to detect whether a storage server has that behavior. refs #1528
117david-sarah@jacaranda.org**20110913002843
118 Ignore-this: 1a00a6029d40f6792af48c5578c1fd69
119]
120[CREDITS: more CREDITS for Kevan and David-Sarah
121zooko@zooko.com**20110912223357
122 Ignore-this: 4ea8f0d6f2918171d2f5359c25ad1ada
123]
124[merge NEWS about the mutable file bounds fixes with NEWS about work-in-progress
125zooko@zooko.com**20110913205521
126 Ignore-this: 4289a4225f848d6ae6860dd39bc92fa8
127]
128[doc: add NEWS item about fixes to potential palimpsest issues in mutable files
129zooko@zooko.com**20110912223329
130 Ignore-this: 9d63c95ddf95c7d5453c94a1ba4d406a
131 ref. #1528
132]
133[merge the NEWS about the security fix (#1528) with the work-in-progress NEWS
134zooko@zooko.com**20110913205153
135 Ignore-this: 88e88a2ad140238c62010cf7c66953fc
136]
137[doc: add NEWS entry about the issue which allows unauthorized deletion of shares
138zooko@zooko.com**20110912223246
139 Ignore-this: 77e06d09103d2ef6bb51ea3e5d6e80b0
140 ref. #1528
141]
142[doc: add entry in known_issues.rst about the issue which allows unauthorized deletion of shares
143zooko@zooko.com**20110912223135
144 Ignore-this: b26c6ea96b6c8740b93da1f602b5a4cd
145 ref. #1528
146]
147[storage: more paranoid handling of bounds and palimpsests in mutable share files
148zooko@zooko.com**20110912222655
149 Ignore-this: a20782fa423779ee851ea086901e1507
150 * storage server ignores requests to extend shares by sending a new_length
151 * storage server fills exposed holes (created by sending a write vector whose offset begins after the end of the current data) with 0 to avoid "palimpsest" exposure of previous contents
152 * storage server zeroes out lease info at the old location when moving it to a new location
153 ref. #1528
154]
155[storage: test that the storage server ignores requests to extend shares by sending a new_length, and that the storage server fills exposed holes with 0 to avoid "palimpsest" exposure of previous contents
156zooko@zooko.com**20110912222554
157 Ignore-this: 61ebd7b11250963efdf5b1734a35271
158 ref. #1528
159]
160[immutable: prevent clients from reading past the end of share data, which would allow them to learn the cancellation secret
161zooko@zooko.com**20110912222458
162 Ignore-this: da1ebd31433ea052087b75b2e3480c25
163 Declare explicitly that we prevent this problem in the server's version dict.
164 fixes #1528 (there are two patches that are each a sufficient fix to #1528 and this is one of them)
165]
166[storage: remove the storage server's "remote_cancel_lease" function
167zooko@zooko.com**20110912222331
168 Ignore-this: 1c32dee50e0981408576daffad648c50
169 We're removing this function because it is currently unused, because it is dangerous, and because the bug described in #1528 leaks the cancellation secret, which allows anyone who knows a file's storage index to abuse this function to delete shares of that file.
170 fixes #1528 (there are two patches that are each a sufficient fix to #1528 and this is one of them)
171]
172[storage: test that the storage server does *not* have a "remote_cancel_lease" function
173zooko@zooko.com**20110912222324
174 Ignore-this: 21c652009704652d35f34651f98dd403
175 We're removing this function because it is currently unused, because it is dangerous, and because the bug described in #1528 leaks the cancellation secret, which allows anyone who knows a file's storage index to abuse this function to delete shares of that file.
176 ref. #1528
177]
178[immutable: test whether the server allows clients to read past the end of share data, which would allow them to learn the cancellation secret
179zooko@zooko.com**20110912221201
180 Ignore-this: 376e47b346c713d37096531491176349
181 Also test whether the server explicitly declares that it prevents this problem.
182 ref #1528
183]
184[Retrieve._activate_enough_peers: rewrite Verify logic
185Brian Warner <warner@lothar.com>**20110909181150
186 Ignore-this: 9367c11e1eacbf025f75ce034030d717
187]
188[Retrieve: implement/test stopProducing
189Brian Warner <warner@lothar.com>**20110909181150
190 Ignore-this: 47b2c3df7dc69835e0a066ca12e3c178
191]
192[move DownloadStopped from download.common to interfaces
193Brian Warner <warner@lothar.com>**20110909181150
194 Ignore-this: 8572acd3bb16e50341dbed8eb1d90a50
195]
196[retrieve.py: remove vestigal self._validated_readers
197Brian Warner <warner@lothar.com>**20110909181150
198 Ignore-this: faab2ec14e314a53a2ffb714de626e2d
199]
200[Retrieve: rewrite flow-control: use a top-level loop() to catch all errors
201Brian Warner <warner@lothar.com>**20110909181150
202 Ignore-this: e162d2cd53b3d3144fc6bc757e2c7714
203 
204 This ought to close the potential for dropped errors and hanging downloads.
205 Verify needs to be examined, I may have broken it, although all tests pass.
206]
207[Retrieve: merge _validate_active_prefixes into _add_active_peers
208Brian Warner <warner@lothar.com>**20110909181150
209 Ignore-this: d3ead31e17e69394ae7058eeb5beaf4c
210]
211[Retrieve: remove the initial prefix-is-still-good check
212Brian Warner <warner@lothar.com>**20110909181150
213 Ignore-this: da66ee51c894eaa4e862e2dffb458acc
214 
215 This check needs to be done with each fetch from the storage server, to
216 detect when someone has changed the share (i.e. our servermap goes stale).
217 Doing it just once at the beginning of retrieve isn't enough: a write might
218 occur after the first segment but before the second, etc.
219 
220 _try_to_validate_prefix() was not removed: it will be used by the future
221 check-with-each-fetch code.
222 
223 test_mutable.Roundtrip.test_corrupt_all_seqnum_late was disabled, since it
224 fails until this check is brought back. (the corruption it applies only
225 touches the prefix, not the block data, so the check-less retrieve actually
226 tolerates it). Don't forget to re-enable it once the check is brought back.
227]
228[MDMFSlotReadProxy: remove the queue
229Brian Warner <warner@lothar.com>**20110909181150
230 Ignore-this: 96673cb8dda7a87a423de2f4897d66d2
231 
232 This is a neat trick to reduce Foolscap overhead, but the need for an
233 explicit flush() complicates the Retrieve path and makes it prone to
234 lost-progress bugs.
235 
236 Also change test_mutable.FakeStorageServer to tolerate multiple reads of the
237 same share in a row, a limitation exposed by turning off the queue.
238]
239[rearrange Retrieve: first step, shouldn't change order of execution
240Brian Warner <warner@lothar.com>**20110909181149
241 Ignore-this: e3006368bfd2802b82ea45c52409e8d6
242]
243[CLI: test_cli.py -- remove an unnecessary call in test_mkdir_mutable_type. refs #1527
244david-sarah@jacaranda.org**20110906183730
245 Ignore-this: 122e2ffbee84861c32eda766a57759cf
246]
247[CLI: improve test for 'tahoe mkdir --mutable-type='. refs #1527
248david-sarah@jacaranda.org**20110906183020
249 Ignore-this: f1d4598e6c536f0a2b15050b3bc0ef9d
250]
251[CLI: make the --mutable-type option value for 'tahoe put' and 'tahoe mkdir' case-insensitive, and change --help for these commands accordingly. fixes #1527
252david-sarah@jacaranda.org**20110905020922
253 Ignore-this: 75a6df0a2df9c467d8c010579e9a024e
254]
255[cli: make --mutable-type imply --mutable in 'tahoe put'
256Kevan Carstensen <kevan@isnotajoke.com>**20110903190920
257 Ignore-this: 23336d3c43b2a9554e40c2a11c675e93
258]
259[SFTP: add a comment about a subtle interaction between OverwriteableFileConsumer and GeneralSFTPFile, and test the case it is commenting on.
260david-sarah@jacaranda.org**20110903222304
261 Ignore-this: 980c61d4dd0119337f1463a69aeebaf0
262]
263[improve the storage/mutable.py asserts even more
264warner@lothar.com**20110901160543
265 Ignore-this: 5b2b13c49bc4034f96e6e3aaaa9a9946
266]
267[storage/mutable.py: special characters in struct.foo arguments indicate standard as opposed to native sizes, we should be using these characters in these asserts
268wilcoxjg@gmail.com**20110901084144
269 Ignore-this: 28ace2b2678642e4d7269ddab8c67f30
270]
271[docs/write_coordination.rst: fix formatting and add more specific warning about access via sshfs.
272david-sarah@jacaranda.org**20110831232148
273 Ignore-this: cd9c851d3eb4e0a1e088f337c291586c
274]
275[test_mutable.Version: consolidate some tests, reduce runtime from 19s to 15s
276warner@lothar.com**20110831050451
277 Ignore-this: 64815284d9e536f8f3798b5f44cf580c
278]
279[mutable/retrieve: handle the case where self._read_length is 0.
280Kevan Carstensen <kevan@isnotajoke.com>**20110830210141
281 Ignore-this: fceafbe485851ca53f2774e5a4fd8d30
282 
283 Note that the downloader will still fetch a segment for a zero-length
284 read, which is wasteful. Fixing that isn't specifically required to fix
285 #1512, but it should probably be fixed before 1.9.
286]
287[NEWS: added summary of all changes since 1.8.2. Needs editing.
288Brian Warner <warner@lothar.com>**20110830163205
289 Ignore-this: 273899b37a899fc6919b74572454b8b2
290]
291[test_mutable.Update: only upload the files needed for each test. refs #1500
292Brian Warner <warner@lothar.com>**20110829072717
293 Ignore-this: 4d2ab4c7523af9054af7ecca9c3d9dc7
294 
295 This first step shaves 15% off the runtime: from 139s to 119s on my laptop.
296 It also fixes a couple of places where a Deferred was being dropped, which
297 would cause two tests to run in parallel and also confuse error reporting.
298]
299[Let Uploader retain History instead of passing it into upload(). Fixes #1079.
300Brian Warner <warner@lothar.com>**20110829063246
301 Ignore-this: 3902c58ec12bd4b2d876806248e19f17
302 
303 This consistently records all immutable uploads in the Recent Uploads And
304 Downloads page, regardless of code path. Previously, certain webapi upload
305 operations (like PUT /uri/$DIRCAP/newchildname) failed to pass the History
306 object and were left out.
307]
308[Fix mutable publish/retrieve timing status displays. Fixes #1505.
309Brian Warner <warner@lothar.com>**20110828232221
310 Ignore-this: 4080ce065cf481b2180fd711c9772dd6
311 
312 publish:
313 * encrypt and encode times are cumulative, not just current-segment
314 
315 retrieve:
316 * same for decrypt and decode times
317 * update "current status" to include segment number
318 * set status to Finished/Failed when download is complete
319 * set progress to 1.0 when complete
320 
321 More improvements to consider:
322 * progress is currently 0% or 100%: should calculate how many segments are
323   involved (remembering retrieve can be less than the whole file) and set it
324   to a fraction
325 * "fetch" time is fuzzy: what we want is to know how much of the delay is not
326   our own fault, but since we do decode/decrypt work while waiting for more
327   shares, it's not straightforward
328]
329[Teach 'tahoe debug catalog-shares about MDMF. Closes #1507.
330Brian Warner <warner@lothar.com>**20110828080931
331 Ignore-this: 56ef2951db1a648353d7daac6a04c7d1
332]
333[debug.py: remove some dead comments
334Brian Warner <warner@lothar.com>**20110828074556
335 Ignore-this: 40e74040dd4d14fd2f4e4baaae506b31
336]
337[hush pyflakes
338Brian Warner <warner@lothar.com>**20110828074254
339 Ignore-this: bef9d537a969fa82fe4decc4ba2acb09
340]
341[MutableFileNode.set_downloader_hints: never depend upon order of dict.values()
342Brian Warner <warner@lothar.com>**20110828074103
343 Ignore-this: caaf1aa518dbdde4d797b7f335230faa
344 
345 The old code was calculating the "extension parameters" (a list) from the
346 downloader hints (a dictionary) with hints.values(), which is not stable, and
347 would result in corrupted filecaps (with the 'k' and 'segsize' hints
348 occasionally swapped). The new code always uses [k,segsize].
349]
350[layout.py: fix MDMF share layout documentation
351Brian Warner <warner@lothar.com>**20110828073921
352 Ignore-this: 3f13366fed75b5e31b51ae895450a225
353]
354[teach 'tahoe debug dump-share' about MDMF and offsets. refs #1507
355Brian Warner <warner@lothar.com>**20110828073834
356 Ignore-this: 3a9d2ef9c47a72bf1506ba41199a1dea
357]
358[test_mutable.Version.test_debug: use splitlines() to fix buildslaves
359Brian Warner <warner@lothar.com>**20110828064728
360 Ignore-this: c7f6245426fc80b9d1ae901d5218246a
361 
362 Any slave running in a directory with spaces in the name was miscounting
363 shares, causing the test to fail.
364]
365[test_mutable.Version: exercise 'tahoe debug find-shares' on MDMF. refs #1507
366Brian Warner <warner@lothar.com>**20110828005542
367 Ignore-this: cb20bea1c28bfa50a72317d70e109672
368 
369 Also changes NoNetworkGrid to put shares in storage/shares/ .
370]
371[test_mutable.py: oops, missed a .todo
372Brian Warner <warner@lothar.com>**20110828002118
373 Ignore-this: fda09ae86481352b7a627c278d2a3940
374]
375[test_mutable: merge davidsarah's patch with my Version refactorings
376warner@lothar.com**20110827235707
377 Ignore-this: b5aaf481c90d99e33827273b5d118fd0
378]
379[Make the immutable/read-only constraint checking for MDMF URIs identical to that for SSK URIs. refs #393
380david-sarah@jacaranda.org**20110823012720
381 Ignore-this: e1f59d7ff2007c81dbef2aeb14abd721
382]
383[Additional tests for MDMF URIs and for zero-length files. refs #393
384david-sarah@jacaranda.org**20110823011532
385 Ignore-this: a7cc0c09d1d2d72413f9cd227c47a9d5
386]
387[Additional tests for zero-length partial reads and updates to mutable versions. refs #393
388david-sarah@jacaranda.org**20110822014111
389 Ignore-this: 5fc6f4d06e11910124e4a277ec8a43ea
390]
391[test_mutable.Version: factor out some expensive uploads, save 25% runtime
392Brian Warner <warner@lothar.com>**20110827232737
393 Ignore-this: ea37383eb85ea0894b254fe4dfb45544
394]
395[SDMF: update filenode with correct k/N after Retrieve. Fixes #1510.
396Brian Warner <warner@lothar.com>**20110827225031
397 Ignore-this: b50ae6e1045818c400079f118b4ef48
398 
399 Without this, we get a regression when modifying a mutable file that was
400 created with more shares (larger N) than our current tahoe.cfg . The
401 modification attempt creates new versions of the (0,1,..,newN-1) shares, but
402 leaves the old versions of the (newN,..,oldN-1) shares alone (and throws a
403 assertion error in SDMFSlotWriteProxy.finish_publishing in the process).
404 
405 The mixed versions that result (some shares with e.g. N=10, some with N=20,
406 such that both versions are recoverable) cause problems for the Publish code,
407 even before MDMF landed. Might be related to refs #1390 and refs #1042.
408]
409[layout.py: annotate assertion to figure out 'tahoe backup' failure
410Brian Warner <warner@lothar.com>**20110827195253
411 Ignore-this: 9b92b954e3ed0d0f80154fff1ff674e5
412]
413[Add 'tahoe debug dump-cap' support for MDMF, DIR2-CHK, DIR2-MDMF. refs #1507.
414Brian Warner <warner@lothar.com>**20110827195048
415 Ignore-this: 61c6af5e33fc88e0251e697a50addb2c
416 
417 This also adds tests for all those cases, and fixes an omission in uri.py
418 that broke parsing of DIR2-MDMF-Verifier and DIR2-CHK-Verifier.
419]
420[MDMF: more writable/writeable consistentifications
421warner@lothar.com**20110827190602
422 Ignore-this: 22492a9e20c1819ddb12091062888b55
423]
424[MDMF: s/Writable/Writeable/g, for consistency with existing SDMF code
425warner@lothar.com**20110827183357
426 Ignore-this: 9dd312acedbdb2fc2f7bef0d0fb17c0b
427]
428[setup.cfg: remove no-longer-supported test_mac_diskimage alias. refs #1479
429david-sarah@jacaranda.org**20110826230345
430 Ignore-this: 40e908b8937322a290fb8012bfcad02a
431]
432[test_mutable.Update: increase timeout from 120s to 400s, slaves are failing
433Brian Warner <warner@lothar.com>**20110825230140
434 Ignore-this: 101b1924a30cdbda9b2e419e95ca15ec
435]
436[tests: fix check_memory test
437zooko@zooko.com**20110825201116
438 Ignore-this: 4d66299fa8cb61d2ca04b3f45344d835
439 fixes #1503
440]
441[TAG allmydata-tahoe-1.9.0a1
442warner@lothar.com**20110825161122
443 Ignore-this: 3cbf49f00dbda58189f893c427f65605
444]
445Patch bundle hash:
446ad0d18155286b95c94267556156e7aa3b82260b5