Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic on accessing an OCM share from EFSS #3971

Closed
mirekys opened this issue Jun 14, 2023 · 4 comments
Closed

Panic on accessing an OCM share from EFSS #3971

mirekys opened this issue Jun 14, 2023 · 4 comments
Labels
blocker bug Something isn't working

Comments

@mirekys
Copy link
Member

mirekys commented Jun 14, 2023

Reva version:

Docker image: cs3org/revad:v1.24.0
revad_sys_info{reva_build_date="2023-05-11T14:45:34+0000",reva_version="(Unknown)"}

Deployment: sciencemesh1-3.toml based

When accessing a local share from a remote EFSS using OCM, the following panic raises from the Reva nextcloud share driver:

IOP gateway logs

2023-06-14 08:11:54.147 INF home/reva/internal/http/interceptors/providerauthorizer/providerauthorizer.go:81 > skipping provider authorizer check for: /remote.php/dav/ocm/<share-token> pid=1 pkg=rhttp traceid=013c532f17fa93e913f86d5592222853
2023-06-14 08:11:54.148 DBG home/reva/pkg/rhttp/rhttp.go:305 > http routing: url= pid=1 pkg=rhttp
2023-06-14 08:11:54.148 DBG home/reva/internal/http/services/owncloud/ocdav/ocdav.go:210 > http routing head=remote.php pid=1 pkg=rhttp tail=/dav/ocm/<share-token> traceid=013c532f17fa93e913f86d5592222853
2023-06-14 08:11:54.148 DBG home/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/Authenticate pid=1 pkg=rgrpc traceid=0177798580ad355a5942884d170da9b6
2023-06-14 08:11:54.148 DBG home/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProviders pid=1 pkg=rgrpc traceid=bb448d2095decb266296e935f3733015
2023-06-14 08:11:54.148 DBG home/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="14/Jun/2023:08:11:54 +0000" from=tcp://<remote-ip>:9231 pid=1 pkg=rgrpc start="14/Jun/2023:08:11:54 +0000" time_ns=95877 traceid=bb448d2095decb266296e935f3733015 uri=/cs3.auth.registry.v1beta1.RegistryAPI/GetAuthProviders user-agent=grpc-go/1.52.0
2023-06-14 08:11:54.149 DBG home/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.gateway.v1beta1.GatewayAPI/GetOCMShareByToken pid=1 pkg=rgrpc traceid=e31b2d0e5d1f5726e9a6ffe11478f146
2023-06-14 08:11:54.149 DBG home/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.sharing.ocm.v1beta1.OcmAPI/GetOCMShareByToken pid=1 pkg=rgrpc traceid=f6e83d49eae0028ffa9a9b81551a6222
goroutine 1829 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
	/usr/local/go/src/runtime/debug/stack.go:16 +0x19
github.com/cs3org/reva/internal/grpc/interceptors/recovery.recoveryFunc({0x2294838, 0xc004f05ce0}, {0x1836dc0, 0x2e8a0b0})
	/home/reva/internal/grpc/interceptors/recovery/recovery.go:47 +0x3a
github.com/grpc-ecosystem/go-grpc-middleware/recovery.recoverFrom({0x2294838?, 0xc004f05ce0?}, {0x1836dc0?, 0x2e8a0b0?}, 0x0?)
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/recovery/interceptors.go:61 +0x36
github.com/grpc-ecosystem/go-grpc-middleware/recovery.UnaryServerInterceptor.func1.1()
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/recovery/interceptors.go:29 +0x7b
panic({0x1836dc0, 0x2e8a0b0})
	/usr/local/go/src/runtime/panic.go:884 +0x213
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End.func1()
	/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.11.2/trace/span.go:383 +0x2a
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End(0xc00047af00, {0x0, 0x0, 0x2f3c120?})
	/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.11.2/trace/span.go:421 +0x9c9
panic({0x1836dc0, 0x2e8a0b0})
	/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/cs3org/reva/pkg/ocm/share/repository/nextcloud.getUsername(...)
	/home/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:410
github.com/cs3org/reva/pkg/ocm/share/repository/nextcloud.(*Manager).GetShare(0x2?, {0x2294838, 0xc004f05e90}, 0x0, 0x0?)
	/home/reva/pkg/ocm/share/repository/nextcloud/nextcloud.go:172 +0x63
