我正在尝试启用 Java Flight Recorder 以在使用 Neo4j Desktop 运行 Cypher 查询时每 10 秒收集一次线程转储。但是在 Neo4j 桌面的“设置”选项卡(配置文件)中,推荐的飞行记录器选项无法识别并在启动过程中抛出错误。
我正在使用 Oracle JDK 11。
这些是我在文件中输入的命令 -
# flight recorder settings
dbms.jvm.additional=-XX:+UnlockCommercialFeatures
dbms.jvm.additional=-XX:+FlightRecorder
dbms.jvm.additional=-XX:FlightRecorderOptions=stackdepth=500
dbms.jvm.additional=-XX:+UnlockDiagnosticVMOptions
dbms.jvm.additional=-XX:+DebugNonSafepoints
当我启动数据库时,这些会引发错误 -
Active database: graph.db
Directories in use:
home: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3
config: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/conf
logs: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/logs
plugins: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/plugins
import: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/import
data: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/data
certificates: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/certificates
run: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/run
Starting Neo4j.
Unrecognized VM option 'UnlockCommercialFeatures'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Active database: graph.db
Directories in use:
home: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3
config: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/conf
logs: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/logs
plugins: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/plugins
import: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/import
data: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/data
certificates: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/certificates
run: /Users/manishgiri/Library/Application Support/Neo4j Desktop/Application/neo4jDatabases/database-4efa4b3e-50bc-46fa-90b2-ee6df8205205/installation-3.5.3/run
Starting Neo4j.
Unrecognized VM option 'FlightRecorder'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
通过在另一个简单程序上进行测试,我已经验证了 Flight Recorder 确实可以在我的机器上运行 -
java -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=duration=120s,filename=myrecording.jfr OOMEGenerator
此命令工作正常并成功生成记录。
还有其他方法可以在配置文件中启用飞行记录器设置吗?