You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2024/07/24 20:54:21 UTC

[Bug 69219] New: mod_heartmonitor is unable to listen on Windows because WinSock cannot bind to a multicast address

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: bugs@httpd.apache.org
          Reporter: KnightOwl@gmx.net
  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: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 69219] mod_heartmonitor is unable to listen on Windows because WinSock cannot bind to a multicast address

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69219

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Product|Apache httpd-test           |Apache httpd-2
           Severity|enhancement                 |normal
          Component|framework                   |mod_heartmonitor
            Version|unspecified                 |2.4.62
           Keywords|APIBug                      |
                 CC|josealfonzo58712@gmail.com  |
           Hardware|HP                          |All

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 69219] mod_heartmonitor is unable to listen on Windows because WinSock cannot bind to a multicast address

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69219

jose alfonzo <jo...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
           Priority|P2                          |P5
            Product|Apache httpd-2              |Apache httpd-test
           Hardware|PC                          |HP
           Severity|normal                      |enhancement
          Component|mod_heartmonitor            |framework
           Keywords|                            |APIBug
                 CC|                            |josealfonzo58712@gmail.com
            Version|2.4.62                      |unspecified

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org