Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0763-snmp-test-Fixed-stopping-writer-in-log-tes...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0763-snmp-test-Fixed-stopping-writer-in-log-test.patch of Package erlang
From b1dfdd17ba5663f3f42704d8e5b96ce2752f3aae Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Wed, 1 Dec 2021 17:17:49 +0100 Subject: [PATCH 2/2] [snmp|test] Fixed stopping writer in log test --- lib/snmp/test/snmp_log_SUITE.erl | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/snmp/test/snmp_log_SUITE.erl b/lib/snmp/test/snmp_log_SUITE.erl index b63c9e3b34..80734a4d94 100644 --- a/lib/snmp/test/snmp_log_SUITE.erl +++ b/lib/snmp/test/snmp_log_SUITE.erl @@ -733,14 +733,14 @@ validate_size(A, B) -> %%====================================================================== log_writer_start(Name, File, Size, Repair, Factor) -> - Pid = spawn_link(?MODULE, log_writer_main, - [Name, File, Size, Repair, self(), Factor]), + {Pid, _} = spawn_monitor(?MODULE, log_writer_main, + [Name, File, Size, Repair, self(), Factor]), receive {log, Log, Pid} -> {ok, Log, Pid}; - {'EXIT', Pid, Reason} -> + {'DOWN', _MRef, process, Pid, Reason} -> {error, Reason} - after 60000 -> + after 30000 -> Msg = receive Any -> Any after 0 -> nothing end, Info = (catch process_info(Pid)), exit({failed_starting_writer, timeout, Msg, Info}) @@ -750,14 +750,18 @@ log_writer_stop(Pid) -> Pid ! {stop, self()}, _T1 = snmp_misc:now(ms), receive - {'EXIT', Pid, normal} -> + {'DOWN', _MRef, process, Pid, normal} -> _T2 = snmp_misc:now(ms), ?IPRINT("it took ~w ms to stop the writer", [_T2 - _T1]), ok after 60000 -> Msg = receive Any -> Any after 0 -> nothing end, Info = (catch process_info(Pid)), - exit({failed_stopping_writer, timeout, Msg, Info}) + ?IPRINT("failed stop writer - kill it: " + "~n Msg: ~p" + "~n Info: ~p", [Msg, Info]), + exit(Pid, kill), + ok end. log_writer_info(Pid) -> @@ -771,11 +775,16 @@ log_writer_sleep(Pid, Time) -> _T2 = snmp_misc:now(ms), ?IPRINT("it took ~w ms to put the writer to sleep", [_T2 - _T1]), ok; - {'EXIT', Pid, Reason} -> + {'DOWN', _MRef, process, Pid, Reason} -> + _T2 = snmp_misc:now(ms), + ?IPRINT("writer error while attempting to put it to sleep (~w): " + "~n ~p", [_T2 - _T1, Reason]), {error, Reason} after 60000 -> Msg = receive Any -> Any after 0 -> nothing end, Info = (catch process_info(Pid)), + ?IPRINT("failed to put writer to sleep - kill it"), + exit(Pid, kill), exit({failed_put_writer_to_sleep, timeout, Msg, Info}) end. -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor