Open socialglass opened 6 years ago
Do you have thos problem with other management commands? Does it relate to #37?
Yes now this problem is with all management commands - show, run, add, remove. As for #37, the issue was only for the run command, which I got around at that time by doing the os.kill() as I mentioned above. It doesn't work anymore.
Any ideas?
Does the runtime reach you os.kill
?
I never saw this behavior. Can you debug it, print some traces? I'm unable to reproduce it.
while run django-crontab command: add show it will not auto exit I have to PRESS : CTRL+C
^CException ignored in: <module 'threading' from '/usr/lib64/python3.6/threading.py'>
Traceback (most recent call last):
File "/usr/lib64/python3.6/threading.py", line 1294, in _shutdown
t.join()
File "/usr/lib64/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/usr/lib64/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
and When it run in background, it remain runing
ps aux|grep django-cronjobs
prod 16351 0.0 0.0 113128 1204 ? Ss 10:30 0:00 /bin/sh -c /home/prod/.py36/bin/python /home/prod/work/www/wwwdp/manage.py crontab run 8088ab3df8b20e2220fd2fb2b84a631d > /home/prod/jd_orders_out.log # django-cronjobs for wwwdp
prod 16582 0.0 0.0 113128 1204 ? Ss 10:40 0:00 /bin/sh -c /home/prod/.py36/bin/python /home/prod/work/www/wwwdp/manage.py crontab run 8088ab3df8b20e2220fd2fb2b84a631d > /home/prod/jd_orders_out.log # django-cronjobs for wwwdp
prod 16957 0.0 0.0 113128 1204 ? Ss 10:50 0:00 /bin/sh -c /home/prod/.py36/bin/python /home/prod/work/www/wwwdp/manage.py crontab run 8088ab3df8b20e2220fd2fb2b84a631d > /home/prod/jd_orders_out.log # django-cronjobs for wwwdp
prod 17157 0.0 0.0 113128 1204 ? Ss 11:00 0:00 /bin/sh -c /home/prod/.py36/bin/python3 /home/prod/work/www/wwwdp/manage.py crontab run 8088ab3df8b20e2220fd2fb2b84a631d > /home/prod/jd_orders_out.log # django-cronjobs for wwwdp
How to fix this problem ?
this problem cause my server run out memory, can not ssh ,have to force to reboot ☹️
@makelove I've got a same problem, and find a way.
# settings.py
CRONTAB_COMMAND_PREFIX = '/bin/bash -c "'
CRONTAB_COMMAND_SUFFIX = '"'
this will wrap your python execute command with double quote.
I don't know why exactly but works well on my ubuntu 20.04 server. (It was not shown on my MacBook, another Ubuntu 20.04. weird)
I just guess /bin/sh -c
processed only next word, not whole command.
No it was not. Not working now 😢
@makelove I've got a same problem, and find a way.
# settings.py CRONTAB_COMMAND_PREFIX = '/bin/bash -c "' CRONTAB_COMMAND_SUFFIX = '"'
this will wrap your python execute command with double quote.
I don't know why exactly but works well on my ubuntu 20.04 server. (It was not shown on my MacBook, another Ubuntu 20.04. weird) I just guess
/bin/sh -c
processed only next word, not whole command.
Environment & Versions
All the django-crontab commands that run and spawn a UNIX process, none of the process seems to be exiting after the command is done. They just lie around doing nothing but taking up memory. This includes add, run, show & remove commands.
I tried a small hack in the run command, where in the class Commands (crontab.py), I put this piece of code in the handle() method -
But this doesn't seem to make any difference.
Any ideas?