out of memory Fetching revisions:Inserting stream:Estimate on AIX

Bug #856731 reported by Adi Roiban
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
Martin Packman
2.4
Fix Released
Medium
Martin Packman

Bug Description

I am trying to pull some changes in a branch using bzr on AIX.

I was able to do the initial branch, but now the branch got an update 100Mb.

The whole repository has now 500MB.

The AIX machine has 2.7GB of free RAM Memory.

I tried with both precompiled bzr 2.2.1-1 from bzrunix project, and I have also manually installed the latest bzr 2.5b1 sources.

Here is the output of the command:

bash-3.2$ bzr pull
Using saved parent location: sftp://repo/agent/series-1.5/
Connected (version 2.0, client OpenSSH_5.1p1)
SSH adi@repo password:
Authentication (password) successful!
Secsh channel 1 opened.
[chan 1] Opened sftp connection (server version 3)
 15689kB 92kB/s / Fetching revisions:Inserting stream:Estimate 210/39
 19818kB 106kB/s | Fetching revisions:Inserting stream:Estimate 210/39
 30206kB 95kB/s \ Fetching revisions:Inserting stream:Estimate 210/39
 38037kB 87kB/s | Fetching revisions:Inserting stream:Estimate 210/39
bzr: out of memory / Fetching revisions:Inserting stream:Estimate 210/39
Use -Dmem_dump to dump memory to a file.

Tags: memory aix

Related branches

Revision history for this message
Martin Pool (mbp) wrote :

Hi Adi,

Thanks for the report.

Please attach the traceback from ~/.bzr.log and if possible the run with -Dmem_dump.

istr seeing something like this being due to a unix api quirk rather than actually being out of memory.

Changed in bzr:
importance: Undecided → Medium
status: New → Incomplete
tags: added: aix memory
Revision history for this message
Adi Roiban (adiroiban) wrote :

Hi,

Here is a new run on another branch:

$ bzr branch -Dmem_dump sftp://repo.tld/home/project/bzr/server/devel
Connected (version 2.0, client OpenSSH_5.1p1)
SSH <email address hidden> password:
Authentication (password) successful!
Secsh channel 1 opened.
[chan 1] Opened sftp connection (server version 3)
bzr: out of memory | Fetching revisions:Inserting stream:Estimate 1092/3759
Memory dumped to /tmp/bzr_memdumpJjQyLe.json

Here is the bzr_log:
http://dl.dropbox.com/u/174543/bzr_log

And here is the memory dump:
http://dl.dropbox.com/u/174543/bzr_memdumpJjQyLe.json.tar.bz2

Cheers,
Adi

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 856731] Re: out of memory Fetching revisions:Inserting stream:Estimate on AIX

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9/23/2011 9:23 AM, Martin Pool wrote:
> Hi Adi,
>
> Thanks for the report.
>
> Please attach the traceback from ~/.bzr.log and if possible the run
> with -Dmem_dump.
>
> istr seeing something like this being due to a unix api quirk
> rather than actually being out of memory.
>
> ** Changed in: bzr Importance: Undecided => Medium
>
> ** Changed in: bzr Status: New => Incomplete
>
> ** Tags added: aix memory
>

If it is AIX, my guess is that we are missing a place where
"malloc(0)" returns NULL rather than a pointer like a lot of GNU based
systems. I know we had to fix up some patience-diff code for that case.

Given the traceback, I'm suspecting the create_delta_index_from_delta
code.

Specifically:
max_num_entries = (src->size - 1) / RABIN_WINDOW;

/* allocate an array to hold whatever entries we find */
entries = malloc(sizeof(*entry) * max_num_entries);
if (!entries) /* malloc failure */
    return DELTA_OUT_OF_MEMORY;

If src->size is less than 17, then that ends up as (16-1) / 16 = 0.
The algorithm still works today, because all the rest of the code just
skips, and doesn't try to assign anything into the entries list.
However, we could just do:

if (max_num_entries == 0) {
  *fresh = old_index;
  return DELTA_OK;
}

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk58XZMACgkQJdeBCYSNAANCkQCffLbMJ97M6cv+xA6bOnSAY6oQ
PggAn3x0i5uvD32HWZ0aj4+ceiiwoT3J
=Q3f4
-----END PGP SIGNATURE-----

Revision history for this message
Martin Packman (gz) wrote :

John's analysis and proposed solution looks dead on, I'll put up a branch with that change.

Changed in bzr:
assignee: nobody → Martin Packman (gz)
status: Incomplete → In Progress
Revision history for this message
Martin Packman (gz) wrote :

Adi: If possible could you test the branch linked with the fix?

If you run `bzr selftest -s bt.test_groupcompress after compiling the pyrex extensions, you should get test failures currently, and they should go away with the new branch.

Revision history for this message
Adi Roiban (adiroiban) wrote :

Hi,

Sorry for the delay.
I have tested the branch and everything looks OK.

Many thanks for this quick fix.

Cheers,
Adi

Martin Packman (gz)
Changed in bzr:
milestone: none → 2.5b2
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.