Closed nickva closed 2 months ago
(couchdb@127.0.0.1)1> f(), P = couch_query_servers:get_os_process("javascript").
{proc,<0.784.0>,<<"javascript">>,
#Ref<0.755959798.3700686850.66246>,undefined,#{},
{couch_os_process,prompt},
{couch_os_process,set_timeout},
{couch_os_process,stop},
-576460716757433944,-576460716757433604}
(couchdb@127.0.0.1)2> couch_query_servers:proc_prompt(P, [<<"add_fun">>, <<"function(){}">>]).
true
(couchdb@127.0.0.1)3>
Make sure a couchjs is running.
Brutally killing the pid should also kill the couchjs process
(couchdb@127.0.0.1)3> exit(<0.784.0>, kill).
(couchdb@127.0.0.1)4>
Now it shouldn't be running
On Windows 10 (in powershell)
.\dev\run --admin=adm:pass -n3
Get the cookie:
> cat ~\.erlang.cookie
$...cookie...
> werl -hidden -name n@127.0.0.1 -remsh node1@127.0.0.1 -c $...cookie...
Erlang/OTP 25 [erts-13.2.2.9] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Eshell V13.2.2.9 (abort with ^G)
(node1@127.0.0.1)1> f(), P = couch_query_servers:get_os_process("javascript").
{proc,<0.5106.0>,<<"javascript">>,
#Ref<0.583164505.2910060547.127323>,undefined,#{},
{couch_os_process,prompt},
{couch_os_process,set_timeout},
{couch_os_process,stop},
-5764604785904640,-5764604785904640}
(node1@127.0.0.1)2> couch_query_servers:proc_prompt(P, [<<"add_fun">>, <<"function(){}">>]).
true
(node1@127.0.0.1)3>
Ensure a couchjs task is running
> ps -f *couch*
ProductVersion FileVersion FileName
-------------- ----------- --------
C:\Users\vatam\asf\src\couch\priv\couchjs.exe
Kill the Erlang PID and that should kill the couchjs process
(node1@127.0.0.1)3> exit(<0.5106.0>, kill).
true
(node1@127.0.0.1)4>
]> ps -f *couch*
>
I'm starting with
.\dev\run --admin=adm:pass -n3
and remsh into node1:
werl -hidden -name n@127.0.0.1 -remsh node1@127.0.0.1 -c $ERLCOOKIE
end running your command:
Erlang/OTP 25 [erts-13.2.2.10] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Eshell V13.2.2.10 (abort with ^G)
(node1@127.0.0.1)1> f(), P = couch_query_servers:get_os_process("javascript").
{proc,<0.2718.0>,<<"javascript">>,
#Ref<0.1761014874.3545235457.188270>,undefined,#{},
{couch_os_process,prompt},
{couch_os_process,set_timeout},
{couch_os_process,stop},
-5764606319328256,-5764606319328256}
(node1@127.0.0.1)2> couch_query_servers:proc_prompt(P, [<<"add_fun">>, <<"function(){}">>]).
true
(node1@127.0.0.1)3>
and get the following couchjs
processes:
ps -f *couch*
ProductVersion FileVersion FileName
-------------- ----------- --------
C:\Users\couchdb\Documents\couchdb-otp25\src\couch\priv\couchjs.exe
killing
(node1@127.0.0.1)3> exit(<0.2718.0>, kill).
true
(node1@127.0.0.1)4>
and the process is gone!
What I then accidentally tested, was a "Verify" in Fauxton.
The error is not the problem, because the start script dev/run
always sets a bind address to 0.0.0.0
during the cluster setup (we should make a separate PR for Windows to use 127.0.0.1
).
Then I got those couchjs
processes:
ps -f *couch*
ProductVersion FileVersion FileName
-------------- ----------- --------
C:\Users\couchdb\Documents\couchdb-otp25\src\couch\priv\couchjs.exe
C:\Users\couchdb\Documents\couchdb-otp25\src\couch\priv\couchjs.exe
C:\Users\couchdb\Documents\couchdb-otp25\src\couch\priv\couchjs.exe
C:\Users\couchdb\Documents\couchdb-otp25\src\couch\priv\couchjs.exe
C:\Users\couchdb\Documents\couchdb-otp25\src\couch\priv\couchjs.exe
C:\Users\couchdb\Documents\couchdb-otp25\src\couch\priv\couchjs.exe
Is this a problem, or are they reused when needed?
@big-r81 thanks for giving it a try. It looks as expected.
We keep a pool of couchjs processes around to reuse later.
os_pid is available since at least OTP 19.0 and we never noticed [1]
This should make our releases easily relocatable to paths which have spaces.
[1] https://github.com/erlang/otp/blob/3ff36ef6f6f20749b5a03b3667206ede0fdb5791/erts/doc/src/erlang_port_info.md?plain=1#L27