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

Core Dumped when authentication plugin returns MOSQ_ERR_AUTH few times #490

Closed
hasunperera opened this issue Jul 14, 2017 · 16 comments
Closed

Comments

@hasunperera
Copy link

This error popups after few seconds when authentication plugin is returning MOSQ_ERR_AUTH with mosquitto broker 1.4.14

loop.c:488: loop_handle_reads_writes: Assertion pollfds[context->pollfd_index].fd == context->sock' failed. (core dumped)`

@dhanushkad
Copy link

I also faced somewhat similar issue.

Im not a very "C" savvy person
Not sure if it breaks anything else, not having the assertion in the code worked for me to get rid of this problem. but still trying to understand if it is essential to the functionality.

"assert(pollfds[context->pollfd_index].fd == context->sock);"

@ralight Assert macro does an application abort on FALSE isnt it? Is it a good idea to have this Assert there since the broker would fail on unsuccessful assertion? Or is it an expected behavior.

@ralight
Copy link
Contributor

ralight commented Jul 16, 2017

I haven't yet managed to reproduce this, is there anything else you can tell me about the circumstances around when it happens?

@hasunperera
Copy link
Author

@dhanushkad I was able to do the same and it solved the issue. But not sure why assert(pollfds[context->pollfd_index].fd == context->sock); returns false.

@ralight I re-created this issue by returning MOSQ_ERR_AUTH for any username or password that is passed to the auth plugin to connect to the Mosquitto broker. After trying to connect to the broker few times from a web-socket client broker gets

loop.c:488: loop_handle_reads_writes: Assertionpollfds[context->pollfd_index].fd == context->sock' failed. (core dumped)`

My auth plugin method is as below,

int mosquitto_auth_unpwd_check(void *user_data, const char *username, const char *password) {
return MOSQ_ERR_AUTH;
}

Mosquitto broker configuration file -

allow_anonymous false
persistence true
persistence_file mosquitto.db

listener 1883
protocol mqtt

listener 1884
protocol websockets
http_dir /home/hasunp/mosquitto/http
certfile /home/hasunp/certificate.crt
cafile /home/hasunp/ca_bundle.crt
keyfile /home/hasunp/private.key
require_certificate false
tls_version tlsv1.2

listener 1885
protocol mqtt
certfile /home/hasunp/certificate.crt
cafile /home/hasunp/ca_bundle.crt
keyfile /home/hasunp/private.key
require_certificate false
tls_version tlsv1.2

auth_plugin /home/hasunp/mosquitto_auth_token.so
auth_opt_http_user_uri http:https://backend:9005/user/verify
auth_opt_http_acl_uri http:https://backend:9005/user/verify
auth_opt_bypass_acl true

log_dest file /home/hasunp/mosquitto/mosquitto.log

@ralight
Copy link
Contributor

ralight commented Jul 18, 2017

Do you know what version of libwebsockets you are using?

@hasunperera
Copy link
Author

I'm using libwebsockets-2.2.1 @ralight

ralight added a commit that referenced this issue Jul 26, 2017
@ralight
Copy link
Contributor

ralight commented Jul 26, 2017

I believe this is fixed in the commit referenced above. Would you be able to try out the fixes branch to see if it works for you?

@hasunperera
Copy link
Author

Thank you @ralight ... I'll try out and let you know soon.

@hasunperera
Copy link
Author

hasunperera commented Jul 27, 2017

It didn't fix the issue @ralight ..... I get the same error again after returning MOSQ_ERR_AUTH few times

loop.c:489: loop_handle_reads_writes: Assertion 'pollfds[context->pollfd_index].fd == context->sock' failed. Aborted (core dumped)

ralight added a commit that referenced this issue Jul 27, 2017
@ralight
Copy link
Contributor

ralight commented Jul 27, 2017

Could you try again with this new fix please?

@hasunperera
Copy link
Author

Thank you @ralight I'll try out now

@hasunperera
Copy link
Author

@ralight It seems to be working now.. 👍 I'll run it for few days and report you. Thank you so much

@hasunperera
Copy link
Author

@ralight Broker was running for few days now.. And it seems to be working fine now 👍

@kylebake
Copy link

So, I'm using the latest mosquitto (1.4.14) and libwebsockets-dev v1.7.1-1 and I'm getting this websockets core dump after a couple of failed authentications. Am I missing something? How did you get yours to work exactly @hasunperera?

@hasunperera
Copy link
Author

hasunperera commented Sep 28, 2017

@Tryforce Please build mosquitto from this bug fix with libwebsockets-2.2.1
#490

@iegomez
Copy link

iegomez commented Oct 24, 2017

Hi, I was having the same problem, building the latest libwebsockets (2.4) and then mosquitto (1.4.14) and mosquitto-auth-plug fixed it for me.

@PierreF
Copy link
Contributor

PierreF commented Jan 3, 2018

Closing as the issue seems fixed in latest version. Feel free to reopen if this bug is not fixed.

@PierreF PierreF closed this as completed Jan 3, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants