From c1d03b8dd95b0da1e72f66c296f1a33ddfede8e4 Mon Sep 17 00:00:00 2001 From: Gustaw Lippa Date: Mon, 16 Dec 2024 14:10:06 +0100 Subject: [PATCH] Fix probe_failed error Sometimes, mongoose_wpool_rdbms:inet_stats() may fail, for example when the socket is closing. This is why it's surrounded in a try...catch. The stats are processed with the merge_stats/1 function, and it expects them to be proplists, as returned from inet:getstat/2, not a map. --- src/wpool/mongoose_wpool_rdbms.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wpool/mongoose_wpool_rdbms.erl b/src/wpool/mongoose_wpool_rdbms.erl index 12ee2754670..4d8c2d2d332 100644 --- a/src/wpool/mongoose_wpool_rdbms.erl +++ b/src/wpool/mongoose_wpool_rdbms.erl @@ -139,13 +139,14 @@ merge_stats_fun(send_max, V1, V2) -> merge_stats_fun(_, V1, V2) -> V1 + V2. +-spec inet_stats(inet:port_number() | undefined) -> [{inet:stat_option(), integer()}]. inet_stats(Port) -> try {ok, Stats} = inet:getstat(Port, inet_stats()), Stats catch C:R:S -> ?LOG_INFO(#{what => inet_stats_failed, class => C, reason => R, stacktrace => S}), - empty_inet_stats_measurements() + [] end. inet_stats() ->