linagora / james-project

Mirror of Apache James Project
Apache License 2.0
70 stars 63 forks source link

Fix Guice binding error - RedisRateLimiterModule #5180

Closed vttranlina closed 1 month ago

vttranlina commented 2 months ago

James can not start when running rate-limiter-redis docker-compose: https://github.com/apache/james-project/blob/master/server/mailet/rate-limiter-redis/docker-compose.yml

Error

03:32:17.943 [INFO ] o.a.j.u.GuiceGenericLoader - Enabling injects contained in org.apache.james.rate.limiter.redis.RedisRateLimiterModule
2024-05-07T03:32:17.961261846Z 03:32:17.954 [ERROR] o.a.j.GuiceJamesServer - Fatal error while starting James
2024-05-07T03:32:17.961282565Z com.google.inject.ProvisionException: Unable to provision, see the following errors:
2024-05-07T03:32:17.961285240Z 
2024-05-07T03:32:17.961287504Z 1) [Guice/BindingAlreadySet]: Set<HealthCheck> was bound multiple times.
2024-05-07T03:32:17.961290069Z 
2024-05-07T03:32:17.961292093Z Bound at:
2024-05-07T03:32:17.961294147Z 1  : IsStartedProbeModule.configure(IsStartedProbeModule.java:42)
2024-05-07T03:32:17.961296531Z       \_ installed by: Modules$OverrideModule -> Modules$CombinedModule -> Modules$CombinedModule -> Modules$CombinedModule -> Modules$CombinedModule -> Modules$CombinedModule -> IsStartedProbeModule -> RealMultibinder
2024-05-07T03:32:17.961299597Z 2  : RedisRateLimiterModule.configure(RedisRateLimiter.scala:50)
2024-05-07T03:32:17.961301641Z       \_ installed by: Modules$CombinedModule -> RedisRateLimiterModule -> RealMultibinder
2024-05-07T03:32:17.961303765Z 

Investigate and fix it

chibenwa commented 2 months ago

This one is pretty fondamental: in a child injector you cannot define elements already present in the parent. THis means this needs to be manually added into the additional health check configuration.

vttranlina commented 2 months ago

https://github.com/apache/james-project/pull/2239