-
Notifications
You must be signed in to change notification settings - Fork 184
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
The goroutines leak in a single binary ocis
#10577
Comments
Do we know if the amount of goroutines in |
AFAICT we are sometimes creating a new go micro client on the fly, eg. in // ListStorageSpacesWithFilters List Storage Spaces using filters
func (g Graph) ListStorageSpacesWithFilters(ctx context.Context, filters []*storageprovider.ListStorageSpacesRequest_Filter, unrestricted bool) (*storageprovider.ListStorageSpacesResponse, error) {
gatewayClient, err := g.gatewaySelector.Next()
if err != nil {
return nil, err
}
grpcClient, err := grpc.NewClient(append(grpc.GetClientOptions(g.config.GRPCClientTLS), grpc.WithTraceProvider(g.traceProvider))...)
if err != nil {
return nil, err
}
s := settingssvc.NewPermissionService("com.owncloud.api.settings", grpcClient)
_, err = s.GetPermissionByID(ctx, &settingssvc.GetPermissionByIDRequest{
PermissionId: settingsServiceExt.ListSpacesPermission(0).Id,
})
//... The problem is that the actual RPC call under the hood uses a selector. And all go micro selectors wrap the registry with a cache registry. That will start a noew watcher. Increasing the number of go routinges by one. On every requests that instantiates a now go micro client. So, for calls to reva we need te make sure not to create a reva gateway client on service startup. 🤪 |
one occurrence fixed with #10583 |
Keeping it open, could be an issue in more places. |
@butonic That is awesome! The number of goroutines is stable and memory usage is low |
Describe the bug
A single binary
ocis
setup has high memory usage and the goroutines leak after long-running under the loading.Steps to reproduce
make test-acceptance-api \\nTEST_SERVER_URL=https://localhost:9200 \\nTEST_WITH_GRAPH_API=true \\nTEST_OCIS=true \\nBEHAT_FEATURE=tests/acceptance/features/apiSpacesShares/shareUploadTUS
curl 'http://localhost:9114/debug/pprof/goroutine' > goroutine-running.out
curl 'http://localhost:9114/debug/pprof/goroutine?debug=2' > goroutine-running.log
curl 'http://localhost:9114/debug/pprof/goroutine' > goroutine-running.out
curl 'http://localhost:9114/debug/pprof/goroutine?debug=2' > goroutine-running.log
Expected behavior
The number of goroutines should go down after the load goes down.
Actual behavior
The number of goroutines is growing during the test and should go down after the test stops. But we can see that thousands of goroutines are blocked and never go away. Most of them are
google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run
andgithub.com/owncloud/ocis/v2/ocis-pkg/natsjsregistry.(*Watcher).Next
. It leads to the goroutie and memory leak.The amount of time goroutines were blocked, reaching the approximate execution time of the
ocis
binary.The locks are related to the
go-micro/registry cache
andocis-pkg/natsjsregistry Watcher
.goroutine-out.zip
Setup
Please describe how you started the server and provide a list of relevant environment variables or configuration files.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: