Re: (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted

Yann Ylavic <[email protected]>
Newsgroups gmane.comp.apache.devel
Message-ID <CAKQ1sVMkBUKBHqaoNwuu-vFqnhLe6-DUvrCChMH=ERtei-ccyg@mail.gmail.com>
On Wed, Feb 12, 2025 at 12:07 PM Yann Ylavic <[email protected]> wrote:
>
> On Wed, Feb 12, 2025 at 11:16 AM jean-frederic clere <[email protected]> wrote:
> >
> > According to my tests for some reasons ap_proxy_release_connection() now
> > does an apr_pool_clear() and was doing a connection_cleanup() before 2.4.58.
>
> What does your ProxyPass/ProxyPassMatch look like?
> AFAICT connection_cleanup() closes the connection by clearing its pool
> only if !worker->s->is_address_reusable ([1]), meaning disablereuse=on
> or enablereuse=off was set ([2]), or the ProxyPassMatch contains a
> $-substitution in the hostname[:port] part of the URL ([3]).
>
> [1] https://github.com/apache/httpd/blob/2.4.63/modules/proxy/proxy_util.c#L1657-L1661
> [2] https://github.com/apache/httpd/blob/2.4.63/modules/proxy/proxy_util.c#L2270-L2273
> [3] https://github.com/apache/httpd/blob/2.4.63/modules/proxy/proxy_util.c#L1989-L2034

Oh, and there is also this ProxyPassMatch case ([4]) where we force
disablereuse for compatibility with < 2.4.47 which never reused
connections.
So if there is a $-substitution *anywhere* in the worker URL then
connection reuse is disabled by default, but it can still be enabled
explicitly with enablereuse=on.
However it seems that [4] will cause worker->s->is_address_reusable =
0 in [3] (i.e. disable DNS reuse altogether) which is not really
expected, and would explain why the pool is cleared in
connection_cleanup(). Though whether the pool is cleared
(!is_address_reusable) or the connection only is closed (disablereuse)
shouldn't make a difference for your issue, in both cases the socket
gets closed for each request..

[4] https://github.com/apache/httpd/blob/2.4.63/modules/proxy/proxy_util.c#L2140-L2159

>
> But it seems that mod_proxy_cluster is creating and initializing its
> own proxy workers, and I don't know which games it plays on its own
> with worker->s->disablereuse or worker->s->is_address_reusable or
> worker->s->is_address_reusable.
>
>
> Regards;
> Yann.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.