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

Add parameters to daemons’ stop() function #6075

Closed
dchristidis opened this issue Feb 8, 2023 · 3 comments
Closed

Add parameters to daemons’ stop() function #6075

dchristidis opened this issue Feb 8, 2023 · 3 comments

Comments

@dchristidis
Copy link
Contributor

Description

Per the documentation, the signal handler is expected to have two parameters. Their absence may cause a somewhat-benign unhandled exception.

Traceback (most recent call last):
  File "/usr/local/bin/rucio-conveyor-preparer", line 26, in main
  File "/usr/lib64/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
    thr.join(timeout=3.14)
  File "/usr/local/bin/rucio-conveyor-preparer", line 37, in <module>
    run(once=args.run_once, threads=args.threads, sleep_time=args.sleep_time, bulk=args.bulk)
  File "/usr/lib64/python3.6/threading.py", line 1060, in join
    elif lock.acquire(block, timeout):
TypeError: stop() takes 0 positional arguments but 2 were given
    self._wait_for_tstate_lock(timeout=max(timeout, 0))
  File "/usr/local/lib/python3.6/site-packages/rucio/daemons/conveyor/preparer.py", line 70, in run
    main(args=parser.parse_args())

Steps to reproduce

The above-provided traceback was noticed on the ATLAS instance. It is unknown whether it is always reproducible when shutting down daemons.

Rucio Version

No response

Additional Information

No response

@shalearkane
Copy link
Contributor

Hey, if this issue is not assigned to anyone, can I work on this?

@shalearkane
Copy link
Contributor

I failed to reproduce the issue. I followed the instructions here and I ran the run_daemons command in the dev-rucio-1 container. I tried to terminate the command using ^C multiple times however I was unable to reproduce it. Could it be because in the ATLAS instance, it is using a different kill signal?

@dchristidis
Copy link
Contributor Author

^C sends a SIGINT, not a SIGTERM. Here’s a minimal example demonstrating the issue.

$ cat foo.py
#!/usr/bin/env python3

import signal
import time

def stop():
    print('stop')

if __name__ == '__main__':
    signal.signal(signal.SIGTERM, stop)
    try:
        while True:
            time.sleep(60)
    except KeyboardInterrupt:
        stop()
$ python3 foo.py 
^Cstop
$ python3 foo.py &
[1] 168059
$ kill 168059
Traceback (most recent call last):
  File "/var/home/dchristidis/foo.py", line 13, in <module>
    time.sleep(60)
TypeError: stop() takes 0 positional arguments but 2 were given

shalearkane added a commit to shalearkane/rucio that referenced this issue Feb 16, 2023
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Mar 11, 2023
Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Mar 22, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.
Fixes rucio#6075

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Mar 22, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.
Fixes rucio#6075

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Mar 22, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.
Fixes rucio#6075

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Apr 22, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.
Fixes rucio#6075

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Apr 22, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.
Fixes rucio#6075

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue May 29, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.

Fixes rucio#6075

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Jun 27, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.

Fixes rucio#6075

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
shalearkane added a commit to shalearkane/rucio that referenced this issue Jun 27, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
@bari12 bari12 closed this as completed in eec6dbc Jul 3, 2023
@bari12 bari12 added this to the 1.31.6 milestone Jul 3, 2023
bari12 pushed a commit that referenced this issue Jul 3, 2023
The stop() functions used by daemons to gracefully stop had missing
parameters `signum` and `frame`. These parameters are passed
when the daemon receives SIGTERM signal. Since we have no use
for the parameter as of now, we have set them to `None` by default.
Also type-hints are added to the parameters and to the return type.

Signed-off-by: Soumik Dutta <shalearkane@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants