Skip to content

Commit c1d03b8

Browse files
committed
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.
1 parent 4ad74d9 commit c1d03b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wpool/mongoose_wpool_rdbms.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,14 @@ merge_stats_fun(send_max, V1, V2) ->
139139
merge_stats_fun(_, V1, V2) ->
140140
V1 + V2.
141141

142+
-spec inet_stats(inet:port_number() | undefined) -> [{inet:stat_option(), integer()}].
142143
inet_stats(Port) ->
143144
try
144145
{ok, Stats} = inet:getstat(Port, inet_stats()),
145146
Stats
146147
catch C:R:S ->
147148
?LOG_INFO(#{what => inet_stats_failed, class => C, reason => R, stacktrace => S}),
148-
empty_inet_stats_measurements()
149+
[]
149150
end.
150151

151152
inet_stats() ->

0 commit comments

Comments
 (0)