You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2025/03/17 05:10:55 UTC
(couchdb) 14/38: Use local pids for cfile
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch merge-3.4.3
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit ee057f22f4cc51c34fa4174cf89503e0230d05a9
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Tue Mar 4 10:42:12 2025 -0500
Use local pids for cfile
Pids could be remote when processing attachments and `is_process_alive/1` will
throw an error then, so ensure a fallback for non-local processes.
---
src/couch/src/couch_file.erl | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/couch/src/couch_file.erl b/src/couch/src/couch_file.erl
index 8f15bd8cd..78189c64e 100644
--- a/src/couch/src/couch_file.erl
+++ b/src/couch/src/couch_file.erl
@@ -941,7 +941,10 @@ generate_xxhash_checksums() ->
%
get_cfile(Pid) when is_pid(Pid) ->
- case {is_process_alive(Pid), get(?CFILE_HANDLE)} of
+ % Pids could be remote when processing attachments and is_process_alive/1
+ % will throw an error then, so ensure a fallback for non-local processes
+ PidAliveAndLocal = node(Pid) =:= node() andalso is_process_alive(Pid),
+ case {PidAliveAndLocal, get(?CFILE_HANDLE)} of
{false, _} ->
erase(?CFILE_HANDLE),
undefined;