neo4j / neo4j

Graphs for Everyone
http://neo4j.com
GNU General Public License v3.0
13.29k stars 2.38k forks source link

4.0.0: gc log configuration error #12414

Closed mikeblum closed 4 years ago

mikeblum commented 4 years ago

Configuring gc logs causes the database to fail to start up properly.

Neo4j Version: 4.0.0 Enterprise Operating System: Ubuntu 18.04 + Docker API: Docker

Steps to reproduce

  1. Following this guide on configuring garbage collection:

https://neo4j.com/developer/kb/enabling-gc-logging/

  1. neo4j.conf looks like this:
# To enable GC Logging, uncomment this line
dbms.logs.gc.enabled=true

# GC Logging Options
# see https://docs.oracle.com/en/java/javase/11/tools/java.html#GUID-BE93ABDC-999C-4CB5-A88B-1994AAAC74D5
dbms.logs.gc.options=-Xlog:gc*,safepoint,age*=trace

# Number of GC logs to keep.
dbms.logs.gc.rotation.keep_number=7

# Size of each GC log that is kept.
dbms.logs.gc.rotation.size=20m
  1. start the database

Expected behavior

gc log can be sized and rotated.

Actual behavior

Database fails to startup with the following stack trace:

2020-03-01 13:19:32.332+0000 INFO [c.n.s.e.EnterpriseBootstrapper] Neo4j Server shutdown initiated by request
Exception in thread "main" java.lang.IllegalArgumentException: Error evaluating value for setting 'dbms.logs.gc.rotation.size'. '20m' is not a valid long value
    at org.neo4j.configuration.Config.evaluateSetting(Config.java:552)
    at org.neo4j.configuration.Config.evaluateSettingValues(Config.java:384)
    at org.neo4j.configuration.Config.<init>(Config.java:357)
    at org.neo4j.configuration.Config$Builder.build(Config.java:260)
    at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:103)
    at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:89)
    at com.neo4j.server.enterprise.EnterpriseEntryPoint.main(EnterpriseEntryPoint.java:25)
Caused by: java.lang.IllegalArgumentException: '20m' is not a valid long value
    at org.neo4j.configuration.SettingValueParsers$4.parse(SettingValueParsers.java:146)
    at org.neo4j.configuration.SettingValueParsers$4.parse(SettingValueParsers.java:136)
    at org.neo4j.configuration.SettingImpl.parse(SettingImpl.java:85)
    at org.neo4j.configuration.Config.evaluateSetting(Config.java:537)
    ... 6 more
klaren commented 4 years ago

Thanks for reporting!

It appears to be a problem with the settings expecting a long when it really should be a String. I've issued a fix that should be in the next release, 4.0.2.

If you don't need to change rotation size from 20m, you could just comment that line and everything should work. 20m is the default.

You could also work around this by specifying the -Xlog setting as an additional jvm argument. Comment out all of the dbms.logs.gc.* settings and add the following to config:

dbms.jvm.additional=-Xlog:gc*,safepoint,age*=trace:file=path/to/gc.log::filecount=7,filesize=20m

replacing the path and other settings to your needs.