huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
237 stars 79 forks source link

A Redis CONNECTION_BROKEN error is thrown while running yarn hot #6723

Open mfacar opened 5 months ago

mfacar commented 5 months ago

Describe the bug

After running yarn hot for some time the application crashes with the message 'Redis connection in broken state: connection timeout exceeded.'

To Reproduce One of the cases to reproduce the error is:

  1. Run the application with run hot in a development environment
  2. Create an entity with a main document.
  3. Continue using the application for several minutes
  4. See the error in the server terminal

Expected behavior The application should not crash if there are no external services configured, by removing the parts that try to load Redis when external services are not set. Redis has to be specified in the documentation when the external services are used.

Additional context One of the possible culprits could be ocrRoutes, who instantiates an ocrManager, which in turn creates a new TaskManager that calls Redis.createClient(redisUrl)

RafaPolit commented 4 months ago

This mostly will affect self hosted instances, as we DO have REDIS on all our production servers. Still, it would be great to have this solved. We could also simply add REDIS as a dependency?

mfacar commented 4 months ago

This mostly will affect self hosted instances, as we DO have REDIS on all our production servers. Still, it would be great to have this solved. We could also simply add REDIS as a dependency?

I think so, adding Redis as a dependency for sure will be faster. Anyway, the alternative to prevent a selfhosting having an unused service, is calling Redis.createClient(redisUrl) conditionally only when at least one external service has been configured.