cryptomator / cli

Cryptomator Command-Line Interface
GNU Affero General Public License v3.0
287 stars 43 forks source link

Using FUSE causes one CPU core to be always at 100% usage #35

Closed yankee42 closed 3 years ago

yankee42 commented 4 years ago

Since #33 has not made it into a release yet, I built cryptomator-cli myself from the current master. Then I mounted a vault like this:

java -jar cryptomator.jar --vault myVault=/path/to/encrypted/dir --passwordfile myVault=password.txt --fusemount myVault=/path/to/mountpoint

This immediately generates 100% load on one of my eight cores and the CPU load stays at this level until I unmount the vault again, irrespective of actual file access.

Apart from that the vault works as expected. I can access/add files just fine.

This does not happen when mounting the vault with the GUI. In the later case CPU load is very low.

ndob commented 4 years ago

@overheadhunter Indeed the lines you pointed out are the culprit. I noticed this myself also when running as a systemd service because in that case stdin is basically non-blocking. I fixed it for my use case by using a infinite locking with Object.lock(). The code is here: https://github.com/ndob/cli/tree/fix_cpu_usage

The other possible fix would be the one that we discussed earlier: blocking on the fuse mounts with the option you added to fuse-nio-adapter.

If you think the lock() approach is fine, I can make a pull request of my branch.