Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play! Framework on dokku memory issue (heap object)

I get this error when deploying Play! app on dokku: Total 27 (delta 0), reused 0 (delta 0)

-----> Building test ...

Play 2.x - Java app detected

-----> Installing OpenJDK 1.6...done

-----> Building app with sbt

-----> Running: sbt clean compile stage

Error occurred during initialization of VM

Could not reserve enough space for object heap

! Failed to build app with sbt

To [email protected]:test

! [remote rejected] master -> master (pre-receive hook declined)

My server has 512MB of ram and it is VPS. When i use play run command everything is forking fine. Only during dokku deployment i get this error.

Can anyone help me overcome this issue?

like image 317
Michał Leszczyński Avatar asked Feb 07 '14 11:02

Michał Leszczyński


1 Answers

Ran into the same problem today on a Digital Ocean VPS with 512MB RAM. Since the droplet does not have swap space, I decided to added it, by running the following commands as root:

touch /var/swap.img
chmod 600 /var/swap.img
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab

It adds 1GB of swap space.

A second deployment didn't complain about the heap space anymore.

However, in my case, the SBT build failed later on during the deployment. Resizing the droplet to 1024MB did the trick and Dokku reports the application as being deployed.

like image 188
Matthijs Dekker Avatar answered Sep 30 '22 01:09

Matthijs Dekker