diff options
author | Luke Bakken <luke@bakken.io> | 2021-12-31 14:38:29 -0800 |
---|---|---|
committer | Luke Bakken <luke@bakken.io> | 2022-01-03 11:33:36 -0800 |
commit | 7f0285834e9bea689e26cc283412b52ded2397dc (patch) | |
tree | 74f67d7c86457635bba1efe7644f7942619fc498 /deps/rabbitmq_tracing | |
parent | 0bd8d41b72e32435178520fd382f46e835f312fd (diff) | |
download | rabbitmq-server-git-7f0285834e9bea689e26cc283412b52ded2397dc.tar.gz |
Fix all uses of file:read_file/1lukebakken/fix-all-read-file
This is to address another memory leak on win32 reported here:
https://groups.google.com/g/rabbitmq-users/c/UE-wxXerJl8
"RabbitMQ constant memory increase (binary_alloc) in idle state"
The root cause is the Prometheus plugin making repeated calls to `rabbit_misc:otp_version/0` which then calls `file:read_file/1` and leaks memory on win32.
See https://github.com/erlang/otp/issues/5527 for the report to the Erlang team.
Turn `badmatch` into actual error
Diffstat (limited to 'deps/rabbitmq_tracing')
-rw-r--r-- | deps/rabbitmq_tracing/src/rabbit_tracing_files.erl | 2 | ||||
-rw-r--r-- | deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/deps/rabbitmq_tracing/src/rabbit_tracing_files.erl b/deps/rabbitmq_tracing/src/rabbit_tracing_files.erl index fa260a4077..882c802ed1 100644 --- a/deps/rabbitmq_tracing/src/rabbit_tracing_files.erl +++ b/deps/rabbitmq_tracing/src/rabbit_tracing_files.erl @@ -37,7 +37,7 @@ full_path(Name0) -> %%-------------------------------------------------------------------- file_info(Name) -> - Size = case file:read_file_info(full_path(Name)) of + Size = case file:read_file_info(full_path(Name), [raw]) of {ok, Info} -> Info#file_info.size; {error, Error} -> diff --git a/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl b/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl index acea4077b8..ed23c6900d 100644 --- a/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl +++ b/deps/rabbitmq_tracing/src/rabbit_tracing_wm_file.erl @@ -38,7 +38,7 @@ serve(ReqData, Context) -> serve(Name) -> Path = rabbit_tracing_files:full_path(Name), - {ok, Content} = file:read_file(Path), + {ok, Content} = rabbit_misc:raw_read_file(Path), Content. delete_resource(ReqData, Context) -> |