Django worker not handling replies correctly with daphne
Creating title for this question was tricky, so please forgive.
I am trying to setup SSO with MicroSoft and Django.
Found a promising plugin to handle this, but having some issues I think may be related to django / daphne more than the plugin itself.
The plugin is designed to handle the callback from MS SSO, and there a django view that handles the response.
Well, this is not working as expected.
The question however is about the behavior of what I am seeing in the logs while troubleshooting.
I can see the callback come in:
worker logs:
2018-11-23 17:23:54,920 - DEBUG - worker - Dispatching message on http.request to channels.handler.ViewConsumer
Bad Request: /microsoft/auth-callback/
daphne logs
2018-11-23 17:23:54,920 INFO "127.0.0.1" - - [23/Nov/2018:17:26:28 +0000] "POST /microsoft/auth-callback/ HTTP/1.1" 400 665 "https://login.microsoftonline.com/common/reprocess?ctx=****&sessionid=*******" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0"
However, this is where it dies. The reply is supposed to have a payload containing the session state.
However, while watching the django worker log, I restarted the django worker.
While shutting down the workers, I see this appear in the logs:
2018-11-23 17:30:26,746 - INFO - worker - Shutdown signal received while idle, terminating immediately
{'state': '****', 'session_state': '***'}
This is coming from a print statement in the views.py that is supposed to handle the reply. This is the value that my views.py is supposed the be handling!
What I can't tell is if the view.py functions is not being called until the worker is terminated, or if the worker is having trouble handling this and just dumping some sort of cache when I terminate it. Any ideas?
django channels daphne
add a comment |
Creating title for this question was tricky, so please forgive.
I am trying to setup SSO with MicroSoft and Django.
Found a promising plugin to handle this, but having some issues I think may be related to django / daphne more than the plugin itself.
The plugin is designed to handle the callback from MS SSO, and there a django view that handles the response.
Well, this is not working as expected.
The question however is about the behavior of what I am seeing in the logs while troubleshooting.
I can see the callback come in:
worker logs:
2018-11-23 17:23:54,920 - DEBUG - worker - Dispatching message on http.request to channels.handler.ViewConsumer
Bad Request: /microsoft/auth-callback/
daphne logs
2018-11-23 17:23:54,920 INFO "127.0.0.1" - - [23/Nov/2018:17:26:28 +0000] "POST /microsoft/auth-callback/ HTTP/1.1" 400 665 "https://login.microsoftonline.com/common/reprocess?ctx=****&sessionid=*******" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0"
However, this is where it dies. The reply is supposed to have a payload containing the session state.
However, while watching the django worker log, I restarted the django worker.
While shutting down the workers, I see this appear in the logs:
2018-11-23 17:30:26,746 - INFO - worker - Shutdown signal received while idle, terminating immediately
{'state': '****', 'session_state': '***'}
This is coming from a print statement in the views.py that is supposed to handle the reply. This is the value that my views.py is supposed the be handling!
What I can't tell is if the view.py functions is not being called until the worker is terminated, or if the worker is having trouble handling this and just dumping some sort of cache when I terminate it. Any ideas?
django channels daphne
add a comment |
Creating title for this question was tricky, so please forgive.
I am trying to setup SSO with MicroSoft and Django.
Found a promising plugin to handle this, but having some issues I think may be related to django / daphne more than the plugin itself.
The plugin is designed to handle the callback from MS SSO, and there a django view that handles the response.
Well, this is not working as expected.
The question however is about the behavior of what I am seeing in the logs while troubleshooting.
I can see the callback come in:
worker logs:
2018-11-23 17:23:54,920 - DEBUG - worker - Dispatching message on http.request to channels.handler.ViewConsumer
Bad Request: /microsoft/auth-callback/
daphne logs
2018-11-23 17:23:54,920 INFO "127.0.0.1" - - [23/Nov/2018:17:26:28 +0000] "POST /microsoft/auth-callback/ HTTP/1.1" 400 665 "https://login.microsoftonline.com/common/reprocess?ctx=****&sessionid=*******" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0"
However, this is where it dies. The reply is supposed to have a payload containing the session state.
However, while watching the django worker log, I restarted the django worker.
While shutting down the workers, I see this appear in the logs:
2018-11-23 17:30:26,746 - INFO - worker - Shutdown signal received while idle, terminating immediately
{'state': '****', 'session_state': '***'}
This is coming from a print statement in the views.py that is supposed to handle the reply. This is the value that my views.py is supposed the be handling!
What I can't tell is if the view.py functions is not being called until the worker is terminated, or if the worker is having trouble handling this and just dumping some sort of cache when I terminate it. Any ideas?
django channels daphne
Creating title for this question was tricky, so please forgive.
I am trying to setup SSO with MicroSoft and Django.
Found a promising plugin to handle this, but having some issues I think may be related to django / daphne more than the plugin itself.
The plugin is designed to handle the callback from MS SSO, and there a django view that handles the response.
Well, this is not working as expected.
The question however is about the behavior of what I am seeing in the logs while troubleshooting.
I can see the callback come in:
worker logs:
2018-11-23 17:23:54,920 - DEBUG - worker - Dispatching message on http.request to channels.handler.ViewConsumer
Bad Request: /microsoft/auth-callback/
daphne logs
2018-11-23 17:23:54,920 INFO "127.0.0.1" - - [23/Nov/2018:17:26:28 +0000] "POST /microsoft/auth-callback/ HTTP/1.1" 400 665 "https://login.microsoftonline.com/common/reprocess?ctx=****&sessionid=*******" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0"
However, this is where it dies. The reply is supposed to have a payload containing the session state.
However, while watching the django worker log, I restarted the django worker.
While shutting down the workers, I see this appear in the logs:
2018-11-23 17:30:26,746 - INFO - worker - Shutdown signal received while idle, terminating immediately
{'state': '****', 'session_state': '***'}
This is coming from a print statement in the views.py that is supposed to handle the reply. This is the value that my views.py is supposed the be handling!
What I can't tell is if the view.py functions is not being called until the worker is terminated, or if the worker is having trouble handling this and just dumping some sort of cache when I terminate it. Any ideas?
django channels daphne
django channels daphne
asked Nov 23 '18 at 18:07
luskboluskbo
95316
95316
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451255%2fdjango-worker-not-handling-replies-correctly-with-daphne%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451255%2fdjango-worker-not-handling-replies-correctly-with-daphne%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown