Jens A. Koch

Memory out on Travis-CI?

When a build uses too much memory the OOM killer will get in rage and starts to kill processes.
It’s quite difficult to find the real problem, when the process is killed without any information about a reason.
If you want to identify memory issues, consider adding the following lines to your `.travis.yml` file.

before_install:
# shutdown servies on Travis, which may have a memory impact
# show memory usage before and after shutdown of services
- sudo service --status-all
- sudo free -m -t
- sudo /etc/init.d/mysql stop
- sudo /etc/init.d/postgresql stop
- sudo /etc/init.d/couchdb stop
- sudo /etc/init.d/redis-server stop
- sudo free -m -t
after_failure:
# show memory usage again
- sudo free -m -t
# show actions of the OOM killer
- sudo dmesg

dirty deeds done dirt cheap? err, no…

$ sudo swapon -s

Filename Type Size Used Priority
/dev/null partition 1572864 0 -1

1) What about creating a new swap file with dd?

$ sudo dd if=/dev/zero of=/swapfile_4G.img bs=1024 count=4M
$ sudo mkswap /swapfile_4G.img
$ sudo swapon -p 20 /swapfile_4G.img

> swapon: /swapfile_4G.img: swapon failed: Operation not permitted

 

2) What about cteating a new swap file with fallocate?

$ size="4G" 
$ file_swap=/swapfile_$size.img 
$ sudo touch $file_swap
$ sudo fallocate -l $size /$file_swap
$ sudo mkswap /$file_swap 
$ sudo swapon -p 20 /$file_swap

> fallocate: //swapfile_4G.img: fallocate failed: Operation not supported

OpenVZ does not allow what they call “user defined swap”.
Swap space is only available “as a whole” for the whole system, not for individual VPSes.

Comments Off on Memory out on Travis-CI?

Comments are closed.