From 6b94cea1d631f3ab222347ba5941894b750a0740 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 12 2015 13:32:58 +0000 Subject: import libqb-0.17.1-1.el7_1.2 --- diff --git a/SOURCES/bz1211375-ipc-test-update1.patch b/SOURCES/bz1211375-ipc-test-update1.patch new file mode 100644 index 0000000..8ee3119 --- /dev/null +++ b/SOURCES/bz1211375-ipc-test-update1.patch @@ -0,0 +1,183 @@ +From c6c9a9ed6feb47bd357ce56c00f80cc6985390e1 Mon Sep 17 00:00:00 2001 +From: David Vossel +Date: Tue, 14 Apr 2015 15:10:28 -0400 +Subject: [PATCH 2/4] Low: tests: regression tests for stress testing loop_poll + ipc create/destroy + +--- + tests/check_ipc.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 96 insertions(+) + +diff --git a/tests/check_ipc.c b/tests/check_ipc.c +index ce9a7c0..79faa16 100644 +--- a/tests/check_ipc.c ++++ b/tests/check_ipc.c +@@ -94,6 +94,7 @@ static int32_t disconnect_after_created = QB_FALSE; + static int32_t num_bulk_events = 10; + static int32_t num_stress_events = 30000; + static int32_t reference_count_test = QB_FALSE; ++static int32_t multiple_connections = QB_FALSE; + + + static int32_t +@@ -227,6 +228,7 @@ s1_msg_process_fn(qb_ipcs_connection_t *c, + } else if (req_pt->id == IPC_MSG_REQ_SERVER_FAIL) { + exit(0); + } else if (req_pt->id == IPC_MSG_REQ_SERVER_DISCONNECT) { ++ multiple_connections = QB_FALSE; + qb_ipcs_disconnect(c); + } + return 0; +@@ -263,6 +265,9 @@ my_dispatch_del(int32_t fd) + static int32_t + s1_connection_closed(qb_ipcs_connection_t *c) + { ++ if (multiple_connections) { ++ return 0; ++ } + qb_enter(); + qb_leave(); + return 0; +@@ -301,6 +306,10 @@ outq_flush (void *data) + static void + s1_connection_destroyed(qb_ipcs_connection_t *c) + { ++ if (multiple_connections) { ++ return; ++ } ++ + qb_enter(); + if (reference_count_test) { + struct cs_ipcs_conn_context *cnx; +@@ -316,6 +325,9 @@ static void + s1_connection_created(qb_ipcs_connection_t *c) + { + uint32_t max = MAX_MSG_SIZE; ++ if (multiple_connections) { ++ return; ++ } + + if (send_event_on_created) { + struct qb_ipc_response_header response; +@@ -934,6 +946,60 @@ count_bulk_events(int32_t fd, int32_t revents, void *data) + } + + static void ++test_ipc_stress_connections(void) ++{ ++ int32_t c = 0; ++ int32_t j = 0; ++ uint32_t max_size = MAX_MSG_SIZE; ++ int32_t connections = 0; ++ pid_t pid; ++ ++ multiple_connections = QB_TRUE; ++ ++ qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_CLEAR_ALL, ++ QB_LOG_FILTER_FILE, "*", LOG_TRACE); ++ qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, ++ QB_LOG_FILTER_FILE, "*", LOG_INFO); ++ qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); ++ ++ pid = run_function_in_new_process(run_ipc_server); ++ fail_if(pid == -1); ++ sleep(1); ++ ++ for (connections = 1; connections < 70000; connections++) { ++ if (conn) { ++ qb_ipcc_disconnect(conn); ++ conn = NULL; ++ } ++ do { ++ conn = qb_ipcc_connect(ipc_name, max_size); ++ if (conn == NULL) { ++ j = waitpid(pid, NULL, WNOHANG); ++ ck_assert_int_eq(j, 0); ++ sleep(1); ++ c++; ++ } ++ } while (conn == NULL && c < 5); ++ fail_if(conn == NULL); ++ ++ if (((connections+1) % 1000) == 0) { ++ qb_log(LOG_INFO, "%d ipc connections made", connections+1); ++ } ++ } ++ multiple_connections = QB_FALSE; ++ ++ request_server_exit(); ++ verify_graceful_stop(pid); ++ qb_ipcc_disconnect(conn); ++ ++ qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_CLEAR_ALL, ++ QB_LOG_FILTER_FILE, "*", LOG_TRACE); ++ qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, ++ QB_LOG_FILTER_FILE, "*", LOG_TRACE); ++ qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); ++} ++ ++static void + test_ipc_bulk_events(void) + { + int32_t c = 0; +@@ -1076,6 +1142,16 @@ START_TEST(test_ipc_stress_test_us) + } + END_TEST + ++START_TEST(test_ipc_stress_connections_us) ++{ ++ qb_enter(); ++ ipc_type = QB_IPC_SOCKET; ++ ipc_name = __func__; ++ test_ipc_stress_connections(); ++ qb_leave(); ++} ++END_TEST ++ + START_TEST(test_ipc_bulk_events_us) + { + qb_enter(); +@@ -1265,6 +1341,16 @@ START_TEST(test_ipc_stress_test_shm) + } + END_TEST + ++START_TEST(test_ipc_stress_connections_shm) ++{ ++ qb_enter(); ++ ipc_type = QB_IPC_SHM; ++ ipc_name = __func__; ++ test_ipc_stress_connections(); ++ qb_leave(); ++} ++END_TEST ++ + START_TEST(test_ipc_bulk_events_shm) + { + qb_enter(); +@@ -1439,6 +1525,11 @@ make_shm_suite(void) + tcase_set_timeout(tc, 10); + suite_add_tcase(s, tc); + ++ tc = tcase_create("ipc_stress_connections"); ++ tcase_add_test(tc, test_ipc_stress_connections_shm); ++ tcase_set_timeout(tc, 200); ++ suite_add_tcase(s, tc); ++ + return s; + } + +@@ -1513,6 +1604,11 @@ make_soc_suite(void) + tcase_set_timeout(tc, 10); + suite_add_tcase(s, tc); + ++ tc = tcase_create("ipc_stress_connections"); ++ tcase_add_test(tc, test_ipc_stress_connections_us); ++ tcase_set_timeout(tc, 200); ++ suite_add_tcase(s, tc); ++ + return s; + } + +-- +1.8.4.2 + diff --git a/SOURCES/bz1211375-ipc-test-update2.patch b/SOURCES/bz1211375-ipc-test-update2.patch new file mode 100644 index 0000000..901b67a --- /dev/null +++ b/SOURCES/bz1211375-ipc-test-update2.patch @@ -0,0 +1,35 @@ +From 340ed23772de567186e964a8278d668680a962a9 Mon Sep 17 00:00:00 2001 +From: David Vossel +Date: Thu, 16 Apr 2015 09:40:08 -0500 +Subject: [PATCH 3/4] Low: check_ipc: give connection stress tests for shm and + socket unique names + +--- + tests/check_ipc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/check_ipc.c b/tests/check_ipc.c +index 79faa16..b69d9fb 100644 +--- a/tests/check_ipc.c ++++ b/tests/check_ipc.c +@@ -1525,7 +1525,7 @@ make_shm_suite(void) + tcase_set_timeout(tc, 10); + suite_add_tcase(s, tc); + +- tc = tcase_create("ipc_stress_connections"); ++ tc = tcase_create("ipc_stress_connections_shm"); + tcase_add_test(tc, test_ipc_stress_connections_shm); + tcase_set_timeout(tc, 200); + suite_add_tcase(s, tc); +@@ -1604,7 +1604,7 @@ make_soc_suite(void) + tcase_set_timeout(tc, 10); + suite_add_tcase(s, tc); + +- tc = tcase_create("ipc_stress_connections"); ++ tc = tcase_create("ipc_stress_connections_us"); + tcase_add_test(tc, test_ipc_stress_connections_us); + tcase_set_timeout(tc, 200); + suite_add_tcase(s, tc); +-- +1.8.4.2 + diff --git a/SOURCES/bz1211375-ipc-test-update3.patch b/SOURCES/bz1211375-ipc-test-update3.patch new file mode 100644 index 0000000..7cea470 --- /dev/null +++ b/SOURCES/bz1211375-ipc-test-update3.patch @@ -0,0 +1,281 @@ +From 378be495e888fc9b5c1adeef078c06b662cf5a54 Mon Sep 17 00:00:00 2001 +From: David Vossel +Date: Thu, 16 Apr 2015 09:53:12 -0500 +Subject: [PATCH 4/4] Low: check_ipc: generate unique server names for tests + +Package builders that run multiple builds of libqb in parallel +will fail because the IPC unit tests stomp on each other's namespace. +We have to give each IPC server a randomized unique name during +'make check' to avoid this. +--- + tests/check_ipc.c | 65 +++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 39 insertions(+), 26 deletions(-) + +diff --git a/tests/check_ipc.c b/tests/check_ipc.c +index b69d9fb..4397963 100644 +--- a/tests/check_ipc.c ++++ b/tests/check_ipc.c +@@ -32,7 +32,7 @@ + #include + #include + +-static const char *ipc_name = "ipc_test"; ++static char ipc_name[256]; + + #define DEFAULT_MAX_MSG_SIZE (8192*16) + static int CALCULATED_DGRAM_MAX_MSG_SIZE = 0; +@@ -105,6 +105,18 @@ exit_handler(int32_t rsignal, void *data) + return -1; + } + ++static void ++set_ipc_name(const char *prefix) ++{ ++ /* We have to give the server name a random postfix because ++ * some build systems attempt to generate packages for libqb ++ * in parallel. These unit tests are run during the package ++ * build process. Two builds executing on the same machine ++ * can stomp on each other's unit tests if the ipc server ++ * names aren't unique... This was very confusing to debug */ ++ snprintf(ipc_name, 256, "%s-%d", prefix, (int32_t)random()); ++} ++ + static int32_t + s1_msg_process_fn(qb_ipcs_connection_t *c, + void *data, size_t size) +@@ -710,7 +722,7 @@ START_TEST(test_ipc_exit_us) + { + qb_enter(); + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + recv_timeout = 5000; + test_ipc_exit(); + qb_leave(); +@@ -721,7 +733,7 @@ START_TEST(test_ipc_exit_shm) + { + qb_enter(); + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + recv_timeout = 1000; + test_ipc_exit(); + qb_leave(); +@@ -732,7 +744,7 @@ START_TEST(test_ipc_txrx_shm_timeout) + { + qb_enter(); + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_txrx_timeout(); + qb_leave(); + } +@@ -742,7 +754,7 @@ START_TEST(test_ipc_txrx_us_timeout) + { + qb_enter(); + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_txrx_timeout(); + qb_leave(); + } +@@ -753,7 +765,7 @@ START_TEST(test_ipc_txrx_shm_tmo) + qb_enter(); + turn_on_fc = QB_FALSE; + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + recv_timeout = 1000; + test_ipc_txrx(); + qb_leave(); +@@ -765,7 +777,7 @@ START_TEST(test_ipc_txrx_shm_block) + qb_enter(); + turn_on_fc = QB_FALSE; + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + recv_timeout = -1; + test_ipc_txrx(); + qb_leave(); +@@ -778,7 +790,7 @@ START_TEST(test_ipc_fc_shm) + turn_on_fc = QB_TRUE; + ipc_type = QB_IPC_SHM; + recv_timeout = 500; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_txrx(); + qb_leave(); + } +@@ -789,7 +801,7 @@ START_TEST(test_ipc_txrx_us_block) + qb_enter(); + turn_on_fc = QB_FALSE; + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + recv_timeout = -1; + test_ipc_txrx(); + qb_leave(); +@@ -801,7 +813,7 @@ START_TEST(test_ipc_txrx_us_tmo) + qb_enter(); + turn_on_fc = QB_FALSE; + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + recv_timeout = 1000; + test_ipc_txrx(); + qb_leave(); +@@ -814,7 +826,7 @@ START_TEST(test_ipc_fc_us) + turn_on_fc = QB_TRUE; + ipc_type = QB_IPC_SOCKET; + recv_timeout = 500; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_txrx(); + qb_leave(); + } +@@ -869,7 +881,7 @@ START_TEST(test_ipc_disp_us) + { + qb_enter(); + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_dispatch(); + qb_leave(); + } +@@ -1136,7 +1148,7 @@ START_TEST(test_ipc_stress_test_us) + qb_enter(); + send_event_on_created = QB_FALSE; + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_stress_test(); + qb_leave(); + } +@@ -1146,7 +1158,7 @@ START_TEST(test_ipc_stress_connections_us) + { + qb_enter(); + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_stress_connections(); + qb_leave(); + } +@@ -1157,7 +1169,7 @@ START_TEST(test_ipc_bulk_events_us) + qb_enter(); + send_event_on_created = QB_FALSE; + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_bulk_events(); + qb_leave(); + } +@@ -1213,7 +1225,7 @@ START_TEST(test_ipc_event_on_created_us) + qb_enter(); + send_event_on_created = QB_TRUE; + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_event_on_created(); + qb_leave(); + } +@@ -1275,7 +1287,7 @@ START_TEST(test_ipc_disconnect_after_created_us) + qb_enter(); + disconnect_after_created = QB_TRUE; + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_disconnect_after_created(); + qb_leave(); + } +@@ -1314,7 +1326,7 @@ START_TEST(test_ipc_server_fail_soc) + { + qb_enter(); + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_server_fail(); + qb_leave(); + } +@@ -1324,7 +1336,7 @@ START_TEST(test_ipc_disp_shm) + { + qb_enter(); + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_dispatch(); + qb_leave(); + } +@@ -1335,7 +1347,7 @@ START_TEST(test_ipc_stress_test_shm) + qb_enter(); + send_event_on_created = QB_FALSE; + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_stress_test(); + qb_leave(); + } +@@ -1345,7 +1357,7 @@ START_TEST(test_ipc_stress_connections_shm) + { + qb_enter(); + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_stress_connections(); + qb_leave(); + } +@@ -1355,7 +1367,7 @@ START_TEST(test_ipc_bulk_events_shm) + { + qb_enter(); + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_bulk_events(); + qb_leave(); + } +@@ -1366,7 +1378,7 @@ START_TEST(test_ipc_event_on_created_shm) + qb_enter(); + send_event_on_created = QB_TRUE; + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_event_on_created(); + qb_leave(); + } +@@ -1376,7 +1388,7 @@ START_TEST(test_ipc_server_fail_shm) + { + qb_enter(); + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_server_fail(); + qb_leave(); + } +@@ -1417,7 +1429,7 @@ START_TEST(test_ipc_service_ref_count_shm) + { + qb_enter(); + ipc_type = QB_IPC_SHM; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_service_ref_count(); + qb_leave(); + } +@@ -1427,7 +1439,7 @@ START_TEST(test_ipc_service_ref_count_us) + { + qb_enter(); + ipc_type = QB_IPC_SOCKET; +- ipc_name = __func__; ++ set_ipc_name(__func__); + test_ipc_service_ref_count(); + qb_leave(); + } +@@ -1620,6 +1632,7 @@ main(void) + Suite *s; + int32_t do_shm_tests = QB_TRUE; + ++ set_ipc_name("ipc_test"); + #ifdef DISABLE_IPC_SHM + do_shm_tests = QB_FALSE; + #endif /* DISABLE_IPC_SHM */ +-- +1.8.4.2 + diff --git a/SOURCES/bz1211375-libqb-poll-fix.patch b/SOURCES/bz1211375-libqb-poll-fix.patch new file mode 100644 index 0000000..be0a341 --- /dev/null +++ b/SOURCES/bz1211375-libqb-poll-fix.patch @@ -0,0 +1,25 @@ +From b6f000f237eccf13ac3a1f2902d1fec8794e88cd Mon Sep 17 00:00:00 2001 +From: David Vossel +Date: Tue, 14 Apr 2015 11:52:59 -0400 +Subject: [PATCH 1/4] High: loop: fixes resource starvation in mainloop code + +--- + lib/loop_poll.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/loop_poll.c b/lib/loop_poll.c +index 49c9650..117a276 100644 +--- a/lib/loop_poll.c ++++ b/lib/loop_poll.c +@@ -110,7 +110,7 @@ _poll_dispatch_and_take_back_(struct qb_loop_item *item, + pe->item.user_data); + if (res < 0) { + _poll_entry_mark_deleted_(pe); +- } else { ++ } else if (pe->state != QB_POLL_ENTRY_DELETED) { + pe->state = QB_POLL_ENTRY_ACTIVE; + pe->ufd.revents = 0; + } +-- +1.8.4.2 + diff --git a/SPECS/libqb.spec b/SPECS/libqb.spec index d23b271..aaa79d8 100644 --- a/SPECS/libqb.spec +++ b/SPECS/libqb.spec @@ -1,6 +1,6 @@ Name: libqb Version: 0.17.1 -Release: 1%{?dist}.1 +Release: 1%{?dist}.2 Summary: An IPC library for high performance servers Group: System Environment/Libraries @@ -9,6 +9,10 @@ URL: http://www.libqb.org Source0: https://fedorahosted.org/releases/q/u/quarterback/%{name}-%{version}.tar.xz Patch1: bz1198718-libqb-realtime-priority-fix.patch +Patch2: bz1211375-ipc-test-update1.patch +Patch3: bz1211375-ipc-test-update2.patch +Patch4: bz1211375-ipc-test-update3.patch +Patch5: bz1211375-libqb-poll-fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -23,6 +27,10 @@ Initially these are IPC and poll. %prep %setup -q %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 # work-around for broken epoll in rawhide/f17 %build @@ -72,6 +80,11 @@ developing applications that use %{name}. %changelog +* Thu Apr 16 2015 David Vossel - 0.17.1-1.2 + Fixes assert encountered in libqb's mainloop implementation. + + Resolves: rhbz#1212297 + * Thu Mar 05 2015 David Vossel - 0.17.1-1.1 Fix bug that prevents ipc server from working in pid with realtime priority.