<p dir="auto">Hi guys!</p>
<p dir="auto">Hope you can explain us some strange behavior that we are already solved in our ugly way.</p>
<p dir="auto">We had some periodic tasks that used default queue <code class="notranslate">celery</code>. We have changed <code class="notranslate">CELERY_DEFAULT_QUEUE</code> to non-default. We using following configuration: Django + Celery + Redis. We using <code class="notranslate">celerybeat-schedule</code> file by default and it's wasn't ever cleaned. Also we didn't clear Redis after changing that variable.<br>
So we faced with that error and researched that our Redis raised up to limits of <code class="notranslate">used_memory</code> and our previous default queue <code class="notranslate">celery</code> was about 500Mb. So it's looks like it contains only periodic tasks and queue always growing up and never consumed by workers.</p>
<p dir="auto">So our dirty solution: we manually cleaned  <code class="notranslate">celery</code> queue from Redis and deleted one <code class="notranslate">celery\x06\x16\x06\x16celery</code> value from <code class="notranslate">_kombu.binding.celery</code> set in Redis. So it's looks like fixed now.</p>
<p dir="auto">Could you please explain or give us any feedback about the reasons and any kind of solution about this issue.</p>
<p dir="auto">Kind regards,<br>
Alexander</p>
<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate"></code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">I am using the celery add_periodic_task function to create two periodic tasks which take an argument on function call, when I call the function the first time it's working perfectly fine (example: printing something every 10 sec ) on the second function call the value has been updated to second and the first function call is not at all working.</p>
<p dir="auto">Question: How can I keep my first set of periodic task keep running with the addition of a second set<br>
Please find below code :<br>
<strong>create_app.py :</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from celery import Celery
from celery.schedules import crontab
from flask import Flask
from celery import Celery
from datetime import timedelta

app_c = Flask(__name__)
app_c.config['CELERY_BACKEND'] = &quot;mongodb://127.0.0.1:27017/mycelery&quot;
app_c.config['CELERY_BROKER_URL'] = &quot;mongodb://127.0.0.1:27017/mycelery&quot;
app_c.config['timezone'] = 'UTC'


def make_celery(app_c):
    celery = Celery(app_c.import_name, backend=app_c.config['CELERY_BACKEND'],
                    broker=app_c.config['CELERY_BROKER_URL'])
    celery.conf.update(app_c.config)
    TaskBase = celery.Task

    class ContextTask(TaskBase):
        abstract = True
        def __call__(self, *args, **kwargs):
            with app_c.app_context():
                return TaskBase.__call__(self, *args, **kwargs)
    celery.Task = ContextTask
    return celery

celery_app_c = make_celery(app_c) "><pre class="notranslate"><code class="notranslate">from celery import Celery
from celery.schedules import crontab
from flask import Flask
from celery import Celery
from datetime import timedelta

app_c = Flask(__name__)
app_c.config['CELERY_BACKEND'] = "mongodb://127.0.0.1:27017/mycelery"
app_c.config['CELERY_BROKER_URL'] = "mongodb://127.0.0.1:27017/mycelery"
app_c.config['timezone'] = 'UTC'


def make_celery(app_c):
    celery = Celery(app_c.import_name, backend=app_c.config['CELERY_BACKEND'],
                    broker=app_c.config['CELERY_BROKER_URL'])
    celery.conf.update(app_c.config)
    TaskBase = celery.Task

    class ContextTask(TaskBase):
        abstract = True
        def __call__(self, *args, **kwargs):
            with app_c.app_context():
                return TaskBase.__call__(self, *args, **kwargs)
    celery.Task = ContextTask
    return celery

celery_app_c = make_celery(app_c) 
</code></pre></div>
<p dir="auto"><strong>add_periodic.py :</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from flask import Flask
from celery import Celery
from datetime import timedelta
from tasks import poll, send
from create_app import celery_app_c
import time

print(celery_app_c)
def add_task(credential):
    print(&quot;in add task&quot;)
    celery_app_c.add_periodic_task(10.0,poll.s(credential),name='poll')
    celery_app_c.add_periodic_task(20.0,send.s(credential),name='send')
   




add_task('hello')
time.sleep(20)
add_task('world')"><pre class="notranslate"><code class="notranslate">from flask import Flask
from celery import Celery
from datetime import timedelta
from tasks import poll, send
from create_app import celery_app_c
import time

print(celery_app_c)
def add_task(credential):
    print("in add task")
    celery_app_c.add_periodic_task(10.0,poll.s(credential),name='poll')
    celery_app_c.add_periodic_task(20.0,send.s(credential),name='send')
   




add_task('hello')
time.sleep(20)
add_task('world')
</code></pre></div>
<p dir="auto"><strong>tasks.py:</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import time
from celery import Celery
from celery.utils.log import get_task_logger
from create_app import celery_app_c


@celery_app_c.task(name='poll')
def poll(arg):
    content_poll(arg)
    uri_poll(arg)

@celery_app_c.task(name='send')
def send(arg):
    graylog_send(arg)


def content_poll(arg):
    print(&quot;polling contens ....&quot;,arg)

def uri_poll(arg):
    print(&quot;polling uri .....&quot;,arg)

def graylog_send(arg):
    print(&quot;sending to gl ....... &quot;,arg)
"><pre class="notranslate"><code class="notranslate">import time
from celery import Celery
from celery.utils.log import get_task_logger
from create_app import celery_app_c


@celery_app_c.task(name='poll')
def poll(arg):
    content_poll(arg)
    uri_poll(arg)

@celery_app_c.task(name='send')
def send(arg):
    graylog_send(arg)


def content_poll(arg):
    print("polling contens ....",arg)

def uri_poll(arg):
    print("polling uri .....",arg)

def graylog_send(arg):
    print("sending to gl ....... ",arg)

</code></pre></div>
<p dir="auto">running the following code with : <strong>celery -A add_periodic.celery_app_c worker -B --loglevel=INFO</strong></p>
<p dir="auto">Note: I need to keep running the periodic task with both set of argument passed<br>
Please let me know what I am missing here</p>