Michał Leszczyński
Michał Leszczyński

Reputation: 356

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?

Upvotes: 5

Views: 725

Answers (1)

Matthijs Dekker
Matthijs Dekker

Reputation: 206

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.

Upvotes: 7

Related Questions