Issue 1:
Looping through and reading 50k Nodes & their properties using the Java API leaks badly when read-_only mode is set on the source.

Below is my code (apologies for being ugly - I've been trying to find this for hours). Un-comment the ".setConfig( GraphDatabaseSettings.read_only, "true" )" to watch it leak. Eclipse MAT had 400k NeoStoreTransactions occupying 1.1GB.

public class Main {
static GraphDatabaseService graphSrc ;
static BatchInserter graphDest ;

public static void main(String[] args) {
Runtime.getRuntime().addShutdownHook( new Thread() {
@Override
public void run() {
if (graphDest!=null)
graphDest.shutdown();
if (graphSrc!=null)
graphSrc.shutdown();
}
});

String src = args[0] ;

graphSrc = new GraphDatabaseFactory()
.newEmbeddedDatabaseBuilder( src )
.loadPropertiesFromFile("neo4j.properties" )
// .setConfig( GraphDatabaseSettings.read_only, "true" )
// .setConfig( GraphDatabaseSettings.cache_type, "none" )
.newGraphDatabase();

//graphDest = BatchInserters.inserter(src+".copy");

copyNodes() ;
}

static final Label[] labels = new Label[0] ;
static List<Label> alLabels = new ArrayList<Label>() ;

static Label[] labels(Node n) {
alLabels.clear();
for (Label x:n.getLabels()) {
alLabels.add(x) ;
}
return alLabels.toArray(labels) ;
}

static Map<String,Object> getProps(PropertyContainer src) {
HashMap<String,Object> props = new HashMap<String,Object>() ;
try (Transaction txInner = graphSrc.beginTx()) {
for (String key:src.getPropertyKeys()) {
props.put(key, src.getProperty(key));
}
txInner.success();
txInner.close();
}
return props ;
}

static void copyNodes() {
int nodes = 0 ;
ArrayList<Long> ids = new ArrayList<Long>() ;
Iterable<Node> srcNodes ;

try (Transaction tx = graphSrc.beginTx()) {
srcNodes = GlobalGraphOperations.at(graphSrc).getAllNodes() ;
for (Node src:srcNodes) {
Map<String,Object> props = getProps(src) ;
//graphDest.createNode(src.getId(), props, labels(src));
ids.add(src.getId()) ;

if ((nodes%1000)==0) {
System.out.print("\r"+nodes+" nodes copied. "+Runtime.getRuntime().freeMemory());
System.gc() ;
}
nodes += 1 ;
}
tx.success();
tx.close();
}
}
}

Output with read_only = false ;

0 nodes copied. 953752000

1000 nodes copied. 987284312

2000 nodes copied. 1002276640

3000 nodes copied. 1012237096

4000 nodes copied. 1011354664

5000 nodes copied. 1010389912

6000 nodes copied. 1009443688

Output with read_only = true ;

0 nodes copied. 975316912

1000 nodes copied. 903150600

2000 nodes copied. 861072744

3000 nodes copied. 818662472

4000 nodes copied. 767496136

5000 nodes copied. 715829648

6000 nodes copied. 667054608

Issue 2:
I'm running the neo4j rest server on small ARM systems, as described here:

https://github.com/cjdaly/napkin/wiki/Server-on-BeagleBone-black

I recently moved from 1.9.x to 2.0M6. Initially I just got things to work by updating my cypher usage to stop using the old ? and ! syntax. Was able to run like this for several days with no issues. Then I added an index like this:

CREATE INDEX ON :NAPKIN(`napkin.segment`)

and reworked my cypher to use the :NAPKIN label. With this change, neo4j becomes unstable in less than a day.

I'm using values in neo4j-wrapper.conf that correspond to -Xmx96m -Xms96m. The neo4j linux process seems to consume increasing (VmPeak) memory over time.

I have more details and a link to the Neo4j log with exception stacks here: cjdaly/napkin#2