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

Signal handling in consumers fails with executionTimeLimit option #440

Open
lifinsky opened this issue Feb 7, 2025 · 4 comments
Open

Signal handling in consumers fails with executionTimeLimit option #440

lifinsky opened this issue Feb 7, 2025 · 4 comments

Comments

@lifinsky
Copy link
Contributor

lifinsky commented Feb 7, 2025

Ecotone version(s) affected: latest

Description
When using the executionTimeLimit option in Ecotone consumers, the framework does not properly handle termination signals (e.g., SIGTERM, SIGQUIT). As a result, consumers are not gracefully shutting down when a termination signal is received. This behavior is unexpected and causes issues in containerized environments where consumers need to handle shutdown signals correctly.

How to reproduce

  1. Create a consumer with the command: php bin/console ecotone:run internal --executionTimeLimit 3600000.

  2. Start the consumer process.

  3. Send a SIGTERM (kill -TERM <pid>) or stop the container if running in Docker.

  4. Observe that the process does not handle the signal as expected and does not shut down gracefully.

@lifinsky
Copy link
Contributor Author

lifinsky commented Feb 7, 2025

@dgafka Without this option (executionTimeLimit), everything works correctly. It might be worth checking with other options as well.

@lifinsky
Copy link
Contributor Author

lifinsky commented Feb 7, 2025

InterceptedConsumerRunner:

  • Ecotone\Messaging\Endpoint\Interceptor\LimitMemoryUsageInterceptor
  • Ecotone\Messaging\Endpoint\Interceptor\SignalInterceptor
  • Ecotone\Messaging\Endpoint\Interceptor\TimeLimitInterceptor
  • Ecotone\Messaging\Endpoint\Interceptor\ConnectionExceptionRetryInterceptor

@lifinsky
Copy link
Contributor Author

lifinsky commented Feb 7, 2025

@dgafka With TimeLimitInterceptor, the InterceptedConsumer::shouldBeRunning() method is called only once.

@lifinsky
Copy link
Contributor Author

lifinsky commented Feb 7, 2025

@dgafka With the given example of the consumer startup parameter value, PollToGatewayTaskExecutor simply waits for a message to appear. As a result, if there are no messages in the consumer, execution never reaches it. Therefore, a different parameter is needed to define the execution time limit for TimeLimitInterceptor.

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

1 participant