[lttng-dev] Unable to make lttng run for multiple instances in parallel
Chidhu R
chid1989 at gmail.com
Wed Mar 18 12:30:10 EDT 2015
Hello,
When I try to execute the following code, I always run into errors. Can
someone help me.
Code:
int lttng_init() {
int err;
int l_fd = -1;
if(0 != system("mkdir /tmp/mk_lttng")) {
printf("Directory exists\n");
}
setenv("LTTNG_HOME", "/tmp/mk_lttng", 1);
fprintf(stderr, "LTTNG_HOME is %s\n",getenv("LTTNG_HOME"));
l_fd = open("/tmp/lttng_test.lck", O_CREAT | O_WRONLY | O_EXCL,
0644);
err = errno;
if(l_fd != -1) {
fprintf(stderr, "Creating lock file l_fd = %d\n", l_fd);
if(0 != system("lttng destroy -a")) {
return -1;
}
if(0 != system("lttng create")) {
return -1;
}
if(0 != system("lttng enable-event -u -a")) {
return -1;
}
if(0 != system("lttng start")) {
return -1;
}
}
else {
fprintf(stderr, "Unable to get lock err = %d\n",err);
// Someone has already created a session. We just dump into
their buffer
}
}
int main() {
if( -1 == lttng_init())
assert(0);
}
When I compile and run the above code, I am getting these errors.
cycl01:~/hello-tp% ./hello
mkdir: cannot create directory `/tmp/mk_lttng': File exists
Directory exists
LTTNG_HOME is /tmp/mk_lttng
Creating lock file l_fd = 4
Spawning a session daemon
I/O warning : failed to load external entity
"/usr/share/xml/lttng/session.xsd"
XML Error: Failed to locate the main schema resource at
'/usr/share/xml/lttng/session.xsd'.
Error: XSD parsing failed
Error: Session load failed: Invalid session configuration
No session found, nothing to do.
*PERROR - 09:20:36.889067 [7142/7150]: bind inet: Address already in use
(in lttcomm_bind_inet_sock() at inet.c:109)*
*Warning: Another session daemon is using this JUL port. JUL support will
be deactivated to prevent interfering with the tracing. *
*I am trying to run multiple of these programs in parallel*. So I am trying
to incorporate a locking mechanism so that only one instance succeeds and
creates the session, and other instances just dump into the existing
session.
Thanks
Chid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150318/f0d7166c/attachment.html>
More information about the lttng-dev
mailing list