* fix: the public share configuration and fixed graceful shutdown
* fix: [OCISDEV-1433] remove GRPC_MAX_CONNECTION_AGE
The setting closed healthy grpc connections on a timer so that clients would redo
their DNS lookup. It never helped against the failure it was reached for - a
connection whose peer stopped answering - because the age limit is enforced by
the server, the grace period was left at infinity so a request already in flight
was never ended, and any value without a unit suffix silently disabled it again.
Detecting a peer that stops answering is now the job of the grpc clients, which
ping the peer while a request is in flight. The servers here got the matching
enforcement policy so they accept those pings; the client side arrives with the
next reva bump.
* fix: Added the new variable OCDAV_DISABLE_PROPFIND_PUBLIC_LINK_RESOLUTION that disable the resolution of public link shares when answering PROPFIND requests.
* chore: bump reva
* fix: The keepalive added to grpc clinet
* chore: bump reva
* build(deps): bump go 1.26.8, grpc-go dependency
---------
(cherry picked from commit e86eb4d210)
For the 9.0 branch, the reva dependency was pointed at reva's main-branch
merge of PR #748 (commit 373f9509a, pseudo-version
v2.0.0-20261005091647-373f9509a363) instead of the 8.2-targeted
e0beaa380005, since the 8.2 merge predates the VaultMode/UploadSessionFilter.Orphaned
APIs already present on the 9.0 reva lineage.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
# Conflicts:
# changelog/unreleased/security-bump-grpc.md
# go.mod
# go.sum
# vendor/google.golang.org/grpc/server.go
# vendor/google.golang.org/grpc/stream.go
# vendor/google.golang.org/grpc/version.go
# vendor/modules.txt
52 lines
2.7 KiB
Go
52 lines
2.7 KiB
Go
package grpc
|
|
|
|
import (
|
|
"time"
|
|
|
|
"google.golang.org/grpc/keepalive"
|
|
)
|
|
|
|
// GetClientKeepaliveParams turns the configured GRPCClientKeepaliveTime/-Timeout into grpc
|
|
// keepalive client parameters for the go-micro based clients built in this package. Once they are
|
|
// set, a peer that stops answering on an established connection can be told apart from one that is
|
|
// merely slow: grpc pings it while an rpc is in flight and fails the requests on that connection
|
|
// when no answer arrives within the timeout, instead of waiting for as long as the caller allows.
|
|
//
|
|
// Keepalive is strictly opt-in and driven by the keepalive time alone. Without a positive time this
|
|
// returns the zero ClientParameters, which NewClient reads as "add no keepalive dial option at
|
|
// all", so grpc's own behavior applies and no pings are sent - a deployment that configured nothing
|
|
// behaves exactly as it did before this package started setting keepalive params. A positive time
|
|
// with no usable timeout gets a working default instead, so detection cannot be left half
|
|
// configured.
|
|
//
|
|
// Values are taken as configured; nothing is salvaged or second-guessed. A malformed value - '20'
|
|
// without a unit suffix, say - is dropped by ocis-pkg/config/envdecode before it reaches this
|
|
// function and therefore reads as "not configured" here. reva's pool.GetClientKeepaliveParams
|
|
// (https://github.com/owncloud/reva/blob/master/pkg/rgrpc/todo/pool/keepalive.go) parses the same
|
|
// two env vars itself for the CS3 clients and applies the same rules, so both sets of clients
|
|
// behave identically for every input. grpc also raises any time below '10s' to '10s' on its own.
|
|
func GetClientKeepaliveParams(grpcClientKeepaliveTime, grpcClientKeepaliveTimeout time.Duration) keepalive.ClientParameters {
|
|
// used when a keepalive time is configured but the timeout is not usable, so that a half
|
|
// configured setup still gives up on a dead peer rather than sitting out grpc's longer
|
|
// stock timeout of 20s
|
|
const _defaultKeepaliveTimeout = 10 * time.Second
|
|
|
|
if grpcClientKeepaliveTime <= 0 {
|
|
// not configured: the zero value tells NewClient to skip the keepalive dial option, so
|
|
// grpc's own behavior applies and no pings are sent
|
|
return keepalive.ClientParameters{}
|
|
}
|
|
if grpcClientKeepaliveTimeout <= 0 {
|
|
// a time without a usable timeout: fall back to a working default
|
|
grpcClientKeepaliveTimeout = _defaultKeepaliveTimeout
|
|
}
|
|
|
|
return keepalive.ClientParameters{
|
|
Time: grpcClientKeepaliveTime,
|
|
Timeout: grpcClientKeepaliveTimeout,
|
|
// no pings on connections that have no rpc in flight: an idle connection has nothing
|
|
// to rescue, and staying quiet keeps us clear of any server side ping enforcement
|
|
PermitWithoutStream: false,
|
|
}
|
|
}
|