gproc_dist_tests.erl 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. %% ``The contents of this file are subject to the Erlang Public License,
  2. %% Version 1.1, (the "License"); you may not use this file except in
  3. %% compliance with the License. You should have received a copy of the
  4. %% Erlang Public License along with this software. If not, it can be
  5. %% retrieved via the world wide web at http://www.erlang.org/.
  6. %%
  7. %% Software distributed under the License is distributed on an "AS IS"
  8. %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  9. %% the License for the specific language governing rights and limitations
  10. %% under the License.
  11. %%
  12. %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
  13. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
  14. %% AB. All Rights Reserved.''
  15. %%
  16. %% @author Ulf Wiger <ulf.wiger@erlang-solutions.com>
  17. %%
  18. -module(gproc_dist_tests).
  19. -ifdef(TEST).
  20. -include_lib("eunit/include/eunit.hrl").
  21. -export([t_spawn/1, t_spawn_reg/2]).
  22. dist_test_() ->
  23. {timeout, 120,
  24. [{setup,
  25. fun() ->
  26. Ns = start_slaves([dist_test_n1, dist_test_n2]),
  27. ?assertMatch({[ok,ok],[]},
  28. rpc:multicall(Ns, application, set_env,
  29. [gproc, gproc_dist, Ns])),
  30. ?assertMatch({[ok,ok],[]},
  31. rpc:multicall(Ns, application, start, [gproc])),
  32. Ns
  33. end,
  34. fun(Ns) ->
  35. [rpc:call(N, init, stop, []) || N <- Ns]
  36. end,
  37. fun(Ns) ->
  38. {inorder,
  39. [
  40. {inparallel, [
  41. fun() ->
  42. ?debugVal(t_simple_reg(Ns))
  43. end,
  44. fun() ->
  45. ?debugVal(t_simple_reg_or_locate(Ns))
  46. end,
  47. fun() ->
  48. ?debugVal(t_simple_counter(Ns))
  49. end,
  50. fun() ->
  51. ?debugVal(t_aggr_counter(Ns))
  52. end,
  53. fun() ->
  54. ?debugVal(t_update_counters(Ns))
  55. end,
  56. fun() ->
  57. ?debugVal(t_shared_counter(Ns))
  58. end,
  59. fun() ->
  60. ?debugVal(t_mreg(Ns))
  61. end,
  62. fun() ->
  63. ?debugVal(t_await_reg(Ns))
  64. end,
  65. fun() ->
  66. ?debugVal(t_await_self(Ns))
  67. end,
  68. fun() ->
  69. ?debugVal(t_await_reg_exists(Ns))
  70. end,
  71. fun() ->
  72. ?debugVal(t_give_away(Ns))
  73. end,
  74. fun() ->
  75. ?debugVal(t_sync(Ns))
  76. end,
  77. fun() ->
  78. ?debugVal(t_monitor(Ns))
  79. end,
  80. fun() ->
  81. ?debugVal(t_subscribe(Ns))
  82. end
  83. ]
  84. },
  85. fun() ->
  86. ?debugVal(t_sync_cand_dies(Ns))
  87. end,
  88. {timeout, 90, [fun() ->
  89. ?debugVal(t_fail_node(Ns))
  90. end]}
  91. ]}
  92. end
  93. }]}.
  94. -define(T_NAME, {n, g, {?MODULE, ?LINE}}).
  95. -define(T_KVL, [{foo, "foo"}, {bar, "bar"}]).
  96. -define(T_COUNTER, {c, g, {?MODULE, ?LINE}}).
  97. t_simple_reg([H|_] = Ns) ->
  98. Name = ?T_NAME,
  99. P = t_spawn_reg(H, Name),
  100. ?assertMatch(ok, t_lookup_everywhere(Name, Ns, P)),
  101. ?assertMatch(true, t_call(P, {apply, gproc, unreg, [Name]})),
  102. ?assertMatch(ok, t_lookup_everywhere(Name, Ns, undefined)),
  103. ?assertMatch(ok, t_call(P, die)).
  104. t_simple_reg_or_locate([A,B|_] = _Ns) ->
  105. Name = ?T_NAME,
  106. P1 = t_spawn(A),
  107. _Ref = erlang:monitor(process, P1),
  108. ?assertMatch({P1, the_value},
  109. t_call(P1, {apply, gproc, reg_or_locate, [Name, the_value]})),
  110. P2 = t_spawn(B),
  111. _Ref2 = erlang:monitor(process, P2),
  112. ?assertMatch({P1, the_value},
  113. t_call(P2, {apply, gproc, reg_or_locate, [Name, other_value]})),
  114. ?assertMatch(ok, t_call(P1, die)),
  115. ?assertMatch(ok, t_call(P2, die)).
  116. t_simple_counter([H|_] = Ns) ->
  117. Ctr = ?T_COUNTER,
  118. P = t_spawn_reg(H, Ctr, 3),
  119. ?assertMatch(ok, t_read_everywhere(Ctr, P, Ns, 3)),
  120. ?assertMatch(5, t_call(P, {apply, gproc, update_counter, [Ctr, 2]})),
  121. ?assertMatch(ok, t_read_everywhere(Ctr, P, Ns, 5)),
  122. ?assertMatch(ok, t_call(P, die)).
  123. t_shared_counter([H|_] = Ns) ->
  124. Ctr = ?T_COUNTER,
  125. P = t_spawn_reg_shared(H, Ctr, 3),
  126. ?assertMatch(ok, t_read_everywhere(Ctr, shared, Ns, 3)),
  127. ?assertMatch(5, t_call(P, {apply, gproc, update_shared_counter, [Ctr, 2]})),
  128. ?assertMatch(ok, t_read_everywhere(Ctr, shared, Ns, 5)),
  129. ?assertMatch(ok, t_call(P, die)),
  130. ?assertMatch(ok, t_read_everywhere(Ctr, shared, Ns, 5)),
  131. ?assertMatch(ok, t_read_everywhere(Ctr, shared, Ns, 5)), % twice
  132. P1 = t_spawn(H),
  133. ?assertMatch(true, t_call(P1, {apply, gproc, unreg_shared, [Ctr]})),
  134. ?assertMatch(ok, t_read_everywhere(Ctr, shared, Ns, badarg)).
  135. t_aggr_counter([H1,H2|_] = Ns) ->
  136. {c,g,Nm} = Ctr = ?T_COUNTER,
  137. Aggr = {a,g,Nm},
  138. Pc1 = t_spawn_reg(H1, Ctr, 3),
  139. Pa = t_spawn_reg(H2, Aggr),
  140. ?assertMatch(ok, t_read_everywhere(Ctr, Pc1, Ns, 3)),
  141. ?assertMatch(ok, t_read_everywhere(Aggr, Pa, Ns, 3)),
  142. Pc2 = t_spawn_reg(H2, Ctr, 3),
  143. ?assertMatch(ok, t_read_everywhere(Ctr, Pc2, Ns, 3)),
  144. ?assertMatch(ok, t_read_everywhere(Aggr, Pa, Ns, 6)),
  145. ?assertMatch(5, t_call(Pc1, {apply, gproc, update_counter, [Ctr, 2]})),
  146. ?assertMatch(ok, t_read_everywhere(Ctr, Pc1, Ns, 5)),
  147. ?assertMatch(ok, t_read_everywhere(Aggr, Pa, Ns, 8)),
  148. ?assertMatch(ok, t_call(Pc1, die)),
  149. ?assertMatch(ok, t_read_everywhere(Aggr, Pa, Ns, 3)),
  150. ?assertMatch(ok, t_call(Pc2, die)),
  151. ?assertMatch(ok, t_call(Pa, die)).
  152. t_update_counters([H1,H2|_] = Ns) ->
  153. {c,g,N1} = C1 = ?T_COUNTER,
  154. A1 = {a,g,N1},
  155. C2 = ?T_COUNTER,
  156. P1 = t_spawn_reg(H1, C1, 2),
  157. P12 = t_spawn_reg(H2, C1, 2),
  158. P2 = t_spawn_reg(H2, C2, 1),
  159. Pa1 = t_spawn_reg(H2, A1),
  160. ?assertMatch(ok, t_read_everywhere(C1, P1, Ns, 2)),
  161. ?assertMatch(ok, t_read_everywhere(C1, P12, Ns, 2)),
  162. ?assertMatch(ok, t_read_everywhere(C2, P2, Ns, 1)),
  163. ?assertMatch(ok, t_read_everywhere(A1, Pa1, Ns, 4)),
  164. ?debugFmt("code:which(gproc_dist) = ~p~n", [code:which(gproc_dist)]),
  165. ?assertMatch([{C1,P1, 3},
  166. {C1,P12,4},
  167. {C2,P2, 0}], t_call(P1, {apply, gproc, update_counters,
  168. [g, [{C1,P1,1},{C1,P12,2},{C2,P2,{-2,0,0}}]]})),
  169. ?assertMatch(ok, t_read_everywhere(C1, P1, Ns, 3)),
  170. ?assertMatch(ok, t_read_everywhere(C1, P12, Ns, 4)),
  171. ?assertMatch(ok, t_read_everywhere(C2, P2, Ns, 0)),
  172. ?assertMatch(ok, t_read_everywhere(A1, Pa1, Ns, 7)),
  173. ?assertMatch(ok, t_call(P1, die)),
  174. ?assertMatch(ok, t_call(P12, die)),
  175. ?assertMatch(ok, t_call(P2, die)).
  176. t_mreg([H|_] = Ns) ->
  177. Kvl = ?T_KVL,
  178. Keys = [K || {K,_} <- Kvl],
  179. P = t_spawn_mreg(H, Kvl),
  180. [?assertMatch(ok, t_lookup_everywhere({n,g,K}, Ns, P)) || K <- Keys],
  181. ?assertMatch(true, t_call(P, {apply, gproc, munreg, [n, g, Keys]})),
  182. [?assertMatch(ok, t_lookup_everywhere({n,g,K},Ns,undefined)) || K <- Keys],
  183. ?assertMatch(ok, t_call(P, die)).
  184. t_await_reg([A,B|_]) ->
  185. Name = ?T_NAME,
  186. P = t_spawn(A),
  187. Ref = erlang:monitor(process, P),
  188. P ! {self(), Ref, {apply, gproc, await, [Name]}},
  189. t_sleep(),
  190. P1 = t_spawn_reg(B, Name),
  191. ?assert(P1 == receive
  192. {P, Ref, Res} ->
  193. element(1, Res);
  194. {'DOWN', Ref, _, _, Reason} ->
  195. erlang:error(Reason);
  196. Other ->
  197. erlang:error({received,Other})
  198. end),
  199. ?assertMatch(ok, t_call(P, die)),
  200. ?assertMatch(ok, t_call(P1, die)).
  201. t_await_self([A|_]) ->
  202. Name = ?T_NAME,
  203. P = t_spawn(A, false), % don't buffer unknowns
  204. Ref = t_call(P, {apply, gproc, nb_wait, [Name]}),
  205. ?assertMatch(ok, t_call(P, {selective, true})),
  206. ?assertMatch(true, t_call(P, {apply, gproc, reg, [Name, some_value]})),
  207. ?assertMatch({registered, {Name, P, some_value}},
  208. t_call(P, {apply_fun, fun() ->
  209. receive
  210. {gproc, Ref, R, Wh} ->
  211. {R, Wh}
  212. after 10000 ->
  213. timeout
  214. end
  215. end})),
  216. ?assertMatch(ok, t_call(P, {selective, false})),
  217. ?assertMatch(true, t_call(P, {apply, gproc, unreg, [Name]})).
  218. t_await_reg_exists([A,B|_]) ->
  219. Name = ?T_NAME,
  220. P = t_spawn(A),
  221. Ref = erlang:monitor(process, P),
  222. P1 = t_spawn_reg(B, Name),
  223. P ! {self(), Ref, {apply, gproc, await, [Name]}},
  224. ?assert(P1 == receive
  225. {P, Ref, Res} ->
  226. element(1, Res);
  227. {'DOWN', Ref, _, _, Reason} ->
  228. erlang:error(Reason);
  229. Other ->
  230. erlang:error({received,Other})
  231. end),
  232. ?assertMatch(ok, t_call(P, die)),
  233. ?assertMatch(ok, t_call(P1, die)).
  234. t_give_away([A,B|_] = Ns) ->
  235. Na = ?T_NAME,
  236. Nb = ?T_NAME,
  237. Pa = t_spawn_reg(A, Na),
  238. Pb = t_spawn_reg(B, Nb),
  239. ?assertMatch(ok, t_lookup_everywhere(Na, Ns, Pa)),
  240. ?assertMatch(ok, t_lookup_everywhere(Nb, Ns, Pb)),
  241. ?assertMatch(Pb, t_call(Pa, {apply, gproc, give_away, [Na, Nb]})),
  242. ?assertMatch(ok, t_lookup_everywhere(Na, Ns, Pb)),
  243. ?assertMatch(Pa, t_call(Pb, {apply, gproc, give_away, [Na, Pa]})),
  244. ?assertMatch(ok, t_lookup_everywhere(Na, Ns, Pa)),
  245. ?assertMatch(ok, t_call(Pa, die)),
  246. ?assertMatch(ok, t_call(Pb, die)).
  247. t_sync(Ns) ->
  248. %% Don't really know how to test this...
  249. [?assertMatch(true, rpc:call(N, gproc_dist, sync, []))
  250. || N <- Ns].
  251. t_monitor([A,B|_]) ->
  252. Na = ?T_NAME,
  253. Pa = t_spawn_reg(A, Na),
  254. Pb = t_spawn(B, _Selective = true),
  255. Ref = t_call(Pb, {apply, gproc, monitor, [Na]}),
  256. ?assert(is_reference(Ref)),
  257. ?assertMatch(ok, t_call(Pa, die)),
  258. ?assertMatch({gproc,unreg,Ref,Na}, got_msg(Pb, gproc)),
  259. Pc = t_spawn_reg(A, Na),
  260. Ref1 = t_call(Pb, {apply, gproc, monitor, [Na]}),
  261. ?assertMatch(true, t_call(Pc, {apply, gproc, unreg, [Na]})),
  262. ?assertMatch({gproc,unreg,Ref1,Na}, got_msg(Pb, gproc)).
  263. t_subscribe([A,B|_] = Ns) ->
  264. Na = ?T_NAME,
  265. Pb = t_spawn(B, _Selective = true),
  266. ?assertEqual(ok, t_call(Pb, {apply, gproc_monitor, subscribe, [Na]})),
  267. ?assertMatch({gproc_monitor, Na, undefined}, got_msg(Pb, gproc_monitor)),
  268. Pa = t_spawn_reg(A, Na),
  269. ?assertMatch({gproc_monitor, Na, Pa}, got_msg(Pb, gproc_monitor)),
  270. Pc = t_spawn(A),
  271. t_call(Pa, {apply, gproc, give_away, [Na, Pc]}),
  272. ?assertMatch(ok, t_lookup_everywhere(Na, Ns, Pc)),
  273. ?assertEqual({gproc_monitor,Na,{migrated,Pc}}, got_msg(Pb, gproc_monitor)),
  274. ?assertEqual(ok, t_call(Pc, die)),
  275. ?assertEqual({gproc_monitor,Na,undefined}, got_msg(Pb, gproc_monitor)).
  276. got_msg(Pb, Tag) ->
  277. t_call(Pb,
  278. {apply_fun,
  279. fun() ->
  280. receive
  281. M when element(1, M) == Tag ->
  282. M
  283. after 1000 ->
  284. timeout
  285. end
  286. end}).
  287. %% Verify that the gproc_dist:sync() call returns true even if a candidate dies
  288. %% while the sync is underway. This test makes use of sys:suspend() to ensure that
  289. %% the other candidate doesn't respond too quickly.
  290. t_sync_cand_dies([A,B|_]) ->
  291. Leader = rpc:call(A, gproc_dist, get_leader, []),
  292. Other = case Leader of
  293. A -> B;
  294. B -> A
  295. end,
  296. ?assertMatch(ok, rpc:call(Other, sys, suspend, [gproc_dist])),
  297. P = rpc:call(Other, erlang, whereis, [gproc_dist]),
  298. Key = rpc:async_call(Leader, gproc_dist, sync, []),
  299. %% The overall timeout for gproc_dist:sync() is 5 seconds. Here, we should
  300. %% still be waiting.
  301. ?assertMatch(timeout, rpc:nb_yield(Key, 1000)),
  302. exit(P, kill),
  303. %% The leader should detect that the other candidate died and respond
  304. %% immediately. Therefore, we should have our answer well within 1 sec.
  305. ?assertMatch({value, true}, rpc:nb_yield(Key, 1000)).
  306. t_fail_node([A,B|_] = Ns) ->
  307. Na = ?T_NAME,
  308. Nb = ?T_NAME,
  309. Pa = t_spawn_reg(A, Na),
  310. Pb = t_spawn_reg(B, Nb),
  311. ?assertMatch(ok, rpc:call(A, application, stop, [gproc])),
  312. ?assertMatch(ok, t_lookup_everywhere(Na, Ns -- [A], undefined)),
  313. ?assertMatch(ok, t_lookup_everywhere(Nb, Ns -- [A], Pb)),
  314. ?assertMatch(ok, rpc:call(A, application, start, [gproc])),
  315. ?assertMatch(ok, t_lookup_everywhere(Na, Ns, undefined)),
  316. ?assertMatch(ok, t_lookup_everywhere(Nb, Ns, Pb)),
  317. ?assertMatch(ok, t_call(Pa, die)),
  318. ?assertMatch(ok, t_call(Pb, die)).
  319. t_sleep() ->
  320. timer:sleep(500).
  321. t_lookup_everywhere(Key, Nodes, Exp) ->
  322. t_lookup_everywhere(Key, Nodes, Exp, 3).
  323. t_lookup_everywhere(Key, _, Exp, 0) ->
  324. {lookup_failed, Key, Exp};
  325. t_lookup_everywhere(Key, Nodes, Exp, I) ->
  326. Expected = [{N, Exp} || N <- Nodes],
  327. Found = [{N,rpc:call(N, gproc, where, [Key])} || N <- Nodes],
  328. if Expected =/= Found ->
  329. ?debugFmt("lookup ~p failed~n"
  330. "(Expected: ~p;~n"
  331. " Found : ~p), retrying...~n",
  332. [Key, Expected, Found]),
  333. t_sleep(),
  334. t_lookup_everywhere(Key, Nodes, Exp, I-1);
  335. true ->
  336. ok
  337. end.
  338. t_read_everywhere(Key, Pid, Nodes, Exp) ->
  339. t_read_everywhere(Key, Pid, Nodes, Exp, 3).
  340. t_read_everywhere(Key, _, _, Exp, 0) ->
  341. {read_failed, Key, Exp};
  342. t_read_everywhere(Key, Pid, Nodes, Exp, I) ->
  343. Expected = [{N, Exp} || N <- Nodes],
  344. Found = [{N, read_result(rpc:call(N, gproc, get_value, [Key, Pid]))}
  345. || N <- Nodes],
  346. if Expected =/= Found ->
  347. ?debugFmt("read ~p failed~n"
  348. "(Expected: ~p;~n"
  349. " Found : ~p), retrying...~n",
  350. [{Key, Pid}, Expected, Found]),
  351. t_sleep(),
  352. t_read_everywhere(Key, Pid, Nodes, Exp, I-1);
  353. true ->
  354. ok
  355. end.
  356. read_result({badrpc, {'EXIT', {badarg, _}}}) -> badarg;
  357. read_result(R) -> R.
  358. t_spawn(Node) ->
  359. t_spawn(Node, false).
  360. t_spawn(Node, Selective) when is_boolean(Selective) ->
  361. Me = self(),
  362. P = spawn(Node, fun() ->
  363. Me ! {self(), ok},
  364. t_loop(Selective)
  365. end),
  366. receive
  367. {P, ok} -> P
  368. end.
  369. t_spawn_reg(Node, Name) ->
  370. t_spawn_reg(Node, Name, default_value(Name)).
  371. t_spawn_reg(Node, Name, Value) ->
  372. Me = self(),
  373. spawn(Node, fun() ->
  374. ?assertMatch(true, gproc:reg(Name, Value)),
  375. Me ! {self(), ok},
  376. t_loop()
  377. end),
  378. receive
  379. {P, ok} -> P
  380. end.
  381. t_spawn_reg_shared(Node, Name, Value) ->
  382. Me = self(),
  383. spawn(Node, fun() ->
  384. ?assertMatch(true, gproc:reg_shared(Name, Value)),
  385. Me ! {self(), ok},
  386. t_loop()
  387. end),
  388. receive
  389. {P, ok} -> P
  390. end.
  391. default_value({c,_,_}) -> 0;
  392. default_value(_) -> undefined.
  393. t_spawn_mreg(Node, KVL) ->
  394. Me = self(),
  395. spawn(Node, fun() ->
  396. ?assertMatch(true, gproc:mreg(n, g, KVL)),
  397. Me ! {self(), ok},
  398. t_loop()
  399. end),
  400. receive
  401. {P, ok} -> P
  402. end.
  403. t_call(P, Req) ->
  404. Ref = erlang:monitor(process, P),
  405. P ! {self(), Ref, Req},
  406. receive
  407. {P, Ref, Res} ->
  408. erlang:demonitor(Ref),
  409. Res;
  410. {'DOWN', Ref, _, _, Error} ->
  411. erlang:error({'DOWN', P, Error})
  412. end.
  413. t_loop() ->
  414. t_loop(false).
  415. t_loop(Selective) when is_boolean(Selective) ->
  416. receive
  417. {From, Ref, die} ->
  418. From ! {self(), Ref, ok};
  419. {From, Ref, {selective, Bool}} when is_boolean(Bool) ->
  420. From ! {self(), Ref, ok},
  421. t_loop(Bool);
  422. {From, Ref, {apply, M, F, A}} ->
  423. From ! {self(), Ref, apply(M, F, A)},
  424. t_loop(Selective);
  425. {From, Ref, {apply_fun, F}} ->
  426. From ! {self(), Ref, F()},
  427. t_loop(Selective);
  428. Other when not Selective ->
  429. ?debugFmt("got unknown msg: ~p~n", [Other]),
  430. exit({unknown_msg, Other})
  431. end.
  432. start_slaves(Ns) ->
  433. [H|T] = Nodes = [start_slave(N) || N <- Ns],
  434. _ = [rpc:call(H, net_adm, ping, [N]) || N <- T],
  435. Nodes.
  436. start_slave(Name) ->
  437. case node() of
  438. nonode@nohost ->
  439. os:cmd("epmd -daemon"),
  440. {ok, _} = net_kernel:start([gproc_master, shortnames]);
  441. _ ->
  442. ok
  443. end,
  444. {Pa, Pz} = paths(),
  445. Paths = "-pa ./ -pz ../ebin" ++
  446. lists:flatten([[" -pa " ++ Path || Path <- Pa],
  447. [" -pz " ++ Path || Path <- Pz]]),
  448. {ok, Node} = slave:start(host(), Name, Paths),
  449. %% io:fwrite(user, "Slave node: ~p~n", [Node]),
  450. Node.
  451. paths() ->
  452. Path = code:get_path(),
  453. {ok, [[Root]]} = init:get_argument(root),
  454. {Pas, Rest} = lists:splitwith(fun(P) ->
  455. not lists:prefix(Root, P)
  456. end, Path),
  457. {_, Pzs} = lists:splitwith(fun(P) ->
  458. lists:prefix(Root, P)
  459. end, Rest),
  460. {Pas, Pzs}.
  461. host() ->
  462. [_Name, Host] = re:split(atom_to_list(node()), "@", [{return, list}]),
  463. list_to_atom(Host).
  464. -endif.