CPG clients that run as normal priority can be starved by aisexec in
certain environments from being scheduled. This results in overflow of
the IPC connection disconnecting the client.
This patch forces the outbound thread to schedule at the same priority
as the rest of aisexec removing the server issue relating to this
problem.
Regards
-steve
Index: test/Makefile
===================================================================
--- test/Makefile (revision 1651)
+++ test/Makefile (working copy)
@@ -83,8 +83,8 @@
testevt: testevt.o sa_error.o $(LIBRARIES)
$(CC) $(LDFLAGS) -o testevt testevt.o sa_error.o $(LIBS)
-testevs: testevs.o $(LIBS)
- $(CC) $(LDFLAGS) -o testevs testevs.o $(LIBS)
+testevs: testevs.o $(LIBS) ../exec/crypto.o
+ $(CC) $(LDFLAGS) -o testevs testevs.o $(LIBS) ../exec/crypto.o
testevsth: testevsth.o $(LIBS)
$(CC) $(LDFLAGS) -o testevsth testevsth.o $(LIBS)
Index: test/testevs.c
===================================================================
--- test/testevs.c (revision 1651)
+++ test/testevs.c (working copy)
@@ -38,21 +38,41 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
+#include <string.h>
#include "../include/evs.h"
+#include "../exec/crypto.h"
char *delivery_string;
+struct msg {
+ unsigned int msg_size;
+ unsigned char sha1[20];
+ unsigned char buffer[0];
+};
int deliveries = 0;
void evs_deliver_fn (
unsigned int nodeid,
- void *msg,
+ void *m,
int msg_len)
{
- char *buf = msg;
+ struct msg *msg2 = (struct msg *)m;
+ unsigned char sha1_compare[20];
+ hash_state sha1_hash;
+ unsigned int i;
-// buf += 100000;
-// printf ("Delivery callback\n");
- printf ("API '%s' msg '%s'\n", delivery_string, buf);
+ printf ("API '%s' msg '%s'\n", delivery_string, msg2->buffer);
+ sha1_init (&sha1_hash);
+ sha1_process (&sha1_hash, msg2->buffer, msg2->msg_size);
+ sha1_done (&sha1_hash, sha1_compare);
+printf ("SIZE %d HASH: ", msg2->msg_size);
+for (i = 0; i < 20; i++) {
+printf ("%x", sha1_compare[i]);
+}
+printf ("\n");
+ if (memcmp (sha1_compare, msg2->sha1, 20) != 0) {
+ printf ("incorrect hash\n");
+ exit (1);
+ }
deliveries++;
}
@@ -90,21 +110,21 @@
{ "key3" }
};
+struct msg msg;
+
char buffer[200000];
-struct iovec iov = {
- .iov_base = buffer,
- .iov_len = sizeof (buffer)
-};
-
int main (void)
{
evs_handle_t handle;
evs_error_t result;
- int i = 0;
+ unsigned int i = 0, j;
int fd;
unsigned int member_list[32];
unsigned int local_nodeid;
int member_list_entries = 32;
+ struct msg msg;
+ hash_state sha1_hash;
+ struct iovec iov[2];
result = evs_initialize (&handle, &callbacks);
if (result != EVS_OK) {
@@ -128,27 +148,34 @@
printf ("Leave result %d\n", result);
delivery_string = "evs_mcast_joined";
+ iov[0].iov_base = &msg;
+ iov[0].iov_len = sizeof (struct msg);
+ iov[1].iov_base = buffer;
+
/*
* Demonstrate evs_mcast_joined
*/
- for (i = 0; i < 500; i++) {
- sprintf (buffer, "evs_mcast_joined: This is message %d", i);
-#ifdef COMPILE_OUT
- sprintf (buffer,
- "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d",
- i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i,
- i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i);
-#endif
+ for (i = 0; i < 1000000000; i++) {
+ msg.msg_size = 100 + rand() % 100000;
+ iov[1].iov_len = msg.msg_size;
+ for (j = 0; j < msg.msg_size; j++) {
+ buffer[j] = j;
+ }
+ sprintf ((char *)buffer,
+ "evs_mcast_joined: This is message %12d", i);
+ sha1_init (&sha1_hash);
+ sha1_process (&sha1_hash, buffer, msg.msg_size);
+ sha1_done (&sha1_hash, msg.sha1);
try_again_one:
result = evs_mcast_joined (handle, EVS_TYPE_AGREED,
- &iov, 1);
+ iov, 2);
if (result == EVS_ERR_TRY_AGAIN) {
-//printf ("try again\n");
goto try_again_one;
}
result = evs_dispatch (handle, EVS_DISPATCH_ALL);
}
+#ifdef TODO
do {
result = evs_dispatch (handle, EVS_DISPATCH_ALL);
} while (deliveries < 20);
@@ -157,7 +184,7 @@
*/
delivery_string = "evs_mcast_groups";
for (i = 0; i < 500; i++) {
- sprintf (buffer, "evs_mcast_groups: This is message %d", i);
+ iov.iov_len = sprintf (buffer, "evs_mcast_groups: This is message %d", i);
try_again_two:
result = evs_mcast_groups (handle, EVS_TYPE_AGREED,
&groups[1], 1, &iov, 1);
@@ -167,12 +194,13 @@
result = evs_dispatch (handle, EVS_DISPATCH_ALL);
}
+#endif
/*
* Flush any pending callbacks
*/
do {
result = evs_dispatch (handle, EVS_DISPATCH_ALL);
- } while (deliveries < 900);
+ } while (deliveries < 20000);
evs_fd_get (handle, &fd);
Index: exec/evs.c
===================================================================
--- exec/evs.c (revision 1651)
+++ exec/evs.c (working copy)
@@ -263,11 +263,6 @@
list_init (&evs_pd->list);
list_add (&evs_pd->list, &confchg_notify);
- openais_dispatch_send (
- conn,
- &res_evs_confchg_callback,
- sizeof (res_evs_confchg_callback));
-
return (0);
}
Index: exec/ipc.c
===================================================================
--- exec/ipc.c (revision 1652)
+++ exec/ipc.c (working copy)
@@ -586,8 +586,8 @@
struct sched_param sched_param;
int res;
- sched_param.sched_priority = 1;
-// res = pthread_setschedparam (conn_io->thread, SCHED_RR, &sched_param);
+ sched_param.sched_priority = 99;
+ res = pthread_setschedparam (conn_io->thread, SCHED_RR, &sched_param);
ufd.fd = conn_io->fd;
for (;;) {
Index: exec/totemsrp.c
===================================================================
--- exec/totemsrp.c (revision 1651)
+++ exec/totemsrp.c (working copy)
@@ -619,7 +619,7 @@
list_init (&instance->token_callback_sent_listhead);
- instance->my_received_flg = 0;
+ instance->my_received_flg = 1;
instance->my_token_seq = SEQNO_START_TOKEN - 1;
@@ -1678,7 +1678,7 @@
"entering OPERATIONAL state.\n");
instance->memb_state = MEMB_STATE_OPERATIONAL;
- instance->my_received_flg = 0;
+ instance->my_received_flg = 1;
return;
}
@@ -2626,6 +2626,8 @@
{
struct srp_addr *addr;
struct memb_commit_token_memb_entry *memb_list;
+ unsigned int high_aru;
+ unsigned int i;
addr = (struct srp_addr *)commit_token->end_of_commit_token;
memb_list = (struct memb_commit_token_memb_entry *)(addr + commit_token->addr_entries);
@@ -2647,9 +2649,45 @@
instance->my_received_flg =
(instance->my_aru == instance->my_high_seq_received);
- memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered;
+log_printf (instance->totemsrp_log_level_notice, "%d %d %d\n", instance->my_aru, instance->my_high_seq_received, instance->my_received_flg);
+
memb_list[commit_token->memb_index].received_flg = instance->my_received_flg;
+ memb_list[commit_token->memb_index].high_delivered = instance->my_high_delivered;
+ /*
+ * find high aru up to current memb_index for all matching ring ids
+ * if any ring id matching memb_index has aru less then high aru set
+ * received flag for that entry to false
+ * TODO do proper window comparisons
+ */
+ high_aru = memb_list[commit_token->memb_index].aru;
+ for (i = 0; i <= commit_token->memb_index; i++) {
+ if (memcmp (&memb_list[commit_token->memb_index].ring_id,
+ &memb_list[i].ring_id,
+ sizeof (struct memb_ring_id)) == 0) {
+
+ if (high_aru < memb_list[i].aru) {
+ high_aru = memb_list[i].aru;
+ }
+ }
+ }
+
+ for (i = 0; i <= commit_token->memb_index; i++) {
+ if (memcmp (&memb_list[commit_token->memb_index].ring_id,
+ &memb_list[i].ring_id,
+ sizeof (struct memb_ring_id)) == 0) {
+
+ if (high_aru > memb_list[i].aru) {
+ memb_list[i].received_flg = 0;
+ if (i == commit_token->memb_index) {
+ instance->my_received_flg = 0;
+ }
+log_printf (instance->totemsrp_log_level_notice, "setting received flag to false for index %d\n", i);
+ }
+ }
+ }
+
+
commit_token->header.nodeid = instance->my_id.addr[0].nodeid;
commit_token->memb_index += 1;
assert (commit_token->memb_index <= commit_token->addr_entries);
Index: Makefile.inc
===================================================================
--- Makefile.inc (revision 1651)
+++ Makefile.inc (working copy)
@@ -54,7 +54,7 @@
# OPENAIS_BUILD can be defined as RELEASE or DEBUG
#
ifndef OPENAIS_BUILD
- OPENAIS_BUILD=RELEASE
+ OPENAIS_BUILD=DEBUG
endif
# OPENAIS_PROFILE
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais