Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the InternalAuthenticationResult message from Scheduler #241

Open
hekaldama opened this issue Apr 20, 2016 · 3 comments
Open

Comments

@hekaldama
Copy link

When I try and authenticate with incomplete (no secret) or wrong credentials, my framework will continue to run without exiting. I have traced it back to code around:

https://github.com/mesos/mesos-go/blob/master/scheduler/scheduler.go#L461-L478

and was wondering if I can get that result somewhere so I can exit my code properly. I am currently using 4a7554a version of the scheduler.

Thanks and let me know if you need more data.

Output from logs if that is helpful:

I0420 09:54:40.521569    5841 main.go:224] Initializing the Example Scheduler...
I0420 09:54:40.532357    5841 standalone.go:46] creating new standalone detector for &MasterInfo{Id:*master,Ip:*167857965,Port:*5050,Pid:*master@mesos-master:5050,Hostname:*mesos-master,Version:nil,Address:nil,XXX_unrecognized:[],}
I0420 09:54:40.532455    5841 scheduler.go:324] Initializing mesos scheduler driver
I0420 09:54:40.532517    5841 scheduler.go:793] Starting the scheduler driver...
I0420 09:54:40.532558    5841 http_transporter.go:407] listening on 10.45.10.86 port 40420
I0420 09:54:40.532578    5841 scheduler.go:810] Mesos scheduler driver started with PID=scheduler(1)@10.45.10.86:40420
I0420 09:54:40.532586    5841 scheduler.go:822] starting master detector *detector.Standalone: {initial: &MasterInfo{Id:*master,Ip:*167857965,Port:*5050,Pid:*master@mesos-master:5050,Hostname:*mesos-master,Version:nil,Address:nil,XXX_unrecognized:[],}}
I0420 09:54:40.532655    5841 standalone.go:67] Detect()
I0420 09:54:40.532662    5841 standalone.go:69] spinning up asyc master detector poller
I0420 09:54:40.532669    5841 standalone.go:78] spawning asyc master detector listener
I0420 09:54:40.532676    5841 scheduler.go:824] master detector started
I0420 09:54:40.532681    5841 scheduler.go:1000] Scheduler driver running.  Waiting to be stopped.
I0420 09:54:40.532703    5841 standalone.go:80] waiting for polled to send updates
I0420 09:54:40.532744    5841 standalone.go:140] polling for master leadership at 'mesos-master:5050'
I0420 09:54:40.863757    5841 standalone.go:147] detected leadership change from '<nil>' to 'master@10.1.79.45:5050'
I0420 09:54:40.863824    5841 standalone.go:88] detected master change: &MasterInfo{Id:*master,Ip:*0,Port:*5050,Pid:*master@10.1.79.45:5050,Hostname:*10.1.79.45,Version:nil,Address:nil,XXX_unrecognized:[],}
I0420 09:54:40.863921    5841 messenger.go:382] Receiving message mesos.internal.InternalMasterChangeDetected from scheduler(1)@10.45.10.86:40420
I0420 09:54:40.863957    5841 scheduler.go:375] New master master@10.1.79.45:5050 detected
I0420 09:54:40.863979    5841 scheduler.go:839] authenticating with master master@10.1.79.45:5050
I0420 09:54:40.864114    5841 http_transporter.go:407] listening on 10.45.10.86 port 46101
I0420 09:54:40.864134    5841 messenger.go:188] Sending message mesos.internal.AuthenticateMessage to master@10.1.79.45:5050
I0420 09:54:40.864224    5841 http_transporter.go:193] Sending message to master@10.1.79.45:5050 via http
I0420 09:54:40.864268    5841 http_transporter.go:587] libproc target URL http://10.1.79.45:5050/master/mesos.internal.AuthenticateMessage
I0420 09:54:40.878714    5841 decoder.go:357] [1]bootstrap-state
I0420 09:54:40.878740    5841 decoder.go:237] [1]update-for-request: chunked true keep-alive true
I0420 09:54:40.878754    5841 decoder.go:241] [1]read-body-content
I0420 09:54:40.878761    5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.878770    5841 decoder.go:482] [1]read-chunk-state, bytes remaining: 10
I0420 09:54:40.878780    5841 decoder.go:496] [1]read-end-of-chunk-state
I0420 09:54:40.878786    5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.878792    5841 decoder.go:518] [1]read-end-of-chunk-stream-state
I0420 09:54:40.878798    5841 decoder.go:255] [1]generate-request
I0420 09:54:40.878813    5841 http_transporter.go:541] Receiving "POST" /sasl_authenticatee(2)/mesos.internal.AuthenticationMechanismsMessage from crammd5_authenticator_session(380)@10.1.79.45:5050, length 10
I0420 09:54:40.878840    5841 decoder.go:569] [1]await-request-state
I0420 09:54:40.878862    5841 messenger.go:382] Receiving message mesos.internal.AuthenticationMechanismsMessage from crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.878906    5841 authenticatee.go:260] Received SASL authentication mechanisms: [CRAM-MD5]
I0420 09:54:40.878922    5841 messenger.go:188] Sending message mesos.internal.AuthenticationStartMessage to crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.880774    5841 http_transporter.go:193] Sending message to crammd5_authenticator_session(380)@10.1.79.45:5050 via http
I0420 09:54:40.880806    5841 http_transporter.go:587] libproc target URL http://10.1.79.45:5050/crammd5_authenticator_session(380)/mesos.internal.AuthenticationStartMessage
I0420 09:54:40.886165    5841 decoder.go:610] [1]read-header-state
I0420 09:54:40.886197    5841 decoder.go:624] [1]request header User-Agent [libprocess/crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.886225    5841 decoder.go:624] [1]request header Libprocess-From [crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.886229    5841 decoder.go:624] [1]request header Connection [Keep-Alive]
I0420 09:54:40.886233    5841 decoder.go:624] [1]request header Host []
I0420 09:54:40.886237    5841 decoder.go:624] [1]request header Transfer-Encoding [chunked]
I0420 09:54:40.886243    5841 decoder.go:237] [1]update-for-request: chunked true keep-alive true
I0420 09:54:40.886249    5841 decoder.go:241] [1]read-body-content
I0420 09:54:40.886253    5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.886259    5841 decoder.go:482] [1]read-chunk-state, bytes remaining: 61
I0420 09:54:40.886269    5841 decoder.go:496] [1]read-end-of-chunk-state
I0420 09:54:40.886273    5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.886276    5841 decoder.go:518] [1]read-end-of-chunk-stream-state
I0420 09:54:40.886280    5841 decoder.go:255] [1]generate-request
I0420 09:54:40.886297    5841 http_transporter.go:541] Receiving "POST" /sasl_authenticatee(2)/mesos.internal.AuthenticationStepMessage from crammd5_authenticator_session(380)@10.1.79.45:5050, length 61
I0420 09:54:40.886315    5841 decoder.go:569] [1]await-request-state
I0420 09:54:40.886325    5841 messenger.go:382] Receiving message mesos.internal.AuthenticationStepMessage from crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.886356    5841 authenticatee.go:305] Received SASL authentication step
I0420 09:54:40.886370    5841 messenger.go:188] Sending message mesos.internal.AuthenticationStepMessage to crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.891750    5841 http_transporter.go:193] Sending message to crammd5_authenticator_session(380)@10.1.79.45:5050 via http
I0420 09:54:40.891792    5841 http_transporter.go:587] libproc target URL http://10.1.79.45:5050/crammd5_authenticator_session(380)/mesos.internal.AuthenticationStepMessage
I0420 09:54:40.896712    5841 decoder.go:610] [1]read-header-state
I0420 09:54:40.896732    5841 decoder.go:624] [1]request header Host []
I0420 09:54:40.896740    5841 decoder.go:624] [1]request header User-Agent [libprocess/crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.896744    5841 decoder.go:624] [1]request header Libprocess-From [crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.896748    5841 decoder.go:624] [1]request header Connection [Keep-Alive]
I0420 09:54:40.896754    5841 decoder.go:237] [1]update-for-request: chunked false keep-alive true
I0420 09:54:40.896760    5841 decoder.go:241] [1]read-body-content
I0420 09:54:40.896764    5841 decoder.go:540] [1]read-body-state: 0 bytes remaining
I0420 09:54:40.896768    5841 decoder.go:255] [1]generate-request
I0420 09:54:40.896785    5841 http_transporter.go:541] Receiving "POST" /sasl_authenticatee(2)/mesos.internal.AuthenticationFailedMessage from crammd5_authenticator_session(380)@10.1.79.45:5050, length 0
I0420 09:54:40.896809    5841 decoder.go:569] [1]await-request-state
I0420 09:54:40.896813    5841 messenger.go:382] Receiving message mesos.internal.AuthenticationFailedMessage from crammd5_authenticator_session(380)@10.1.79.45:5050
E0420 09:54:40.896854    5841 scheduler.go:422] Scheduler failed to authenticate: authentication failed
I0420 09:54:40.896857    5841 authenticatee.go:174] stopping authenticator transport: sasl_authenticatee(2)@10.45.10.86:46101
I0420 09:54:40.896891    5841 messenger.go:270] stopping messenger..
I0420 09:54:40.896907    5841 http_transporter.go:476] stopping HTTP transport
I0420 09:54:40.896909    5841 messenger.go:382] Receiving message mesos.internal.InternalAuthenticationResult from scheduler(1)@10.45.10.86:40420
I0420 09:54:40.896923    5841 messenger.go:376] exiting decodeLoop, transport shutting down
E0420 09:54:40.896939    5841 scheduler.go:472] master master@10.1.79.45:5050 refused authentication
I0420 09:54:40.896943    5841 http_transporter.go:450] HTTP server stopped because of shutdown
I0420 09:54:40.896942    5841 decoder.go:122] [1]cancel:true
I0420 09:54:40.903039    5841 messenger.go:317] Failed to send message mesos.internal.AuthenticationStepMessage: discarding message because transport is shutting down
E0420 09:54:40.903098    5841 messenger.go:330] failed to report error Failed to send message mesos.internal.AuthenticationStepMessage: discarding message because transport is shutting down due to: HTTP transport is terminated
I0420 09:54:45.896947    5841 decoder.go:334] [1]gracefully-terminate-state
I0420 09:54:45.896983    5841 decoder.go:122] [1]cancel:true
I0420 09:54:45.896998    5841 decoder.go:145] [1]run: terminating
I0420 09:55:10.823571    5841 standalone.go:161] no change to master leadership: 'master@10.1.79.45:5050'
I0420 09:55:40.838553    5841 standalone.go:161] no change to master leadership: 'master@10.1.79.45:5050'

