Rev 3449: Fix MemoryError during large fetches over HTTP. (Eric Holmberg) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu May 22 13:53:20 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3449
revision-id:pqm at pqm.ubuntu.com-20080522125310-lneifpa40hzg4lu2
parent: pqm at pqm.ubuntu.com-20080522095013-rhu6mkle55wxip12
parent: andrew.bennetts at canonical.com-20080522070344-jhmogqlywdjf9584
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-05-22 13:53:10 +0100
message:
  Fix MemoryError during large fetches over HTTP. (Eric Holmberg)
added:
  bzrlib/tests/file_utils.py     file_utils.py-20080506145406-a1h3ydg2lsh2iriy-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/test_http_response.py test_http_response.py-20060628233143-950b2a482a32505d
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
  bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
    ------------------------------------------------------------
    revno: 3408.6.3
    revision-id:andrew.bennetts at canonical.com-20080522070344-jhmogqlywdjf9584
    parent: andrew.bennetts at canonical.com-20080522065306-o2rv51zho4uc8mvz
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: eric
    timestamp: Thu 2008-05-22 17:03:44 +1000
    message:
      Docstring/NEWS tweaks requested by Ian's review.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
    ------------------------------------------------------------
    revno: 3408.6.2
    revision-id:andrew.bennetts at canonical.com-20080522065306-o2rv51zho4uc8mvz
    parent: eholmberg at arrow.com-20080506150227-l3arq1yntdvnoxum
    parent: pqm at pqm.ubuntu.com-20080521154523-4hv5qe8a9drke2h1
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: eric
    timestamp: Thu 2008-05-22 16:53:06 +1000
    message:
      Merge bzr.dev.
    added:
      bzrlib/smart/message.py        message.py-20080222013625-ncqmh3nrxjkxab87-1
      bzrlib/tests/repository_implementations/test_get_parent_map.py test_get_parent_map.-20080421172708-x1z6ot341osr0jq1-1
      doc/developers/releasing.txt   releasing.txt-20080502015919-fnrcav8fwy8ccibu-1
      doc/developers/repository-stream.txt repositorystream.txt-20080410222511-nh6b9bvscvcerh48-1
      doc/en/user-guide/bzrtools_plugin.txt bzrtools_plugin.txt-20080509065016-cjc90f46407vi9a0-1
      doc/en/user-guide/svn_plugin.txt svn_plugin.txt-20080509065016-cjc90f46407vi9a0-2
      doc/en/user-guide/web_browsing.txt web_browsing.txt-20080509065016-cjc90f46407vi9a0-3
      doc/es/                        es-20080504181154-x2fm3oprvjohiz7n-1
      doc/es/guia-desarrollador/     guiadesarrollador-20080504181514-qlh50dq1mj769bic-1
      doc/es/guia-usuario/           guiausuario-20080504181514-qlh50dq1mj769bic-2
      doc/es/guia-usuario/index.txt  index.txt-20080512005856-hgdxkh9xo58n7zdp-2
      doc/es/guia-usuario/resolving_conflicts.txt conflicts.txt-20080504181626-aqnzjwfhpju5ypfe-1
      doc/es/guia-usuario/version_info.txt version_info.txt-20080504181730-u24nugzokrcrk1bf-1
      doc/es/mini-tutorial/          minitutorial-20080504181514-qlh50dq1mj769bic-3
      doc/es/mini-tutorial/index.txt index.txt-20080504182136-wmoc35u2t6kom8ca-1
      doc/es/notas-version/          notasversion-20080504181514-qlh50dq1mj769bic-4
      doc/es/referencia/             referencia-20080504181514-qlh50dq1mj769bic-5
      doc/es/referencia-rapida/      referenciarapida-20080504181514-qlh50dq1mj769bic-6
      doc/es/referencia-rapida/Makefile makefile-20080506002609-y60mr4avuqwzlf4s-1
      doc/es/referencia-rapida/referencia-rapida.svg referenciarapida.svg-20080506002609-y60mr4avuqwzlf4s-2
      doc/index.es.txt               index.es.txt-20080506002113-aunzdhptcoc0h6hm-1
    renamed:
      doc/en/user-guide/best_practice_intro.txt => doc/en/user-guide/part2_intro.txt best_practice_intro.-20071123154453-dk2mjhrg1vpjm5w2-1
    modified:
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/_dirstate_helpers_py.py _dirstate_helpers_py-20070710145033-90nz6cqglsk150jy-1
      bzrlib/_patiencediff_py.py     cdvdifflib.py-20051106064558-f8f8097fbf0db4e4
      bzrlib/add.py                  add.py-20050323030017-3a77d63feda58e33
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
      bzrlib/atomicfile.py           atomicfile.py-20050509044450-dbd24e6c564f7c66
      bzrlib/benchmarks/bench_bundle.py bench_bundle.py-20060719055338-o1c6ieybbwt6c3zv-1
      bzrlib/benchmarks/tree_creator/kernel_like.py kernel_like.py-20060815024128-b16a7pn542u6b13k-1
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/bundle_data.py   read_changeset.py-20050619171944-c0d95aa685537640
      bzrlib/bundle/serializer/v08.py v06.py-20051119041339-ee43f97270b01823
      bzrlib/bundle/serializer/v4.py v10.py-20070611062757-5ggj7k18s9dej0fr-1
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/counted_lock.py         counted_lock.py-20070502135927-7dk86io3ok7ctx6k-1
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/delta.py                delta.py-20050729221636-54cf14ef94783d0a
      bzrlib/deprecated_graph.py     graph.py-20050905070950-b47dce53236c5e48
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
      bzrlib/doc/__init__.py         __init__.py-20051224020731-eb3eb3ef5b4570df
      bzrlib/doc/api/__init__.py     __init__.py-20051224020744-7b87d590843855bc
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/hashcache.py            hashcache.py-20050706091756-fe3a8cc1143ff24f
      bzrlib/help.py                 help.py-20050505025907-4dd7a6d63912f894
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/help_topics/en/authentication.txt authentication_conf.-20071104135035-glfv0ri355tyg1nf-1
      bzrlib/help_topics/en/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
      bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
      bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
      bzrlib/intset.py               intset.py-20050717175247-81cd658f9aaa2731
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/lazy_import.py          lazy_import.py-20060910203832-f77c54gf3n232za0-1
      bzrlib/lazy_regex.py           lazy_regex.py-20061009091222-fyettq6z5qomdl9e-1
      bzrlib/lock.py                 lock.py-20050527050856-ec090bb51bc03349
      bzrlib/lockable_files.py       control_files.py-20051111201905-bb88546e799d669f
      bzrlib/lockdir.py              lockdir.py-20060220222025-98258adf27fbdda3
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/lru_cache.py            lru_cache.py-20070119165515-tlw203kuwh0id5gv-1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/merge3.py               merge3.py-20050704130834-bf0597094828a2e1
      bzrlib/merge_directive.py      merge_directive.py-20070228184838-ja62280spt1g7f4x-1
      bzrlib/missing.py              missing.py-20050812153334-097f7097e2a8bcd1
      bzrlib/multiparent.py          __init__.py-20070410133617-n1jdhcc1n1mibarp-1
      bzrlib/mutabletree.py          mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
      bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/patches.py              patches.py-20050727183609-378c1cc5972ce908
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
      bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
      bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
      bzrlib/reconcile.py            reweave_inventory.py-20051108164726-1e5e0934febac06e
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
      bzrlib/rio.py                  rio.py-20051128032247-770b120b34dfff60
      bzrlib/smart/branch.py         branch.py-20061124031907-mzh3pla28r83r97f-1
      bzrlib/smart/client.py         client.py-20061116014825-2k6ada6xgulslami-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/store/__init__.py       store.py-20050309040759-164dc5173d6406c2
      bzrlib/store/revision/knit.py  knit.py-20060303020652-de5fa299e941a3c7
      bzrlib/store/revision/text.py  text.py-20060303020652-e49155f0da4d14ab
      bzrlib/store/versioned/__init__.py weavestore.py-20050907094258-88262e0434babab9
      bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
      bzrlib/testament.py            testament.py-20051011100429-6d319a18183b13c8
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/__init__.py __init__.py-20051128053524-eba30d8255e08dc3
      bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
      bzrlib/tests/blackbox/test_missing.py test_missing.py-20051211212735-a2cf4c1840bb84c4
      bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
      bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
      bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
      bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
      bzrlib/tests/branch_implementations/test_permissions.py test_permissions.py-20060210110243-245c01403bf0fde6
      bzrlib/tests/bzrdir_implementations/__init__.py __init__.py-20060131065642-34c39b54f42dd048
      bzrlib/tests/commands/__init__.py __init__.py-20070520095518-ecfl8531fxgjeycj-1
      bzrlib/tests/ftp_server.py     ftpserver.py-20071019102346-61jbvdkrr70igauv-1
      bzrlib/tests/http_server.py    httpserver.py-20061012142527-m1yxdj1xazsf8d7s-1
      bzrlib/tests/http_utils.py     HTTPTestUtil.py-20050914180604-247d3aafb7a43343
      bzrlib/tests/interrepository_implementations/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
      bzrlib/tests/interrepository_implementations/test_fetch.py test_fetch.py-20080425213627-j60cjh782ufm83ry-1
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/intertree_implementations/__init__.py __init__.py-20060724101752-09ysswo1a92uqyoz-3
      bzrlib/tests/interversionedfile_implementations/__init__.py __init__.py-20060302012326-981af525594d02ed
      bzrlib/tests/interversionedfile_implementations/test_join.py test_join.py-20060302012326-9b5e9b0f0a03fedc
      bzrlib/tests/inventory_implementations/__init__.py __init__.py-20070821044532-olbadbokgv3qv1yd-1
      bzrlib/tests/per_lock/__init__.py __init__.py-20070314201444-u92yjsqrkh2m3qcb-1
      bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/repository_implementations/test_revision.py testrevprops.py-20051013073044-92bc3c68302ce1bf
      bzrlib/tests/revisionstore_implementations/__init__.py __init__.py-20060303020702-976c4186a0f99edb
      bzrlib/tests/stub_sftp.py      stub_sftp.py-20051027032739-0e7ef4f7bab0e174
      bzrlib/tests/test_ancestry.py  test_ancestry.py-20050913023709-69768e94848312c6
      bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
      bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
      bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
      bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_merge_core.py test_merge_core.py-20050824132511-eb99b23a0eec641b
      bzrlib/tests/test_merge_directive.py test_merge_directive-20070228184838-ja62280spt1g7f4x-2
      bzrlib/tests/test_missing.py   test_missing.py-20051212000028-694fa4f658a81f48
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_patches.py   test_patches.py-20051231203844-f4974d20f6aea09c
      bzrlib/tests/test_permissions.py test_permissions.py-20051215004520-ccf475789c80e80c
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_read_bundle.py test_read_bundle.py-20060615211421-ud8cwr1ulgd914zf-1
      bzrlib/tests/test_registry.py  test_lazy_factory.py-20060809213415-2gfvqadtvdn0phtg-2
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
      bzrlib/tests/test_revisiontree.py test_revisiontree.py-20060615095324-aij44ndxbv1h4c9f-1
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_source.py    test_source.py-20051207061333-a58dea6abecc030d
      bzrlib/tests/test_strace.py    test_strace.py-20070323001526-6zquhhw8leb9m6j8-2
      bzrlib/tests/test_subsume.py   test_subsume.py-20060927040024-tsvh4pchajoayymg-1
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/tests/test_upgrade.py   test_upgrade.py-20051004040251-555fe1d2bae1bc71
      bzrlib/tests/test_version_info.py test_version_info.py-20051228204928-2c364e30b702b41b
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/tests/test_weave.py     testknit.py-20050627023648-9833cc5562ffb785
      bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
      bzrlib/tests/transport_util.py transportutil.py-20070525113600-5v2igk89s8fensom-1
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
      bzrlib/tests/treeshape.py      treeshape.py-20051004094628-312a98f0194306a8
      bzrlib/tests/workingtree_implementations/__init__.py __init__.py-20060203003124-b2aa5aca21a8bfad
      bzrlib/tests/workingtree_implementations/test_add_reference.py test_add_reference.p-20061211024451-yo9i1691dgbv1eyn-1
      bzrlib/tests/workingtree_implementations/test_parents.py test_set_parents.py-20060807231740-yicmnlci1mj8smu1-1
      bzrlib/tests/workingtree_implementations/test_set_root_id.py test_set_root_id.py-20061004073850-0r1c7qikmnkb8m9k-1
      bzrlib/tests/workingtree_implementations/test_walkdirs.py test_walkdirs.py-20060731045042-ch366w6dve2m7ro9-1
      bzrlib/textinv.py              textinv.py-20050411024435-e3898231b7d1897b26c38878
      bzrlib/textui.py               textui.py-20050309040759-5d0cebe09c528e7d
      bzrlib/timestamp.py            timestamp.py-20070306142322-ttbb9oulf3jotljd-1
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/transactions.py         transactions.py-20051007010900-f1313d53cf58e223
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/chroot.py     chroot.py-20061011104729-0us9mgm97z378vnt-1
      bzrlib/transport/decorator.py  decorator.py-20060402223305-e913a0f25319ab42
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
      bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
      bzrlib/transport/http/wsgi.py  wsgi.py-20061005091552-rz8pva0olkxv0sd8-2
      bzrlib/transport/local.py      local_transport.py-20050711165921-9b1f142bfe480c24
      bzrlib/transport/memory.py     memory.py-20051016101338-cd008dbdf69f04fc
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
      bzrlib/transport/sftp.py       sftp.py-20051019050329-ab48ce71b7e32dfe
      bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/treebuilder.py          treebuilder.py-20060907214856-4omn6hf1u7fvrart-1
      bzrlib/tuned_gzip.py           tuned_gzip.py-20060407014720-5aadc518e928e8d2
      bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
      bzrlib/version_info_formats/__init__.py generate_version_info.py-20051228204928-8358edabcddcd97e
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      bzrlib/weave.py                knit.py-20050627021749-759c29984154256b
      bzrlib/weavefile.py            weavefile.py-20050629135233-2ffe0200f103f6c2
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      bzrlib/xml4.py                 xml4.py-20050916091259-db5ab55e7e6ca324
      bzrlib/xml5.py                 xml5.py-20080328030717-t9guwinq8hom0ar3-1
      bzrlib/xml8.py                 xml5.py-20050907032657-aac8f960815b66b1
      doc/developers/HACKING.txt     HACKING-20050805200004-2a5dc975d870f78c
      doc/developers/authentication-ring.txt authring.txt-20070718200437-q5tdik0ne6lor86d-1
      doc/developers/index.txt       index.txt-20070508041241-qznziunkg0nffhiw-1
      doc/developers/network-protocol.txt networkprotocol.txt-20070903044232-woustorrjbmg5zol-1
      doc/developers/tortoise-strategy.txt tortoisestrategy.txt-20080403024510-2ahdqrvnwqrb5p5t-1
      doc/en/user-guide/bug_trackers.txt bug_trackers.txt-20070713223459-khxdlcudraii95uv-1
      doc/en/user-guide/configuring_bazaar.txt configuring_bazaar.t-20071128000722-ncxiua259xwbdbg7-1
      doc/en/user-guide/distributed_intro.txt distributed_intro.tx-20071123154453-dk2mjhrg1vpjm5w2-2
      doc/en/user-guide/hooks.txt    hooks.txt-20070829200551-7nr6e5a1io6x78uf-1
      doc/en/user-guide/index.txt    index.txt-20060622101119-tgwtdci8z769bjb9-2
      doc/en/user-guide/introducing_bazaar.txt introducing_bazaar.t-20071114035000-q36a9h57ps06uvnl-5
      doc/index.txt                  index.txt-20070813101924-07gd9i9d2jt124bf-1
      doc/en/user-guide/part2_intro.txt best_practice_intro.-20071123154453-dk2mjhrg1vpjm5w2-1
    ------------------------------------------------------------
    revno: 3408.6.1
    revision-id:eholmberg at arrow.com-20080506150227-l3arq1yntdvnoxum
    parent: pqm at pqm.ubuntu.com-20080506114010-jwclr2qtiekvawjg
    committer: Eric Holmberg <eholmberg at arrow.com>
    branch nick: bzr-bugfix215426
    timestamp: Tue 2008-05-06 09:02:27 -0600
    message:
      Fix for Bug #215426 in which bzr can cause a MemoryError in socket.recv while
      downloading large packs over http.  This patch limits the request size for
      socket.recv to avoid this problem.
      
      Changes:
      Added mock file object bzrlib.tests.file_utils.
      Added new parameters to bzrlib.osutils.pumpfile.
      Added unit tests for bzrlib.osutils.pumpfile.
      Added usage of bzrlib.osutils.pumpfile to bzrlib.transport.http.response.
    added:
      bzrlib/tests/file_utils.py     file_utils.py-20080506145406-a1h3ydg2lsh2iriy-1
    modified:
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/tests/test_http_response.py test_http_response.py-20060628233143-950b2a482a32505d
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
=== added file 'bzrlib/tests/file_utils.py'
--- a/bzrlib/tests/file_utils.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/file_utils.py	2008-05-06 15:02:27 +0000
@@ -0,0 +1,47 @@
+# Copyright (C) 2008 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from cStringIO import StringIO
+
+class FakeReadFile(object):
+    """A file-like object that can be given predefined content and read
+    like a file.  The maximum size and number of the reads is recorded."""
+
+    def __init__(self, data):
+        """Initialize the mock file object with the provided data."""
+        self.data = StringIO(data)
+        self.max_read_size = None
+        self.read_count = 0
+
+    def read(self, size=-1):
+        """Reads size characters from the input (or the rest of the string if
+        size is -1)."""
+        data = self.data.read(size)
+        self.max_read_size = max(self.max_read_size, len(data))
+        self.read_count += 1
+        return data
+
+    def get_max_read_size(self):
+        """Returns the maximum read size or None if no reads have occured."""
+        return self.max_read_size
+
+    def get_read_count(self):
+        """Returns the number of calls to read."""
+        return self.read_count
+
+    def reset_read_count(self):
+        """Clears the read count."""
+        self.read_count = 0

=== modified file 'NEWS'
--- a/NEWS	2008-05-22 09:50:13 +0000
+++ b/NEWS	2008-05-22 12:53:10 +0000
@@ -49,6 +49,11 @@
       attribute '_remote_is_at_least_1_2' attribute errors.
       (Andrew Bennetts, #220806)
       
+    * Fix MemoryError during large fetches over HTTP by limiting the amount of
+      data we try to read per ``recv`` call.  The problem was observed with
+      Windows and a proxy, but might affect other environments as well.
+      (Eric Holmberg, #215426)
+
     * Issue a warning and ignore passwords declared in authentication.conf when
       used for an ssh scheme (sftp or bzr+ssh).
       (Vincent Ladeuil, #203186)

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2008-05-21 08:31:00 +0000
+++ b/bzrlib/osutils.py	2008-05-22 12:53:10 +0000
@@ -529,19 +529,42 @@
     return False
 
 
-def pumpfile(fromfile, tofile):
+def pumpfile(from_file, to_file, read_length=-1, buff_size=32768):
     """Copy contents of one file to another.
-    
+
+    The read_length can either be -1 to read to end-of-file (EOF) or
+    it can specify the maximum number of bytes to read.
+
+    The buff_size represents the maximum size for each read operation
+    performed on from_file.
+
     :return: The number of bytes copied.
     """
-    BUFSIZE = 32768
     length = 0
-    while True:
-        b = fromfile.read(BUFSIZE)
-        if not b:
-            break
-        tofile.write(b)
-        length += len(b)
+    if read_length >= 0:
+        # read specified number of bytes
+
+        while read_length > 0:
+            num_bytes_to_read = min(read_length, buff_size)
+
+            block = from_file.read(num_bytes_to_read)
+            if not block:
+                # EOF reached
+                break
+            to_file.write(block)
+
+            actual_bytes_read = len(block)
+            read_length -= actual_bytes_read
+            length += actual_bytes_read
+    else:
+        # read to EOF
+        while True:
+            block = from_file.read(buff_size)
+            if not block:
+                # EOF reached
+                break
+            to_file.write(block)
+            length += len(block)
     return length
 
 

=== modified file 'bzrlib/tests/test_http_response.py'
--- a/bzrlib/tests/test_http_response.py	2008-01-02 14:13:55 +0000
+++ b/bzrlib/tests/test_http_response.py	2008-05-06 15:02:27 +0000
@@ -48,6 +48,9 @@
     response,
     _urllib2_wrappers,
     )
+from bzrlib.tests.file_utils import (
+    FakeReadFile,
+    )
 
 
 class ReadSocket(object):
@@ -59,6 +62,7 @@
     def makefile(self, mode='r', bufsize=None):
         return self.readfile
 
+
 class FakeHTTPConnection(_urllib2_wrappers.HTTPConnection):
 
     def __init__(self, sock):
@@ -753,3 +757,38 @@
         out.read()  # Read the whole range
         # Fail to find the boundary line
         self.assertRaises(errors.InvalidHttpResponse, out.seek, 1, 1)
+
+
+class TestRangeFileSizeReadLimited(tests.TestCase):
+    """Test RangeFile _max_read_size functionality which limits the size of
+    read blocks to prevent MemoryError messages in socket.recv.
+    """
+
+    def setUp(self):
+        # create a test datablock larger than _max_read_size.
+        chunk_size = response.RangeFile._max_read_size
+        test_pattern = '0123456789ABCDEF'
+        self.test_data =  test_pattern * (3 * chunk_size / len(test_pattern))
+        self.test_data_len = len(self.test_data)
+
+    def test_max_read_size(self):
+        """Read data in blocks and verify that the reads are not larger than
+           the maximum read size.
+        """
+        # retrieve data in large blocks from response.RangeFile object
+        mock_read_file = FakeReadFile(self.test_data)
+        range_file = response.RangeFile('test_max_read_size', mock_read_file)
+        response_data = range_file.read(self.test_data_len)
+
+        # verify read size was equal to the maximum read size
+        self.assertTrue(mock_read_file.get_max_read_size() > 0)
+        self.assertEqual(mock_read_file.get_max_read_size(),
+                         response.RangeFile._max_read_size)
+        self.assertEqual(mock_read_file.get_read_count(), 3)
+
+        # report error if the data wasn't equal (we only report the size due
+        # to the length of the data)
+        if response_data != self.test_data:
+            message = "Data not equal.  Expected %d bytes, received %d."
+            self.fail(message % (len(response_data), self.test_data_len))
+

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2008-05-07 22:47:56 +0000
+++ b/bzrlib/tests/test_osutils.py	2008-05-22 06:53:06 +0000
@@ -33,6 +33,7 @@
         is_inside_any,
         is_inside_or_parent_of_any,
         pathjoin,
+        pumpfile,
         )
 from bzrlib.tests import (
         probe_unicode_in_user_encoding,
@@ -42,7 +43,10 @@
         TestCaseInTempDir,
         TestSkipped,
         )
-
+from bzrlib.tests.file_utils import (
+    FakeReadFile,
+    )
+from cStringIO import StringIO
 
 class TestOSUtils(TestCaseInTempDir):
 
@@ -319,6 +323,116 @@
         self.assertRaises(errors.BzrError, osutils.kind_marker, "unknown")
 
 
+class TestPumpFile(TestCase):
+    """Test pumpfile method."""
+    def setUp(self):
+        # create a test datablock
+        self.block_size = 512
+        pattern = '0123456789ABCDEF'
+        self.test_data = pattern * (3 * self.block_size / len(pattern))
+        self.test_data_len = len(self.test_data)
+
+    def test_bracket_block_size(self):
+        """Read data in blocks with the requested read size bracketing the
+        block size."""
+        # make sure test data is larger than max read size
+        self.assertTrue(self.test_data_len > self.block_size)
+
+        from_file = FakeReadFile(self.test_data)
+        to_file = StringIO()
+
+        # read (max / 2) bytes and verify read size wasn't affected
+        num_bytes_to_read = self.block_size / 2
+        pumpfile(from_file, to_file, num_bytes_to_read, self.block_size)
+        self.assertEqual(from_file.get_max_read_size(), num_bytes_to_read)
+        self.assertEqual(from_file.get_read_count(), 1)
+
+        # read (max) bytes and verify read size wasn't affected
+        num_bytes_to_read = self.block_size
+        from_file.reset_read_count()
+        pumpfile(from_file, to_file, num_bytes_to_read, self.block_size)
+        self.assertEqual(from_file.get_max_read_size(), num_bytes_to_read)
+        self.assertEqual(from_file.get_read_count(), 1)
+
+        # read (max + 1) bytes and verify read size was limited
+        num_bytes_to_read = self.block_size + 1
+        from_file.reset_read_count()
+        pumpfile(from_file, to_file, num_bytes_to_read, self.block_size)
+        self.assertEqual(from_file.get_max_read_size(), self.block_size)
+        self.assertEqual(from_file.get_read_count(), 2)
+
+        # finish reading the rest of the data
+        num_bytes_to_read = self.test_data_len - to_file.tell()
+        pumpfile(from_file, to_file, num_bytes_to_read, self.block_size)
+
+        # report error if the data wasn't equal (we only report the size due
+        # to the length of the data)
+        response_data = to_file.getvalue()
+        if response_data != self.test_data:
+            message = "Data not equal.  Expected %d bytes, received %d."
+            self.fail(message % (len(response_data), self.test_data_len))
+
+    def test_specified_size(self):
+        """Request a transfer larger than the maximum block size and verify
+        that the maximum read doesn't exceed the block_size."""
+        # make sure test data is larger than max read size
+        self.assertTrue(self.test_data_len > self.block_size)
+
+        # retrieve data in blocks
+        from_file = FakeReadFile(self.test_data)
+        to_file = StringIO()
+        pumpfile(from_file, to_file, self.test_data_len, self.block_size)
+
+        # verify read size was equal to the maximum read size
+        self.assertTrue(from_file.get_max_read_size() > 0)
+        self.assertEqual(from_file.get_max_read_size(), self.block_size)
+        self.assertEqual(from_file.get_read_count(), 3)
+
+        # report error if the data wasn't equal (we only report the size due
+        # to the length of the data)
+        response_data = to_file.getvalue()
+        if response_data != self.test_data:
+            message = "Data not equal.  Expected %d bytes, received %d."
+            self.fail(message % (len(response_data), self.test_data_len))
+
+    def test_to_eof(self):
+        """Read to end-of-file and verify that the reads are not larger than
+        the maximum read size."""
+        # make sure test data is larger than max read size
+        self.assertTrue(self.test_data_len > self.block_size)
+
+        # retrieve data to EOF
+        from_file = FakeReadFile(self.test_data)
+        to_file = StringIO()
+        pumpfile(from_file, to_file, -1, self.block_size)
+
+        # verify read size was equal to the maximum read size
+        self.assertEqual(from_file.get_max_read_size(), self.block_size)
+        self.assertEqual(from_file.get_read_count(), 4)
+
+        # report error if the data wasn't equal (we only report the size due
+        # to the length of the data)
+        response_data = to_file.getvalue()
+        if response_data != self.test_data:
+            message = "Data not equal.  Expected %d bytes, received %d."
+            self.fail(message % (len(response_data), self.test_data_len))
+
+    def test_defaults(self):
+        """Verifies that the default arguments will read to EOF -- this
+        test verifies that any existing usages of pumpfile will not be broken
+        with this new version."""
+        # retrieve data using default (old) pumpfile method
+        from_file = FakeReadFile(self.test_data)
+        to_file = StringIO()
+        pumpfile(from_file, to_file)
+
+        # report error if the data wasn't equal (we only report the size due
+        # to the length of the data)
+        response_data = to_file.getvalue()
+        if response_data != self.test_data:
+            message = "Data not equal.  Expected %d bytes, received %d."
+            self.fail(message % (len(response_data), self.test_data_len))
+
 class TestSafeUnicode(TestCase):
 
     def test_from_ascii_string(self):

=== modified file 'bzrlib/transport/http/response.py'
--- a/bzrlib/transport/http/response.py	2008-01-03 16:26:32 +0000
+++ b/bzrlib/transport/http/response.py	2008-05-22 07:03:44 +0000
@@ -23,10 +23,12 @@
 
 
 import httplib
+from cStringIO import StringIO
 
 from bzrlib import (
     errors,
     trace,
+    osutils,
     )
 
 
@@ -61,6 +63,9 @@
     # 8k chunks should be fine.
     _discarded_buf_size = 8192
 
+    # maximum size of read requests -- used to avoid MemoryError issues in recv
+    _max_read_size = 512 * 1024
+
     def __init__(self, path, infile):
         """Constructor.
 
@@ -182,6 +187,9 @@
         client to clean the socket if we leave bytes unread. This may occur for
         the final boundary line of a multipart response or for any range
         request not entirely consumed by the client (due to offset coalescing)
+
+        :param size:  The number of bytes to read.  Leave unspecified or pass
+            -1 to read to EOF.
         """
         if (self._size > 0
             and self._pos == self._start + self._size):
@@ -201,17 +209,17 @@
                     "Can't read %s bytes across range (%s, %s)"
                     % (size, self._start, self._size))
 
+        # read data from file
+        buffer = StringIO()
+        limited = size
         if self._size > 0:
             # Don't read past the range definition
             limited = self._start + self._size - self._pos
             if size >= 0:
                 limited = min(limited, size)
-            data = self._file.read(limited)
-        else:
-            # Size of file unknown, the user may have specified a size or not,
-            # we delegate that to the filesocket object (-1 means read until
-            # EOF)
-            data = self._file.read(size)
+        osutils.pumpfile(self._file, buffer, limited, self._max_read_size)
+        data = buffer.getvalue()
+
         # Update _pos respecting the data effectively read
         self._pos += len(data)
         return data




More information about the bazaar-commits mailing list