From c9e4103a4e2bd032a8651e7d7088982d3d6821bc Mon Sep 17 00:00:00 2001 From: Javier Vasquez Date: Mon, 21 Jan 2019 19:35:25 -0600 Subject: [PATCH] Fixing Multi threading issue: https://github.com/dsoprea/GDriveFS/issues/132 --- gdrivefs/config/__init__.py | 1 + gdrivefs/resources/README.rst | 14 ++++++++++++++ gdrivefs/resources/scripts/gdfs | 2 +- gdrivefs/resources/scripts/gdfstool | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gdrivefs/config/__init__.py b/gdrivefs/config/__init__.py index 1d76ddf..68ddab6 100644 --- a/gdrivefs/config/__init__.py +++ b/gdrivefs/config/__init__.py @@ -1,5 +1,6 @@ import os IS_DEBUG = bool(int(os.environ.get('GD_DEBUG', '0'))) +NO_THREADS = bool(int(os.environ.get('GD_NOTHREADS', '1'))) DO_LOG_FUSE_MESSAGES = bool(int(os.environ.get('GD_DO_LOG_FUSE_MESSAGES', '0'))) DEFAULT_CREDENTIALS_FILEPATH = os.path.expandvars('$HOME/.gdfs/creds') diff --git a/gdrivefs/resources/README.rst b/gdrivefs/resources/README.rst index ba40eb1..83a64c6 100644 --- a/gdrivefs/resources/README.rst +++ b/gdrivefs/resources/README.rst @@ -224,6 +224,20 @@ Just set the `GD_DEBUG` environment variable to "1":: flags=0x00000011 +Multi-threading FUSE +==================== + +It used to be that GDFS mounting used FUSE with no threads, only when running in +debugging-mode, and actually if not in debugging-mode, FUSE was always used +with threads. + +Currently, using FUSE with threads corrupts data reads, once mounted. Then now +multi-threading is decoupled from debugging-mode, and by default set to no threads. + +To enable threads back when mounting GDFS, just set the `GD_NOTHREADS` environment +variable to "0" (1 by default). + + Troubleshooting Steps ===================== diff --git a/gdrivefs/resources/scripts/gdfs b/gdrivefs/resources/scripts/gdfs index a16fb6d..fbcde36 100755 --- a/gdrivefs/resources/scripts/gdfs +++ b/gdrivefs/resources/scripts/gdfs @@ -55,7 +55,7 @@ def _main(): auth_storage_filepath=auth_storage_filepath, mountpoint=args.mountpoint, debug=gdrivefs.config.IS_DEBUG, - nothreads=gdrivefs.config.IS_DEBUG, + nothreads=gdrivefs.config.NO_THREADS, option_string=option_string) if __name__ == '__main__': diff --git a/gdrivefs/resources/scripts/gdfstool b/gdrivefs/resources/scripts/gdfstool index 9722bbc..135bed5 100755 --- a/gdrivefs/resources/scripts/gdfstool +++ b/gdrivefs/resources/scripts/gdfstool @@ -74,7 +74,7 @@ def _handle_mountpoint(args): auth_storage_filepath=args.auth_storage_file, mountpoint=args.mountpoint, debug=gdrivefs.config.IS_DEBUG, - nothreads=gdrivefs.config.IS_DEBUG, + nothreads=gdrivefs.config.NO_THREADS, option_string=option_string) def _parser_auth(subparsers):