When monitored path contains recursive symlinks, recursive calls to readDir() consume all memory.
Uncatched exception in thread [DirectoryMonitor]
Error: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error: at java.lang.StringCoding$StringEncoder.encode(Unknown Source)
Error: at java.lang.StringCoding.encode(Unknown Source)
Error: at java.lang.String.getBytes(Unknown Source)
Error: at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
Error: at java.io.UnixFileSystem.getBooleanAttributes(Unknown Source)
Error: at java.io.File.isDirectory(Unknown Source)
Error: at org.omegat.util.DirectoryMonitor.readDir(DirectoryMonitor.java:140)
Error: at org.omegat.util.DirectoryMonitor.readDir(DirectoryMonitor.java:141)
Error: at org.omegat.util.DirectoryMonitor.readDir(DirectoryMonitor.java:141)
...
For example, to reproduce it one can create one-step loop in dictionaries' directory with (in Linux)
ln -s . qq
In my case I've got this issue because some time ago path to dictionaries directory was set in config to root directory ('/'). Enumerating root directory took a lot of time on dev machine, also some toolchains and links in procfs have recursive links.
Quick and dirty fix attached. It fixes OutOfMemoryError , but if one of monitored directories is set to root, CPU and memory consumption still large.
Alex will apply the fix himself, after reviewing and adapting it.
Didier
Fixed in SVN (/trunk).
The patch was slightly rewritten, and moved to FileUtil.
Didier
Fixed in the released version 3.0.8 update 2 of OmegaT.
Didier