The last line continues until I the program.

@jdef
Copy link
Contributor

jdef commented Apr 20, 2016

One (low-tech) way to do it might be to specify a NewMessenger (
https://github.com/mesos/mesos-go/blob/master/scheduler/scheduler.go#L105)
implementation that wraps the default behavior and intercepts routed
messages, trying to match on authentication failures. It's not ideal and
this issue is probably one that we should address with "1st class" API
support --- but it might meed your immediate need.

On Wed, Apr 20, 2016 at 1:00 PM, Adam Avilla notifications@github.com
wrote:

When I try and authenticate with incomplete (no secret) or wrong
credentials, my framework
https://github.com/yp-engineering/mesos-runonce will continue to run
without exiting. I have traced it back to code around:

https://github.com/mesos/mesos-go/blob/master/scheduler/scheduler.go#L461-L478

and was wondering if I can get that result somewhere so I can exit my
code properly. I am currently using 4a7554a
4a7554a
version of the scheduler.

Thanks and let me know if you need more data.

Output from logs if that is helpful:

I0420 09:54:40.521569 5841 main.go:224] Initializing the Example Scheduler...
I0420 09:54:40.532357 5841 standalone.go:46] creating new standalone detector for &MasterInfo{Id:_master,Ip:_167857965,Port:_5050,Pid:_master@mesos-master:5050,Hostname:_mesos-master,Version:nil,Address:nil,XXX_unrecognized:[],}
I0420 09:54:40.532455 5841 scheduler.go:324] Initializing mesos scheduler driver
I0420 09:54:40.532517 5841 scheduler.go:793] Starting the scheduler driver...
I0420 09:54:40.532558 5841 http_transporter.go:407] listening on 10.45.10.86 port 40420
I0420 09:54:40.532578 5841 scheduler.go:810] Mesos scheduler driver started with PID=scheduler(1)@10.45.10.86:40420
I0420 09:54:40.532586 5841 scheduler.go:822] starting master detector *detector.Standalone: {initial: &MasterInfo{Id:_master,Ip:_167857965,Port:_5050,Pid:_master@mesos-master:5050,Hostname:_mesos-master,Version:nil,Address:nil,XXX_unrecognized:[],}}
I0420 09:54:40.532655 5841 standalone.go:67] Detect()
I0420 09:54:40.532662 5841 standalone.go:69] spinning up asyc master detector poller
I0420 09:54:40.532669 5841 standalone.go:78] spawning asyc master detector listener
I0420 09:54:40.532676 5841 scheduler.go:824] master detector started
I0420 09:54:40.532681 5841 scheduler.go:1000] Scheduler driver running. Waiting to be stopped.
I0420 09:54:40.532703 5841 standalone.go:80] waiting for polled to send updates
I0420 09:54:40.532744 5841 standalone.go:140] polling for master leadership at 'mesos-master:5050'
I0420 09:54:40.863757 5841 standalone.go:147] detected leadership change from '' to 'master@10.1.79.45:5050'
I0420 09:54:40.863824 5841 standalone.go:88] detected master change: &MasterInfo{Id:_master,Ip:_0,Port:_5050,Pid:_master@10.1.79.45:5050,Hostname:*10.1.79.45,Version:nil,Address:nil,XXX_unrecognized:[],}
I0420 09:54:40.863921 5841 messenger.go:382] Receiving message mesos.internal.InternalMasterChangeDetected from scheduler(1)@10.45.10.86:40420
I0420 09:54:40.863957 5841 scheduler.go:375] New master master@10.1.79.45:5050 detected
I0420 09:54:40.863979 5841 scheduler.go:839] authenticating with master master@10.1.79.45:5050
I0420 09:54:40.864114 5841 http_transporter.go:407] listening on 10.45.10.86 port 46101
I0420 09:54:40.864134 5841 messenger.go:188] Sending message mesos.internal.AuthenticateMessage to master@10.1.79.45:5050
I0420 09:54:40.864224 5841 http_transporter.go:193] Sending message to master@10.1.79.45:5050 via http
I0420 09:54:40.864268 5841 http_transporter.go:587] libproc target URL http://10.1.79.45:5050/master/mesos.internal.AuthenticateMessage
I0420 http://10.1.79.45:5050/master/mesos.internal.AuthenticateMessageI0420 09:54:40.878714 5841 decoder.go:357] [1]bootstrap-state
I0420 09:54:40.878740 5841 decoder.go:237] [1]update-for-request: chunked true keep-alive true
I0420 09:54:40.878754 5841 decoder.go:241] [1]read-body-content
I0420 09:54:40.878761 5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.878770 5841 decoder.go:482] [1]read-chunk-state, bytes remaining: 10
I0420 09:54:40.878780 5841 decoder.go:496] [1]read-end-of-chunk-state
I0420 09:54:40.878786 5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.878792 5841 decoder.go:518] [1]read-end-of-chunk-stream-state
I0420 09:54:40.878798 5841 decoder.go:255] [1]generate-request
I0420 09:54:40.878813 5841 http_transporter.go:541] Receiving "POST" /sasl_authenticatee(2)/mesos.internal.AuthenticationMechanismsMessage from crammd5_authenticator_session(380)@10.1.79.45:5050, length 10
I0420 09:54:40.878840 5841 decoder.go:569] [1]await-request-state
I0420 09:54:40.878862 5841 messenger.go:382] Receiving message mesos.internal.AuthenticationMechanismsMessage from crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.878906 5841 authenticatee.go:260] Received SASL authentication mechanisms: [CRAM-MD5]
I0420 09:54:40.878922 5841 messenger.go:188] Sending message mesos.internal.AuthenticationStartMessage to crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.880774 5841 http_transporter.go:193] Sending message to crammd5_authenticator_session(380)@10.1.79.45:5050 via http
I0420 09:54:40.880806 5841 http_transporter.go:587] libproc target URL http://10.1.79.45:5050/crammd5_authenticator_session(380)/mesos.internal.AuthenticationStartMessage
I0420 http://10.1.79.45:5050/crammd5_authenticator_session(380)/mesos.internal.AuthenticationStartMessageI0420 09:54:40.886165 5841 decoder.go:610] [1]read-header-state
I0420 09:54:40.886197 5841 decoder.go:624] [1]request header User-Agent [libprocess/crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.886225 5841 decoder.go:624] [1]request header Libprocess-From [crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.886229 5841 decoder.go:624] [1]request header Connection [Keep-Alive]
I0420 09:54:40.886233 5841 decoder.go:624] [1]request header Host []
I0420 09:54:40.886237 5841 decoder.go:624] [1]request header Transfer-Encoding [chunked]
I0420 09:54:40.886243 5841 decoder.go:237] [1]update-for-request: chunked true keep-alive true
I0420 09:54:40.886249 5841 decoder.go:241] [1]read-body-content
I0420 09:54:40.886253 5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.886259 5841 decoder.go:482] [1]read-chunk-state, bytes remaining: 61
I0420 09:54:40.886269 5841 decoder.go:496] [1]read-end-of-chunk-state
I0420 09:54:40.886273 5841 decoder.go:457] [1]read-chunk-header-state
I0420 09:54:40.886276 5841 decoder.go:518] [1]read-end-of-chunk-stream-state
I0420 09:54:40.886280 5841 decoder.go:255] [1]generate-request
I0420 09:54:40.886297 5841 http_transporter.go:541] Receiving "POST" /sasl_authenticatee(2)/mesos.internal.AuthenticationStepMessage from crammd5_authenticator_session(380)@10.1.79.45:5050, length 61
I0420 09:54:40.886315 5841 decoder.go:569] [1]await-request-state
I0420 09:54:40.886325 5841 messenger.go:382] Receiving message mesos.internal.AuthenticationStepMessage from crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.886356 5841 authenticatee.go:305] Received SASL authentication step
I0420 09:54:40.886370 5841 messenger.go:188] Sending message mesos.internal.AuthenticationStepMessage to crammd5_authenticator_session(380)@10.1.79.45:5050
I0420 09:54:40.891750 5841 http_transporter.go:193] Sending message to crammd5_authenticator_session(380)@10.1.79.45:5050 via http
I0420 09:54:40.891792 5841 http_transporter.go:587] libproc target URL http://10.1.79.45:5050/crammd5_authenticator_session(380)/mesos.internal.AuthenticationStepMessage
I0420 http://10.1.79.45:5050/crammd5_authenticator_session(380)/mesos.internal.AuthenticationStepMessageI0420 09:54:40.896712 5841 decoder.go:610] [1]read-header-state
I0420 09:54:40.896732 5841 decoder.go:624] [1]request header Host []
I0420 09:54:40.896740 5841 decoder.go:624] [1]request header User-Agent [libprocess/crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.896744 5841 decoder.go:624] [1]request header Libprocess-From [crammd5_authenticator_session(380)@10.1.79.45:5050]
I0420 09:54:40.896748 5841 decoder.go:624] [1]request header Connection [Keep-Alive]
I0420 09:54:40.896754 5841 decoder.go:237] [1]update-for-request: chunked false keep-alive true
I0420 09:54:40.896760 5841 decoder.go:241] [1]read-body-content
I0420 09:54:40.896764 5841 decoder.go:540] [1]read-body-state: 0 bytes remaining
I0420 09:54:40.896768 5841 decoder.go:255] [1]generate-request
I0420 09:54:40.896785 5841 http_transporter.go:541] Receiving "POST" /sasl_authenticatee(2)/mesos.internal.AuthenticationFailedMessage from crammd5_authenticator_session(380)@10.1.79.45:5050, length 0
I0420 09:54:40.896809 5841 decoder.go:569] [1]await-request-state
I0420 09:54:40.896813 5841 messenger.go:382] Receiving message mesos.internal.AuthenticationFailedMessage from crammd5_authenticator_session(380)@10.1.79.45:5050
E0420 09:54:40.896854 5841 scheduler.go:422] Scheduler failed to authenticate: authentication failed
I0420 09:54:40.896857 5841 authenticatee.go:174] stopping authenticator transport: sasl_authenticatee(2)@10.45.10.86:46101
I0420 09:54:40.896891 5841 messenger.go:270] stopping messenger..
I0420 09:54:40.896907 5841 http_transporter.go:476] stopping HTTP transport
I0420 09:54:40.896909 5841 messenger.go:382] Receiving message mesos.internal.InternalAuthenticationResult from scheduler(1)@10.45.10.86:40420
I0420 09:54:40.896923 5841 messenger.go:376] exiting decodeLoop, transport shutting down
E0420 09:54:40.896939 5841 scheduler.go:472] master master@10.1.79.45:5050 refused authentication
I0420 09:54:40.896943 5841 http_transporter.go:450] HTTP server stopped because of shutdown
I0420 09:54:40.896942 5841 decoder.go:122] [1]cancel:true
I0420 09:54:40.903039 5841 messenger.go:317] Failed to send message mesos.internal.AuthenticationStepMessage: discarding message because transport is shutting down
E0420 09:54:40.903098 5841 messenger.go:330] failed to report error Failed to send message mesos.internal.AuthenticationStepMessage: discarding message because transport is shutting down due to: HTTP transport is terminated
I0420 09:54:45.896947 5841 decoder.go:334] [1]gracefully-terminate-state
I0420 09:54:45.896983 5841 decoder.go:122] [1]cancel:true
I0420 09:54:45.896998 5841 decoder.go:145] [1]run: terminating
I0420 09:55:10.823571 5841 standalone.go:161] no change to master leadership: 'master@10.1.79.45:5050'
I0420 09:55:40.838553 5841 standalone.go:161] no change to master leadership: 'master@10.1.79.45:5050'

The last line continues until I the program.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#241

@hekaldama
Copy link
Author

@jdef would you be interested in a PR that makes tryAuthentication abort() if it can't complete driver.authenticate()?

@jdef
Copy link
Contributor

jdef commented May 19, 2016

I think so. I think it might make sense for that behavior to be
configurable. How would you approach that?

On Mon, May 16, 2016 at 7:41 PM, Adam Avilla notifications@github.com
wrote:

@jdef https://github.com/jdef would you be interested in a PR that
makes tryAuthentication abort() if it can't complete driver.authenticate()
?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#241 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants