[MXS-2597] MaxScale doesn't handle errors from microhttpd Created: 2019-07-11 Updated: 2020-01-08 Resolved: 2019-07-20 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | REST-API |
| Affects Version/s: | 2.3.9 |
| Fix Version/s: | 2.2.22, 2.3.10, 2.4.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
MaxScale uses microhttpd to implement the admin interface/REST API: https://github.com/mariadb-corporation/MaxScale/blob/maxscale-2.3.9/server/core/admin.cc#L400 microhttpd allows an application to handle errors by setting an error handler by calling the MHD_set_panic_func function:
https://www.gnu.org/software/libmicrohttpd/manual/html_node/microhttpd_002dinit.html MaxScale doesn't seem to currently do this, so microhttpd error messages are lost. This can make problems with the admin interface more difficult to debug. |
| Comments |
| Comment by markus makela [ 2019-07-15 ] | |
|
Any suggestions on how to reproduce this? | |
| Comment by Geoff Montee (Inactive) [ 2019-07-15 ] | |
|
Hi markus makela, I noticed that microhttpd errors were not being printed when a MaxScale instance was not able to bind to the admin port during startup because another process was already using the port. In this case, I would have expected some kind of error message from microhttpd, but the MaxScale log only showed this:
So if you want to reproduce this, then you could try setting admin_port to a port that MaxScale won't be able to bind to during startup. | |
| Comment by markus makela [ 2019-07-15 ] | |
|
Thanks, that should be enough to allow me to reproduce and fix it. | |
| Comment by markus makela [ 2019-07-16 ] | |
|
Adding the handler doesn't seem to help with the problem as it isn't a panic situation for the daemon. | |
| Comment by markus makela [ 2019-07-16 ] | |
|
Seems that MHD_USE_DEBUG must be passed in the flags to actually produce error messages for the custom logger installed with MHD_OPTION_EXTERNAL_LOGGER. |