Bug 5045 - smart fails with Cannot allocate memory
Summary: smart fails with Cannot allocate memory
Status: VERIFIED FIXED
Alias: None
Product: Package Management Issues
Classification: Runtime
Component: RPM (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 1.5 M5
Assignee: Paul Eggleton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-08-23 15:32 UTC by Stefan Stanacar
Modified: 2013-10-07 13:40 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Stanacar 2013-08-23 15:32:45 UTC
poky commit: 199b1a8c7d7109d9b59d67bf4dcfeb03be07587a

I'm seeing random failures for smart commands on qemu machines. Pretty hard to replicate them quite constantly, but it all comes down to how much free ram is available in the image (and what else I'm doing at that moment). What follows is one of the "gentle" fails, because usually I get entire stack traces (when running as automated tests) or messages like:
BDB2053 Freeing read locks for locker 0x1fe2:                           
BDB2017 Freeing mutex for process: 

Easiest path to replicate has been this
 - start with fresh qemux86-64 core-image-sato (it's important to have an image with few RAM available).
 - make sure you have Internet acces in the image (or at least access to a smart repo with lots of packages, I usually server DEPLOY_DIR/rpm from a sato-sdk build)
  - run random smart commands, add a few channels, run smart update and them removes and installs

e.g:

root@qemux86-64:~# free
             total         used         free       shared      buffers
Mem:        117164        82580        34584            0         3208
-/+ buffers:              79372        37792
Swap:            0            0            0

# smart info python-smartpm && smart query python-smartpm && smart stats

...

root@qemux86-64:~# smart channel -y --add all type=rpm-md baseurl=http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/rpm/all      

root@qemux86-64:~# smart channel -y --add x86_64 type=rpm-md baseurl=http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/rpm/x86_64

root@qemux86-64:~# smart channel -y --add qemux86_64 type=rpm-md baseurl=http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/rpm/qemux86_64

root@qemux86-64:~# smart channel --show
[x86_64]
type = rpm-md
baseurl = http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/rpm/x86_64

[all]
type = rpm-md
baseurl = http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/rpm/all

[rpmsys]
type = rpm-sys

[qemux86_64]
type = rpm-md
baseurl = http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/rpm/qemux86_64
root@qemux86-64:~# smart update
Loading cache...
Updating cache...               ######################################## [100%]

Fetching information for 'x86_64'...                                           
-> http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/.../repomd.xml   
repomd.xml                      ######################################## [ 16%]
-> http://autobuilder.yoctoproject.org/pub/nightly/.../filelists.xml.gz        
filelists.xml.gz                ######################################## [ 25%]
-> http://autobuilder.yoctoproject.org/pub/nightly/.../primary.xml.gz          
primary.xml.gz                  ######################################## [ 33%]
                                                                               
Fetching information for 'all'...
-> http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/.../repomd.xml   
repomd.xml                      ######################################## [ 50%]
-> http://autobuilder.yoctoproject.org/pub/nightly/.../primary.xml.gz          
primary.xml.gz                  ######################################## [ 58%]
-> http://autobuilder.yoctoproject.org/pub/nightly/.../filelists.xml.gz        
filelists.xml.gz                ######################################## [ 66%]
                                                                               
Fetching information for 'qemux86_64'...
-> http://autobuilder.yoctoproject.org/pub/nightly/20130820-1/.../repomd.xml   
repomd.xml                      ######################################## [ 83%]
-> http://autobuilder.yoctoproject.org/pub/nightly/.../primary.xml.gz          
primary.xml.gz                  ######################################## [ 91%]
-> http://autobuilder.yoctoproject.org/pub/nightly/.../filelists.xml.gz        
filelists.xml.gz                ######################################## [100%]

Updating cache...               ######################################## [100%]

Channels have 6415 new packages.
Saving cache...

--

I got lucky this time, I tried 3 times not to have the process killed.

Usually (AutoBuilder builds) it dies with 

Saving cache...sh: line 1:  1086 Killed                  smart update)



root@qemux86-64:~# smart remove -y psplash-default
Loading cache...
Updating cache...               ######################################## [100%]

Computing transaction...

Removing packages (1):
  psplash-default-0.1+git0+afd4e228c6-r15@x86_64                                

50.9kB will be freed.

Committing transaction...                                                      
Preparing...                    ######################################## [  0%]
   1:Removing psplash-default   ######################################## [100%]
error: Couldn't fork %postun: Cannot allocate memory                           


Yay, here it goes (of course it doesn't remove the package). But that's not the only one seen. Random fails:

root@qemux86-64:~# rpm -e psplash-default
root@qemux86-64:~# rpm -e psplash        
root@qemux86-64:~# smart install psplash        

Preparing...                    ######################################## [  0%]
   1:Installing psplash         ######################################## [ 50%]
Output from psplash-0.1+git0+afd4e228c6-r15@x86_64:                            
error: Couldn't fork %post: Cannot allocate memory                             
   2:Installing psplash-default ######################################## [100%]
Output from psplash-default-0.1+git0+afd4e228c6-r15@x86_64:                    
error: Couldn't fork %post: Cannot allocate memory                             

Might be related to:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=4872
but that's for beagleboard.
Comment 1 Paul Eggleton 2013-09-02 12:06:18 UTC
Patch sent to increase default memory size in runqemu to 256MB, which in my tests here resolves the issue.
Comment 2 Stefan Stanacar 2013-09-02 12:44:24 UTC
Same here, I tested a qemux86-64 with 256MB memory size and haven't seen anymore fails.
Comment 4 Stefan Stanacar 2013-10-07 13:40:12 UTC
Marking as Verified.