xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Lots of connections led oxenstored stuck
@ 2014-08-08  7:01 Joe Jin
  2014-08-08  8:35 ` Liuqiming (John)
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Jin @ 2014-08-08  7:01 UTC (permalink / raw)
  To: David Scott, Luis R. Rodriguez, Ian Jackson; +Cc: xen-devel

Hi,

During internal test on Xen-4.3-stable we found sometime when restarted
Xen, it stuck and does not response any request, xenstored.log filled
out below stuff:
[20140702T21:00:41.564Z|error|xenstored] caught exception Unix.Unix_error(15, "accept", "")

I created reproducer which will create 2000 connections to oxenstored, after
ran the reproducer, "xm list --long" will stuck, oxenstored does not
response anymore, same test case passed when use xenstored, any input
will appreciate! 

/* 
 * This program used to test oxenstored connections stuck issue.
 * please compile by below command:
 *	gcc -o client client.c -lpthread
 */
#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <stdlib.h>
#include <errno.h>


void *main_thread(void *arg)
{
	struct sockaddr_un address;
	int socket_fd, nbytes;
	char buffer[256];
	int i;
	extern int errno;

	memcpy(&i, arg, sizeof(i));
	socket_fd = socket(PF_UNIX, SOCK_STREAM, 0);
	if (socket_fd < 0) {
		fprintf(stderr, "socket() %dth failed, errno=%d\n", i, errno);
		return;
	}
	fprintf(stderr, "socket() %dth ok!\n", i);

	/* start with a clean address structure */
	memset(&address, 0, sizeof(struct sockaddr_un));

	address.sun_family = AF_UNIX;
	snprintf(address.sun_path, 1024, "/var/run/xenstored/socket");

	if (connect(socket_fd,
		    (struct sockaddr *) &address,
		    sizeof(struct sockaddr_un)) != 0) {
		fprintf(stderr, "connect() %d failed, error=%d", i, errno);
		return;
	}
	fprintf(stderr, "connec() %dth ok!\n", i);

	while (1)
		sleep(1);
	if (arg) {
		free(arg);
		arg = NULL;
	}

	return;
}

int main(void)
{
	int i;
	for (i = 0; i < 2000; i++) {
		void *arg = malloc(sizeof(i));
		memset(arg, 0, sizeof(i));
		memcpy(arg, &i, sizeof(i));
		pthread_t thread;
		if (pthread_create(&thread, NULL, main_thread, arg) != 0) {
			perror("pthread_create:");
			break;
		}
	}
	/* Wait all children exit */
	sleep(3);
	return 0;
}
/* end */

Thanks,
Joe

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-08-27 10:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08  7:01 Lots of connections led oxenstored stuck Joe Jin
2014-08-08  8:35 ` Liuqiming (John)
2014-08-08  9:37   ` Dave Scott
2014-08-11  0:35     ` Joe Jin
2014-08-11  9:41       ` Dave Scott
2014-08-12  0:19         ` Joe Jin
2014-08-14  8:33           ` Joe Jin
2014-08-26  8:15           ` Joe Jin
2014-08-26  9:02             ` Zheng Li
2014-08-27  1:59               ` Joe Jin
2014-08-27 10:16                 ` Zheng Li
2014-08-11 16:58     ` Zheng Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).