incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Cahill <dcah...@midokura.jp>
Subject EntityExistsException on management server startup (createDefaultNetworks)
Date Fri, 02 Nov 2012 08:26:07 GMT
Hi,

Over the past few days, I've run into EntityExistsException several times
when I shut down and restart my management server:

ERROR [cloud.servlet.CloudStartupServlet] (main:) Exception starting
management server
javax.persistence.EntityExistsException: Entity already exists:
at com.cloud.utils.db.GenericDaoBase.persist(GenericDaoBase.java:1318)

This generally requires a drop database, redeploy etc - very time consuming.

I dug into the error a little, and the code behavior seems a little strange.

See com.cloud.server.ConfigurationServerImpl.java, createDefaultNetworks(),
line 1085:

long id = 1;

And line 1141:
_networkDao.persist(network, false,
getServicesAndProvidersForNetwork(networkOfferingId));
id++;

The code is trying to insert rows into the networks table, with "id"s
starting at 1. However, the existing values in the networks table also
start at 1, giving a primary key exception and causing the management
server not to start successfully.

Is the networks table supposed to always be empty at startup so that these
inserts will always succeed even though they are setting id to 1 blindly?
Or is the code wrong to be starting IDs at 1 and failing on duplicate key
exceptions?

Thanks,
Dave.



*Info on my setup:*
Running CloudStack from master (4.1.0-SNAPSHOT).

Setup process for the management server was:

Grab latest from git repo, then:

mvn install
mvn -P developer -pl developer -Ddeploydb
export MAVEN_OPTS="-Xmx1024m -Xdebug
-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
mvn -pl :cloud-client-ui jetty:run

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message