github.com/cs3org/reva/internal/grpc/services/ocmshareprovider.(*service).GetOCMShareByToken(0xc00063c380, {0x2294838, 0xc004f05e90}, 0xc004f05c80)
	/home/reva/internal/grpc/services/ocmshareprovider/ocmshareprovider.go:393 +0xda
github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1._OcmAPI_GetOCMShareByToken_Handler.func1({0x2294838, 0xc004f05e90}, {0x19a52c0?, 0xc004f05c80})
	/go/pkg/mod/github.com/cs3org/go-cs3apis@v0.0.0-20230508132523-e0d062e63b3b/cs3/sharing/ocm/v1beta1/ocm_api.pb.go:1735 +0x78
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryServerInterceptor.func1({0x2294838, 0xc004f05ce0}, {0x19a52c0, 0xc004f05c80}, 0xc0055b6860, 0xc00565ced0)
	/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc@v0.37.0/interceptor.go:349 +0x528
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x2294838?, 0xc004f05ce0?}, {0x19a52c0?, 0xc004f05c80?})
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/cs3org/reva/internal/grpc/interceptors/auth.NewUnary.func1({0x2294838, 0xc004f05ce0}, {0x19a52c0, 0xc004f05c80}, 0xc0055b6860, 0xc0055b6880)
	/home/reva/internal/grpc/interceptors/auth/auth.go:116 +0x305
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x2294838?, 0xc004f05ce0?}, {0x19a52c0?, 0xc004f05c80?})
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/grpc-ecosystem/go-grpc-middleware/recovery.UnaryServerInterceptor.func1({0x2294838?, 0xc004f05ce0?}, {0x19a52c0?, 0xc004f05c80?}, 0xc0009cf2c0?, 0x4dd017?)
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/recovery/interceptors.go:33 +0xc4
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x2294838?, 0xc004f05ce0?}, {0x19a52c0?, 0xc004f05c80?})
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/cs3org/reva/internal/grpc/interceptors/log.NewUnary.func1({0x2294838, 0xc004f05ce0}, {0x19a52c0, 0xc004f05c80}, 0xc0055b6860, 0xc0055b68c0)
	/home/reva/internal/grpc/interceptors/log/log.go:39 +0x9a
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x2294838?, 0xc004f05ce0?}, {0x19a52c0?, 0xc004f05c80?})
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/cs3org/reva/internal/grpc/interceptors/useragent.NewUnary.func1({0x2294838, 0xc004f05ce0}, {0x19a52c0, 0xc004f05c80}, 0x0?, 0xc0055b68e0)
	/home/reva/internal/grpc/interceptors/useragent/useragent.go:38 +0xf4
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x2294838?, 0xc004f05ce0?}, {0x19a52c0?, 0xc004f05c80?})
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/cs3org/reva/internal/grpc/interceptors/token.NewUnary.func1({0x2294838, 0xc004f05ce0}, {0x19a52c0, 0xc004f05c80}, 0xc0054f64e0?, 0xc0055b6900)
	/home/reva/internal/grpc/interceptors/token/token.go:44 +0x16d
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x2294838?, 0xc004f05ce0?}, {0x19a52c0?, 0xc004f05c80?})
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/cs3org/reva/internal/grpc/interceptors/appctx.NewUnary.func1({0x2294838, 0xc004f05c50}, {0x19a52c0, 0xc004f05c80}, 0x18a15c0?, 0xc0055b6920)
	/home/reva/internal/grpc/interceptors/appctx/appctx.go:42 +0x5c6
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1.1.1({0x2294838?, 0xc004f05c50?}, {0x19a52c0?, 0xc004f05c80?})
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:25 +0x3a
github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func1({0x2294838, 0xc004f05c50}, {0x19a52c0, 0xc004f05c80}, 0xc000b50a50?, 0x1835bc0?)
	/go/pkg/mod/github.com/grpc-ecosystem/go-grpc-middleware@v1.3.0/chain.go:34 +0xbe
github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1._OcmAPI_GetOCMShareByToken_Handler({0x1a16940?, 0xc00063c380}, {0x2294838, 0xc004f05c50}, 0xc00069c380, 0xc000630360)
	/go/pkg/mod/github.com/cs3org/go-cs3apis@v0.0.0-20230508132523-e0d062e63b3b/cs3/sharing/ocm/v1beta1/ocm_api.pb.go:1737 +0x138
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0006761e0, {0x229f0a0, 0xc004419520}, 0xc0009639e0, 0xc000631770, 0x2e9d188, 0x0)
	/go/pkg/mod/google.golang.org/grpc@v1.52.0/server.go:1336 +0xd33
google.golang.org/grpc.(*Server).handleStream(0xc0006761e0, {0x229f0a0, 0xc004419520}, 0xc0009639e0, 0x0)
	/go/pkg/mod/google.golang.org/grpc@v1.52.0/server.go:1704 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	/go/pkg/mod/google.golang.org/grpc@v1.52.0/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/go/pkg/mod/google.golang.org/grpc@v1.52.0/server.go:963 +0x28a
2023-06-14 08:11:54.15 ERR home/reva/internal/grpc/interceptors/recovery/recovery.go:49 > runtime error: invalid memory address or nil pointer dereference; stack: goroutine 1829 [running]:

OCM Reva handler logs

2023-06-14 08:10:12.514 DBG home/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate pid=1 pkg=rgrpc traceid=840508d6c8ed5ec905a7e4b5f2fd95d7
2023-06-14 08:10:12.525 ERR home/reva/pkg/auth/manager/ocmshares/ocmshares.go:96 > error getting ocm share by token error="rpc error: code = Unknown desc = gateway: error calling GetOCMShareByToken: rpc error: code = Internal desc = runtime error: invalid memory address or nil pointer dereference" pid=1 pkg=rgrpc token=<share-token> traceid=840508d6c8ed5ec905a7e4b5f2fd95d7
2023-06-14 08:10:12.525 WRN home/reva/internal/grpc/services/authprovider/authprovider.go:170 > error authenticating user error="authsvc: error in Authenticate: rpc error: code = Unknown desc = gateway: error calling GetOCMShareByToken: rpc error: code = Internal desc = runtime error: invalid memory address or nil pointer dereference" pid=1 pkg=rgrpc traceid=840508d6c8ed5ec905a7e4b5f2fd95d7
2023-06-14 08:10:12.525 DBG home/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="14/Jun/2023:08:10:12 +0000" from=tcp://<internal-ip>:32930 pid=1 pkg=rgrpc start="14/Jun/2023:08:10:12 +0000" time_ns=10597889 traceid=840508d6c8ed5ec905a7e4b5f2fd95d7 uri=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate user-agent=grpc-go/1.52.0
2023-06-14 08:11:54.149 DBG home/reva/internal/grpc/interceptors/auth/auth.go:101 > skipping auth method=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate pid=1 pkg=rgrpc traceid=59b61e551c25ce736ed74954b92446d5
2023-06-14 08:11:54.15 ERR home/reva/pkg/auth/manager/ocmshares/ocmshares.go:96 > error getting ocm share by token error="rpc error: code = Unknown desc = gateway: error calling GetOCMShareByToken: rpc error: code = Internal desc = runtime error: invalid memory address or nil pointer dereference" pid=1 pkg=rgrpc token=<share-token>traceid=59b61e551c25ce736ed74954b92446d5
2023-06-14 08:11:54.151 WRN home/reva/internal/grpc/services/authprovider/authprovider.go:170 > error authenticating user error="authsvc: error in Authenticate: rpc error: code = Unknown desc = gateway: error calling GetOCMShareByToken: rpc error: code = Internal desc = runtime error: invalid memory address or nil pointer dereference" pid=1 pkg=rgrpc traceid=59b61e551c25ce736ed74954b92446d5
2023-06-14 08:11:54.151 DBG home/reva/internal/grpc/interceptors/log/log.go:66 > unary code=OK end="14/Jun/2023:08:11:54 +0000" from=tcp://<internal-ip>:32930 pid=1 pkg=rgrpc start="14/Jun/2023:08:11:54 +0000" time_ns=1773022 traceid=59b61e551c25ce736ed74954b92446d5 uri=/cs3.auth.provider.v1beta1.ProviderAPI/Authenticate user-agent=grpc-go/1.52.0
@mirekys mirekys added bug Something isn't working blocker labels Jun 14, 2023
@michielbdejong
Copy link
Contributor

michielbdejong commented Jun 14, 2023

I think this is because you're not running the sciencemesh-testing branch of revad, could that be?

Ah yes, you said you still run v1.24.0. So that's why you're seeing this error, then.

@michielbdejong
Copy link
Contributor

The two fixes you need are:

@michielbdejong
Copy link
Contributor

Sorry you ran into this!
Will close as a duplicate of pondersource/sciencemesh-php#208

@glpatcern
Copy link
Member

(In fact, the fix in #3971 is still good to have in, should we go back to passing the user instead of an hardcoded nobody)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants