java.nio.file.NoSuchFileException:C:\sonarqube\data\es8\node.lock

I am using Sonarqube 10.2.1 community edition from the .zip file on Windows 10.

I was able to get it up and running but didn’t have it configured to scan our Postgres database.

After following a few steps, including downloading sonar scanner and updating the config file for the database credentials, after restarting SonarQube I was getting the “failed to obtain node lock” error.

Following steps found on this site as well as other forums, and restarting my windows machine, I no longer get that error, but I now get the below error. I confirmed that the node.lock file is in the directory it is searching it for. I restarted my PC, verified the node.lock file is not set to “read only” and am still getting this error. Any advice?

2023.10.01 00:00:20 WARN  es[][o.e.e.NodeEnvironment] lock assertion failed
java.nio.file.NoSuchFileException: C:\sonarqube\data\es8\node.lock
	at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85) ~[?:?]
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) ~[?:?]
	at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) ~[?:?]
	at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53) ~[?:?]
	at sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38) ~[?:?]
	at sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:199) ~[?:?]
	at java.nio.file.Files.readAttributes(Files.java:1851) ~[?:?]
	at org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:177) ~[lucene-core-9.5.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment.assertEnvIsLocked(NodeEnvironment.java:1283) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment.dataPaths(NodeEnvironment.java:1083) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.monitor.fs.FsProbe.stats(FsProbe.java:46) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService$FsInfoCache.refresh(FsService.java:93) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService$FsInfoCache.refresh(FsService.java:79) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.common.util.SingleObjectCache.getOrRefresh(SingleObjectCache.java:42) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService.lambda$new$1(FsService.java:57) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.monitor.fs.FsService.stats(FsService.java:67) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.node.NodeService.stats(NodeService.java:154) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.health.node.LocalHealthMonitor$DiskCheck.getDiskUsage(LocalHealthMonitor.java:454) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.health.node.LocalHealthMonitor$DiskCheck.getHealth(LocalHealthMonitor.java:414) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.health.node.LocalHealthMonitor$Monitoring.run(LocalHealthMonitor.java:341) ~[elasticsearch-8.7.0.jar:?]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:891) ~[elasticsearch-8.7.0.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

Hi,

Welcome to the community!

If you’ve verified the file exists, then it’s likely this is a permissions error. Does SonarQube have rights, recursive, to its directory?

Do you have something “helpful”, like Windows Defender or some other virus scanner running on the machine? We’ve seen this type of program lock the files SonarQube needs to operate & that’s why we recommend you not run such things on the machine hosting SonarQube.

 
Ann

Thanks. I shut off Windows Defender and still experience this issue.

After reading other threads on similar issues, I made sure to give permissions to the node.lock file as well and also did a full restart of the machine to make sure nothing was lingering. (saw some other threads that there were issues with processes being hung up in the background, which is not the case here)

Hi,

I believe it’s still possible that WD left files in a bad state. Can you re-grant the user running SonarQube full permissions, recursive, to the SonarQube directory and try again?

 
Ann