{"action":"created","issue":{"url":"https://api.github.com/repos/andrewgodwin/channels/issues/141","repository_url":"https://api.github.com/repos/andrewgodwin/channels","labels_url":"https://api.github.com/repos/andrewgodwin/channels/issues/141/labels{/name}","comments_url":"https://api.github.com/repos/andrewgodwin/channels/issues/141/comments","events_url":"https://api.github.com/repos/andrewgodwin/channels/issues/141/events","html_url":"https://github.com/andrewgodwin/channels/issues/141","id":152060814,"number":141,"title":"UserWarning: Enforce ordering consumer reached retry limit in production","user":{"login":"sachinrekhi","id":192650,"avatar_url":"https://avatars.githubusercontent.com/u/192650?v=3","gravatar_id":"","url":"https://api.github.com/users/sachinrekhi","html_url":"https://github.com/sachinrekhi","followers_url":"https://api.github.com/users/sachinrekhi/followers","following_url":"https://api.github.com/users/sachinrekhi/following{/other_user}","gists_url":"https://api.github.com/users/sachinrekhi/gists{/gist_id}","starred_url":"https://api.github.com/users/sachinrekhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sachinrekhi/subscriptions","organizations_url":"https://api.github.com/users/sachinrekhi/orgs","repos_url":"https://api.github.com/users/sachinrekhi/repos","events_url":"https://api.github.com/users/sachinrekhi/events{/privacy}","received_events_url":"https://api.github.com/users/sachinrekhi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-05-01T00:28:17Z","updated_at":"2016-05-12T17:56:29Z","closed_at":"2016-05-12T17:56:28Z","body":"I'm unfortunately seeing the following error in production:\r\n\r\n```\r\nchannels/sessions.py:104: UserWarning: Enforce ordering consumer reached retry limit, message being dropped. Did you decorate all protocol consumers correctly?\r\n```\r\n\r\nAs I mentioned before, I believe I have correctly decorated all protocol consumers, as here is my consumer code:\r\n\r\n```\r\nfrom channels.sessions import enforce_ordering\r\nfrom channels.auth import channel_session_user_from_http, channel_session_user\r\n\r\nfrom notes.api.socket.router import SocketRouter\r\n\r\n@enforce_ordering\r\n@channel_session_user_from_http\r\ndef connect(message):\r\n    SocketRouter().connect(message.channel_session, message.reply_channel, message.user)\r\n\r\n@enforce_ordering\r\n@channel_session_user\r\ndef disconnect(message):\r\n    SocketRouter().disconnect(message.channel_session, message.reply_channel, message.user)\r\n\r\n@enforce_ordering\r\n@channel_session_user\r\ndef message(message):\r\n    SocketRouter().message(message.channel_session, message.reply_channel, message.user, message.content)\r\n```\r\n\r\nI'm sending socket messages to the server at a fairly slow rate now (one socket message sent every 500ms). I'm currently running 3 channel workers against Daphne. There are currently no other socket connections on the server, just the one user / socket connection. The server in general is pretty idle.\r\n\r\nMy best guess at what may be happening is that my server may in-fact be _too idle_. When a message comes in, one channel worker picks it up and then the next message comes in and the next channel worker tries to pick up, but since the first one is not done it raises ConsumeLater. But since it has nothing else to pick up other than the same task since there are no other users, it simply spins very quickly through it's retries. Is this possible? Are the channel workers running in a tight loop constantly picking up tasks and in this case raising ConsumerLater? Or is there some delay before it will pick up a subsequent task? Or maybe is there some mechanism by which they only pull subsequent tasks when another worker has finished it's task? If it's just in a tight loop, then it seems like this issue would happen whenever the rate of incoming messages exceeds the processing rate of the messages and there are more idle workers than socket connections to process.\r\n\r\nThe dropping of the message is unfortunately breaking my collaborative editing scenario since a message from the client is being dropped and not being processed. I'm planning on building re-send logic from the client as well as message ids so the server doesn't process the same message twice, but I was expecting this to be only used in exceptional cases (server connection died, poor latency, etc) not a mainline scenario like this.\r\n\r\nThoughts on how to resolve?"},"comment":{"url":"https://api.github.com/repos/andrewgodwin/channels/issues/comments/218835627","html_url":"https://github.com/andrewgodwin/channels/issues/141#issuecomment-218835627","issue_url":"https://api.github.com/repos/andrewgodwin/channels/issues/141","id":218835627,"user":{"login":"sachinrekhi","id":192650,"avatar_url":"https://avatars.githubusercontent.com/u/192650?v=3","gravatar_id":"","url":"https://api.github.com/users/sachinrekhi","html_url":"https://github.com/sachinrekhi","followers_url":"https://api.github.com/users/sachinrekhi/followers","following_url":"https://api.github.com/users/sachinrekhi/following{/other_user}","gists_url":"https://api.github.com/users/sachinrekhi/gists{/gist_id}","starred_url":"https://api.github.com/users/sachinrekhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sachinrekhi/subscriptions","organizations_url":"https://api.github.com/users/sachinrekhi/orgs","repos_url":"https://api.github.com/users/sachinrekhi/repos","events_url":"https://api.github.com/users/sachinrekhi/events{/privacy}","received_events_url":"https://api.github.com/users/sachinrekhi/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T17:56:28Z","updated_at":"2016-05-12T17:56:28Z","body":"The new approach addressing this issue is now merged, so will be available in the next release."}}