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

Provider crashing #189

Open
Patafix opened this issue Nov 29, 2024 · 3 comments
Open

Provider crashing #189

Patafix opened this issue Nov 29, 2024 · 3 comments

Comments

@Patafix
Copy link

Patafix commented Nov 29, 2024

The provider is in version 1.8.0

The container is crashing after some tome and restart :

The last error is :

2024-11-29T15:47:06.567258246Z {"level":"info","ts":"2024-11-29T15:47:06Z","logger":"provider-keycloak","msg":"Async update callback failed","trackerUID":"fde67c29-37d6-485f-945d-80ce1a90ce71","resourceName":"XXXXXi","gvk":"client.keycloak.crossplane.io/v1alpha1, Kind=ProtocolMapper","error":"cannot get resource /, Kind=/ after an async update: ProtocolMapper.client.keycloak.crossplane.io \"\" not found"}
2024-11-29T15:47:09.187762985Z panic: assignment to entry in nil map
2024-11-29T15:47:09.187795746Z 
2024-11-29T15:47:09.187799729Z goroutine 181562 [running]:
2024-11-29T15:47:09.187803949Z reflect.mapassign0(0x1f7f3e0, 0xc00481ce20?, 0xc003efcf30?, 0xc003efcf30)
2024-11-29T15:47:09.187806815Z  runtime/map.go:1370 +0x1d
2024-11-29T15:47:09.187809852Z reflect.mapassign(0xc004254240?, 0xc004295c30?, 0x8b8209?, 0xc004254240?)
2024-11-29T15:47:09.187812519Z  reflect/value.go:3877 +0x8d
2024-11-29T15:47:09.187815958Z github.com/modern-go/reflect2.(*UnsafeMapType).UnsafeSetIndex(...)
2024-11-29T15:47:09.187819942Z  github.com/modern-go/[email protected]/unsafe_map.go:76
2024-11-29T15:47:09.187840607Z github.com/json-iterator/go.(*mapDecoder).Decode(0xc004df1220, 0xc002797dd0, 0xc004254240)
2024-11-29T15:47:09.187843675Z  github.com/json-iterator/[email protected]/reflect_map.go:191 +0x325
2024-11-29T15:47:09.187847499Z github.com/json-iterator/go.(*structFieldDecoder).Decode(0xc00481cfe0, 0xc004295d28?, 0xc004254240)
2024-11-29T15:47:09.187850777Z  github.com/json-iterator/[email protected]/reflect_struct_decoder.go:1054 +0x50
2024-11-29T15:47:09.187853441Z github.com/json-iterator/go.(*eightFieldsStructDecoder).Decode(0xc0015fafc0, 0xc002797dc0, 0xc004254240)
2024-11-29T15:47:09.187860761Z  github.com/json-iterator/[email protected]/reflect_struct_decoder.go:897 +0x146
2024-11-29T15:47:09.187863782Z github.com/json-iterator/go.(*Iterator).ReadVal(0xc004254240, {0x1fba220, 0xc002797dc0})
2024-11-29T15:47:09.187867062Z  github.com/json-iterator/[email protected]/reflect.go:79 +0x14b
2024-11-29T15:47:09.187871072Z github.com/json-iterator/go.(*frozenConfig).Unmarshal(0xc00036e280, {0xc000e64160?, 0xc0049d2f00?, 0xc0049d2e10?}, {0x1fba220, 0xc002797dc0})
2024-11-29T15:47:09.187877035Z  github.com/json-iterator/[email protected]/config.go:348 +0x99
2024-11-29T15:47:09.187885507Z github.com/crossplane-contrib/provider-keycloak/apis/client/v1alpha1.(*ProtocolMapper).SetObservation(0xc002797b88, 0x225ad80?)
2024-11-29T15:47:09.187888563Z  github.com/crossplane-contrib/provider-keycloak/apis/client/v1alpha1/zz_protocolmapper_terraformed.go:43 +0x7e
2024-11-29T15:47:09.187915931Z github.com/crossplane/upjet/pkg/controller.(*terraformPluginSDKExternal).Update(0xc002dada40, {0x26b7db0, 0xc0032c2c40}, {0x26da4c0, 0xc002797b88})
2024-11-29T15:47:09.187931549Z  github.com/crossplane/[email protected]/pkg/controller/external_tfpluginsdk.go:699 +0x2c2
2024-11-29T15:47:09.187945829Z github.com/crossplane/upjet/pkg/controller.(*terraformPluginSDKAsyncExternal).Update.func1()
2024-11-29T15:47:09.187947801Z  github.com/crossplane/[email protected]/pkg/controller/external_async_tfpluginsdk.go:173 +0x145
2024-11-29T15:47:09.187949917Z created by github.com/crossplane/upjet/pkg/controller.(*terraformPluginSDKAsyncExternal).Update in goroutine 5380
2024-11-29T15:47:09.187954141Z  github.com/crossplane/[email protected]/pkg/controller/external_async_tfpluginsdk.go:169 +0x14c
@Patafix
Copy link
Author

Patafix commented Dec 2, 2024

After further investigation using debug mode, I discovered the issue was caused by the ProtocolMapper being reconciled infinitely.

The root cause is that if you don't specify all the fields in the config section, these fields are detected as differences, triggering constant reconciliation.

Additionally, there appears to be a minor memory leak during this process, eventually leading to an OOMKill of the container.

By updating my ProtocolMapper configuration as follows:


  "introspection.token.claim": "true",
  "userinfo.token.claim": "false"

the crash no longer occurs.

@Breee
Copy link
Collaborator

Breee commented Dec 6, 2024

I'll look into that, we might be able to mitigate that

@denniskniep
Copy link
Contributor

Same for oidc_identity_provider extra_config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants