Issue 1:
Hi everyone,

I was using Celery 3.0.11 + Redis 2.6.2 as a broker. In my development environment (Mac OS X 10.8.2, Python 2.7.3, Django 1.4.3, 1 celery worker with concurrency = 4) I created a couple of simple tasks for my project (in tasks.py):

@task
def invoice_delete(invoice):
i = reload_instance(invoice)
if not i.deleted and i.amount_paid == 0:
i.delete()

@task
def expire_invoices():
invoices_to_expire = core.models.Invoice.objects.filter(
expires__lt=(now() + timedelta(minutes=1)),
deleted=False,
)
for i in invoices_to_expire:
invoice_delete.apply_async(args=[i], eta=i.expires)

and scheduled expire_invoices tasks to run every minute (in settings.py):

CELERYBEAT_SCHEDULE = {
'expire_invoices': {
'task': 'core.tasks.expire_invoices',
'schedule': crontab(),
}
}

it worked, and I pushed it into production - Amazon Linux, Celery 3.0.11 - 1 worker with concurency=10, Redis 2.6.2, Python 2.7.3, Django 1.4.3. Celery and Redis were running under Supervisord. In production I got a problem: my expire_invoices task was launched 3 times within every minute, instead of 1, so I got duplicated invoice.deleted events. I tried the following:

changed crontab() to timedelta(seconds=60) - did not helped, still launched 3 times within a minute. If I tried seconds=30, it was launched twice within 30 seconds interval;

upgraded celery to 3.0.15 - no effect;

purged broker storage (using FLUSHALL - very rude) and cleaning schedule file and restarting everything - no effect;

switched from celery beat schedule storage from a file to a database, via "-S djcelery.schedulers.DatabaseScheduler" option - no effect;

temporally switched broker to 'django://'. I know that it is not recommended for production, I just wanted to see what happens. And... it helped. My task was launching exactly once a minute, as needed. Finally I ended up with installation of RabbitMQ and switching broker url to it, works fine as well.

My supervisord configs in production - celery:

[program:%(project_name)s_celery]
command=%(project_env)s/bin/python manage.py celery worker -E --loglevel=INFO --concurrency=10
directory=%(project_app)s
user=%(project_user)s
numprocs=1
stdout_logfile=%(project_logs)s/supervisor_celery_stdout.log
stderr_logfile=%(project_logs)s/supervisor_celery_stderr.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
priority=998

...and celery beat:

[program:%(project_name)s_celery_beat]
command=%(project_env)s/bin/python manage.py celery beat --loglevel=INFO -s %(celerybeat_dir)s/schedule
directory=%(project_app)s
user=%(project_user)s
numprocs=1
stdout_logfile=%(project_logs)s/supervisor_celery_beat_stdout.log
stderr_logfile=%(project_logs)s/supervisor_celery_beat_stderr.log
autostart=true
autorestart=true
startsecs=10
priority=999

Issue 2:
Checklist

I have verified that the issue exists against the master branch of Celery.

This has already been asked to the discussion group first.

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

#5952

#2903

Possible Duplicates

None

Environment & Settings

Celery version: 4.4.1

Steps to Reproduce

Required Dependencies

Python Packages

pip freeze Output:

```
redis==3.4.1
billiard==3.6.3.0
celery==4.4.1
kombu==4.6.8
```

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

Celery just works

Actual Behavior

After upgrading Celery from 4.4.0 to 4.4.1 I suddenly see TypeError: __init__() got an unexpected keyword argument 'socket_keepalive'.

This seems to be caused by PR #5952, which adds this kwarg for Redis connections. However, not all Redis connection constructors take the same arguments (e.g. UnixDomainSocketConnection doesn't take socket_keepalive). This seems to be happened before as noted in issue #2903.

Everything works fine if I downgrade to 4.4.0 again.