Closed jmo-staked closed 5 months ago
Haven't found a way around this yet, I'm reluctant to just force the exit code to be 0
since then we'd start missing any real errors...
2023-08-20 16:03:29,577 - producer - INFO - Sending KeyboardInterrupt signal.
2023-08-20 16:03:29,577 - consumer0 - WARNING - Exit signal received. Terminating...
2023-08-20 16:03:29,577 - producer - INFO - Error at payment producer. Please consult the verbose logs! Exit code: 0
2023-08-20 16:03:31,357 - MainThread - INFO - Interrupted.
2023-08-20 16:03:31,357 - MainThread - INFO - TRD is shutting down...
2023-08-20 16:03:31,357 - MainThread - INFO - --------------------------------------------------------
2023-08-20 16:03:31,358 - MainThread - INFO - Sensitive operations are in progress!
2023-08-20 16:03:31,358 - MainThread - INFO - Please wait while the application is being shut down!
2023-08-20 16:03:31,358 - MainThread - INFO - --------------------------------------------------------
2023-08-20 16:03:31,358 - MainThread - INFO - Lock file removed!
2023-08-20 16:03:31,359 - MainThread - INFO - Shutdown due to error! Exit code: 1
Would using this option possibly get me past that KeyboardInterrupt
signal firing from within the code?
-s --background_service
Marker to indicate that TRD is running in daemon mode. When not given it indicates that TRD is in interactive mode.
hey @jmo-staked thanks for opening the ticket and looking into this! I believe #679 fixes it while still catching actual errors, it would be super helpful if you could try the branch before we merge & release.
In kubernetes you can use the docker tag below to test this PR: https://github.com/tezos-reward-distributor-organization/tezos-reward-distributor/pkgs/container/tezos-reward-distributor/121042222?tag=graceful_exit_onetime
Describe the bug New exit code handling added in this pr appear to make TRD always exit with
1
, ie: failure.Environment
Scenario 1: payments have already been made
notice the
producer
thread has the exit code 0 (success), and no errors are logged in either the primary or verbose logs. But it appears this bit of code always sends aKeyboardInterrupt
signal, and that signal always causes the app to exit with an error even when no error is present:https://github.com/tezos-reward-distributor-organization/tezos-reward-distributor/blob/277cbb2c3f49e9b6d9d7951c97a138793279e613/src/pay/payment_producer.py#L141-L157
https://github.com/tezos-reward-distributor-organization/tezos-reward-distributor/blob/dd3378b40833b6a7bf66e926fea45cb714f88cec/src/util/process_life_cycle.py#L229-L231
Scenario 2: Payments haven't yet been made
Again we see the
producer
thread exits with a 0 (success) signal, but TRD still says "error". No errors appear in the regular or verbose logs. All payments go out as expected. TRD exits with a1
(failure), so k8s tries to restart it to run again which is not necessary since it actually succeeded.This log line specifically is super confusing: it's an
INFO
level log, but says there is anError
, and the exit code is0 (success)