Skip to content

Commit

Permalink
Ignore interrupts by default (#2034)
Browse files Browse the repository at this point in the history
* change default value of flag to true

* add troubleshooting guide

* update integration tests

* revert empty line

* fix unit tests

* review comment
  • Loading branch information
ashmeenkaur authored Jun 21, 2024
1 parent c81eddf commit fefd11a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cfg/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func BindFlags(flagSet *pflag.FlagSet) error {
return err
}

flagSet.BoolP("ignore-interrupts", "", false, "Instructs gcsfuse to ignore system interrupt signals (like SIGINT, triggered by Ctrl+C). This prevents those signals from immediately terminating gcsfuse inflight operations.")
flagSet.BoolP("ignore-interrupts", "", true, "Instructs gcsfuse to ignore system interrupt signals (like SIGINT, triggered by Ctrl+C). This prevents those signals from immediately terminating gcsfuse inflight operations. (default: true)")

err = viper.BindPFlag("file-system.ignore-interrupts", flagSet.Lookup("ignore-interrupts"))
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ func newApp() (app *cli.App) {
Usage: "Allow rename a directory containing fewer descendants than this limit.",
},

cli.BoolFlag{
cli.BoolTFlag{
Name: config.IgnoreInterruptsFlagName,
Usage: "Instructs gcsfuse to ignore system interrupt signals (like SIGINT, triggered by Ctrl+C). " +
"This prevents those signals from immediately terminating gcsfuse inflight operations.",
"This prevents those signals from immediately terminating gcsfuse inflight operations. (default: true)",
},

/////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ discusses potential solutions to the same.
| Cloud Storage FUSE get stuck when using it to concurrently work with a large number of opened files (reference issue [here](https://github.com/GoogleCloudPlatform/gcsfuse/issues/1043)) | This happens when gcsfuse is mounted with http1 client (default) and the application using gcsfuse tries to keep more than value of `--max-conns-per-host` number of files opened. You can try (a) Passing a value higher than the number of files you want to keep open to `--max-conns-per-host` flag. (b) Adding some timeout for http client connections using `--http-client-timeout` flag. |
| permission denied error. | Please refer [here](https://cloud.google.com/storage/docs/gcsfuse-mount#authenticate_by_using_a_service_account) to know more about permissions.(e.g. **Issue**:mkdir: cannot create directory ‘gcs/test’: Permission denied. User can check specific errors by enabling logs with --debug_fuse and --debug_gcs flags. **Solution**: Provide roles/storage.objectAdmin role on the bucket.) <br/> |
| Bad gateway error while installing/upgrading GCSFuse:<br/> `Err: http://packages.cloud.google.com/apt gcsfuse-focal/main amd64 gcsfuse amd64 1.2.0`<br/>`502 Bad Gateway [IP: xxx.xxx.xx.xxx 80]` | This error is seen when the url used in /etc/apt/sources.list.d/gcsfuse.list file uses HTTP protocol instead of HTTPS protocol. Run the following commands to update /etc/apt/sources.list.d/gcsfuse.list file with the https:// url.<br/> <code>$ sudo rm /etc/apt/sources.list.d/gcsfuse.list</code> <br/> <code>$ export GCSFUSE_REPO=gcsfuse-$(lsb_release -c -s)</code> <br/> <code>$ echo "deb https://packages.cloud.google.com/apt $GCSFUSE_REPO main" &#124; sudo tee /etc/apt/sources.list.d/gcsfuse.list </code> |
| Repository changed 'Origin' and 'Label' error while running `apt-get update` command: <br/>`E: Repository 'http://packages.cloud.google.com/apt gcsfuse-focal InRelease' changed its 'Origin' value from 'gcsfuse-jessie' to 'namespaces/gcs-fuse-prod/repositories/gcsfuse-focal'`<br/>`E: Repository 'http://packages.cloud.google.com/apt gcsfuse-focal InRelease' changed its 'Label' value from 'gcsfuse-jessie' to 'namespaces/gcs-fuse-prod/repositories/gcsfuse-focal'`<br/>`N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details. ` | Use one of the following commands to upgrade to latest GCSFuse version<br/> `sudo apt-get update --allow-releaseinfo-change `<br/>OR<br/>`sudo apt update -y && sudo apt-get update` |
| Repository changed 'Origin' and 'Label' error while running `apt-get update` command: <br/>`E: Repository 'http://packages.cloud.google.com/apt gcsfuse-focal InRelease' changed its 'Origin' value from 'gcsfuse-jessie' to 'namespaces/gcs-fuse-prod/repositories/gcsfuse-focal'`<br/>`E: Repository 'http://packages.cloud.google.com/apt gcsfuse-focal InRelease' changed its 'Label' value from 'gcsfuse-jessie' to 'namespaces/gcs-fuse-prod/repositories/gcsfuse-focal'`<br/>`N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details. ` | Use one of the following commands to upgrade to latest GCSFuse version<br/> `sudo apt-get update --allow-releaseinfo-change `<br/>OR<br/>`sudo apt update -y && sudo apt-get update` |
| Unable to unmount or stop GCSFuse due to an error message like:`fusermount: failed to unmount: Device or resource busy` or `umount: /path/to/mountpoint: target is busy`.</br>This typically indicates active processes are using files or directories within the GCSFuse mount. | Find the process ID of GCSFuse:<br/>`BUCKET=<Enter your bucket name>`</br>` MOUNT_POINT=<Enter your mount point>`</br>`PID=$(ps -aux &#124; grep "gcsfuse.*$BUCKET.*$MOUNT_POINT" &#124; grep -v grep &#124; tr -s ' ' &#124; cut -d' ' -f2)`</br>Kill the GCSFuse process:</br>`sudo kill -SIGKILL "$PID"`</br>Unmount GCSFuse</br>`fusermount -u $"MOUNT_POINT"` |
4 changes: 4 additions & 0 deletions internal/config/mount_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
DefaultGrpcConnPoolSize = 1
DefaultAnonymousAccess = false
DefaultEnableHNS = false
DefaultIgnoreInterrupts = true

// ExperimentalMetadataPrefetchOnMountDisabled is the mode without metadata-prefetch.
ExperimentalMetadataPrefetchOnMountDisabled string = "disabled"
Expand Down Expand Up @@ -210,5 +211,8 @@ func NewMountConfig() *MountConfig {
mountConfig.ListConfig = ListConfig{
KernelListCacheTtlSeconds: DefaultKernelListCacheTtlSeconds,
}

mountConfig.FileSystemConfig.IgnoreInterrupts = DefaultIgnoreInterrupts

return mountConfig
}
4 changes: 2 additions & 2 deletions internal/config/yaml_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func validateDefaultConfig(t *testing.T, mountConfig *MountConfig) {
assert.Equal(t, 1, mountConfig.GCSConnection.GRPCConnPoolSize)
assert.False(t, mountConfig.GCSAuth.AnonymousAccess)
assert.False(t, bool(mountConfig.EnableHNS))
assert.False(t, mountConfig.FileSystemConfig.IgnoreInterrupts)
assert.True(t, mountConfig.FileSystemConfig.IgnoreInterrupts)
assert.False(t, mountConfig.FileSystemConfig.DisableParallelDirops)
assert.Equal(t, DefaultKernelListCacheTtlSeconds, mountConfig.KernelListCacheTtlSeconds)
}
Expand Down Expand Up @@ -271,7 +271,7 @@ func (t *YamlParserTest) TestReadConfigFile_FileSystemConfig_UnsetIgnoreInterrup

assert.NoError(t.T(), err)
assert.NotNil(t.T(), mountConfig)
assert.Equal(t.T(), false, mountConfig.FileSystemConfig.IgnoreInterrupts)
assert.True(t.T(), mountConfig.FileSystemConfig.IgnoreInterrupts)
}

func (t *YamlParserTest) TestReadConfigFile_GCSAuth_InvalidAnonymousAccessValue() {
Expand Down
4 changes: 2 additions & 2 deletions tools/config-gen/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
usage: >-
Instructs gcsfuse to ignore system interrupt signals (like SIGINT, triggered
by Ctrl+C). This prevents those signals from immediately terminating gcsfuse
inflight operations.
default: false
inflight operations. (default: true)
default: true

- flag-name: "disable-parallel-dirops"
config-path: "file-system.disable-parallel-dirops"
Expand Down
3 changes: 1 addition & 2 deletions tools/integration_tests/interrupt/interrupt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ func TestMain(m *testing.M) {

// Set up flags to run tests on.
mountConfig := config.MountConfig{
FileSystemConfig: config.FileSystemConfig{IgnoreInterrupts: true},
LogConfig: config.LogConfig{
Severity: config.TRACE,
LogRotateConfig: config.DefaultLogRotateConfig(),
},
}
flags := [][]string{{"--implicit-dirs=true", "--ignore-interrupts"},
flags := [][]string{{"--implicit-dirs=true"},
{"--config-file=" + setup.YAMLConfigFile(mountConfig, "config.yaml")}}

successCode := static_mounting.RunTests(flags, m)
Expand Down

0 comments on commit fefd11a

Please sign in to comment.