https://bz.apache.org/bugzilla/show_bug.cgi?id=69219
Bug ID: 69219
Summary: mod_heartmonitor is unable to listen on Windows
because WinSock cannot bind to a multicast address
Product: Apache httpd-2
Version: 2.4.62
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: mod_heartmonitor
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Trying to set up mod_heartmonitor as documented (HeartbeatListen 239.0.0.1)
invariably resulted in a failure to bind the listen socket on Windows 7, 10 and
11. Error message example:
> [Wed Jul 24 20:39:11.751863 2024] [heartmonitor:crit] [pid 26532:tid 388] (OS
> 10049)The requested address is not valid in its context. : AH02071: Failed
> to bind on socket.
> [Wed Jul 24 20:39:11.751863 2024] [heartmonitor:crit] [pid 26532:tid 388] (OS
> 10049)The requested address is not valid in its context. : AH02090: Unable
> to listen for connections!
Investigation on GitHub turned up this bit of code in mod_heartmonitor.c:
> static apr_status_t hm_listen(hm_ctx_t *ctx)
> {
...
> rv = apr_socket_bind(ctx->sock, ctx->mcast_addr);
> if (rv) {
> ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ctx->s, APLOGNO(02071)
> "Failed to bind on socket.");
> return rv;
> }
>
> rv = apr_mcast_join(ctx->sock, ctx->mcast_addr, NULL, NULL);
...
(see
https://github.com/apache/httpd/blob/400d4e121fecf60f3450a2ef7d5ccf1c992530cb/modules/cluster/mod_heartmonitor.c#L104)
`ctx->mcast_addr` is the multicast address provided via the `HeartbeatListen`
Parameter in the configuration file. It is a known Windows limitation that
sockets cannot be bound to multicast addresses, only to a local unicast address
or IN_ADDR_ANY (i.e. all local interfaces/addresses).
The same address is used for the multicast group join operation, so it isn't
even possible to specify a unicast address in `HeartbeatListen` instead of a
multicast address as a workaround, because in that case the group join
operation will fail. In either case the function will exit with an error.
Possible ways out of the quandary might be binding to IN_ADDR_ANY, or to make
it possible to specify the address to be bound via an optional parameter that
defaults to the multicast address.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]