Skip to content

Panic while traversing the service list #11377

@jvillafanez

Description

@jvillafanez

Describe the bug

Panic found in CI. This seems to be hidden in a recovery function around https://github.com/owncloud/ocis/blob/v7.1.3/ocis/pkg/runtime/service/service.go#L403-L412 and it showed up when that function was removed.

2025/05/28 09:47:05 [ociswrapper] ocis service port 9250 is no longer reachable
2025/05/28 09:47:05 [ociswrapper] Starting oCIS service...
fatal error: concurrent map iteration and map write

goroutine 215 [running]:

internal/runtime/maps.fatal({0x5247116?, 0x1?})
	/usr/local/go/src/runtime/panic.go:1053 +0x18
internal/runtime/maps.(*Iter).Next(0xc0027a51e0?)
	/usr/local/go/src/internal/runtime/maps/table.go:683 +0x9b
github.com/owncloud/ocis/v2/ocis/pkg/runtime/service.(*Service).List(0xc001a02420, {}, 0xc0043c0c40)
	/drone/src/ocis/pkg/runtime/service/service.go:474 +0x1bb
reflect.Value.call({0xc0019c24e0, 0xc00108ad40, 0x13}, {0x50d05f7, 0x4}, {0xc0027a5e90, 0x3, 0x3})
	/usr/local/go/src/reflect/value.go:581 +0xec5
reflect.Value.Call({0xc0019c24e0, 0xc00108ad40, 0x13}, {0xc002109e90, 0x3, 0x3})
	/usr/local/go/src/reflect/value.go:365 +0xb3
net/rpc.(*service).call(0xc001ced440, 0xc000fa4ff0, 0xc003986fb0, 0xc003986fc0, 0xc001e22200, 0xc003995da0, {0x49f9600, 0x91d4160, 0x199}, {0x4845ea0, ...}, ...)
	/usr/local/go/src/net/rpc/server.go:381 +0x308
created by net/rpc.(*Server).ServeCodec in goroutine 213
	/usr/local/go/src/net/rpc/server.go:478 +0x83a

goroutine 1 [runnable]:

internal/abi.(*StructField).Embedded(0x509a418?)
	/usr/local/go/src/internal/abi/type.go:560 +0x26
reflect.(*structType).Field(0x509a340, 0x5)
	/usr/local/go/src/reflect/type.go:1109 +0x135
reflect.(*rtype).Field(0x509a340, 0x5)
	/usr/local/go/src/reflect/type.go:745 +0x9b
github.com/mohae/deepcopy.copyRecursive({0x509a340, 0xc0019762c8, 0x199}, {0x509a340, 0xc001976dc8, 0x199})
	/drone/src/vendor/github.com/mohae/deepcopy/deepcopy.go:93 +0x99f
github.com/mohae/deepcopy.copyRecursive({0x4847ba0, 0xc0019762c8, 0x16}, {0x4847ba0, 0xc003a38148, 0x196})
	/drone/src/vendor/github.com/mohae/deepcopy/deepcopy.go:67 +0x5b6
github.com/mohae/deepcopy.Copy({0x4847ba0, 0xc0019762c8})
	/drone/src/vendor/github.com/mohae/deepcopy/deepcopy.go:39 +0xdd
github.com/owncloud/ocis/v2/ocis/pkg/runtime/service.scheduleServiceTokens(0xc001a02420, 0xc001e320c0)
	/drone/src/ocis/pkg/runtime/service/service.go:434 +0x176
github.com/owncloud/ocis/v2/ocis/pkg/runtime/service.Start({0x72b73d0, 0xc00198c880}, {0xc001b1f478, 0x1, 0x1})
	/drone/src/ocis/pkg/runtime/service/service.go:411 +0x7ba
github.com/owncloud/ocis/v2/ocis/pkg/runtime.(*Runtime).Start(0xc001b1f4c0, {0x72b73d0, 0xc00198c880})
	/drone/src/ocis/pkg/runtime/runtime.go:24 +0xf0
github.com/owncloud/ocis/v2/ocis/pkg/command.Server.func2(0xc00198ca80)
	/drone/src/ocis/pkg/command/server.go:24 +0x5d
github.com/urfave/cli/v2.(*Command).Run(0xc0019c6b00, 0xc00198ca80, {0xc0019e3b10, 0x1, 0x1})
	/drone/src/vendor/github.com/urfave/cli/v2/command.go:276 +0x1062
github.com/urfave/cli/v2.(*Command).Run(0xc001a05ce0, 0xc00198c9c0, {0xc00011e2c0, 0x2, 0x2})
	/drone/src/vendor/github.com/urfave/cli/v2/command.go:269 +0xfa5
github.com/urfave/cli/v2.(*App).RunContext(0xc000feea00, {0x72b73d0, 0xc00198c880}, {0xc00011e2c0, 0x2, 0x2})
	/drone/src/vendor/github.com/urfave/cli/v2/app.go:333 +0x2c5
github.com/owncloud/ocis/v2/ocis/pkg/command.Execute()
	/drone/src/ocis/pkg/command/root.go:32 +0x4a5
main.main()
	/drone/src/ocis/cmd/ocis/main.go:11 +0x46

Steps to reproduce

Expected behavior

The panic should never happen

Actual behavior

Panic happens although it's recovered and the code continues.

Setup

https://drone.owncloud.com/owncloud/ocis/45981/18/3

Details

OCIS_XXX=somevalue
OCIS_YYY=somevalue
PROXY_XXX=somevalue

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions