Ricardo Galli
2004-Aug-06 14:57 UTC
[icecast-dev] PROBLEM REPORT (and example): EPIPE errors
This small example will make icecast unusable after few seconds. The problem resides on EPIPE received when trying to send the first (58) bytes of the vorbis predata. Change the URL for your own, and try it in a LAN. I have no idea on the reasons of these errors, altough I suspect it's related to the fact that the headers are sent in blocking state and then we change to non-blocking. I will try to put all headers in a refbuf and append it to the client queue. for i in `seq 100` do echo $i timelimit -s 3 wget -q http://mcrg.uib.es:8000/live.ogg & timelimit -s 3 wget -q http://mcrg.uib.es:8000/live.ogg & timelimit -s 3 wget -q http://mcrg.uib.es:8000/live.ogg done <p>(timelimit is a small program in C to limit the execution of the command to 3 wallclock seconds). /****** timelimit.c *******/ #include <stdlib.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> <p><p>pid_t pid, ended=0; void wakeup(int s) { printf("Signal %d received\n", s); kill(pid, SIGTERM); } usage() { printf("timelimit {-s secs | -m mins} commands arg1 arg2...\n"); exit(1); } <p>main(int argc, char *argv[]) { int i, seconds = -1; i = 1; if (argc > 3) { if (strcmp(argv[i], "-s") == 0) seconds = atoi(argv[i+1]); else if (strcmp(argv[i], "-m") == 0) seconds = atoi(argv[i+1]) * 60; } if (seconds <= 0) usage(); if((pid = fork()) == 0) { execvp(argv[3], &argv[3]); printf("Error in exec\n"); exit(1); } <p> signal(SIGALRM, wakeup); alarm(seconds); while(ended != pid) { ended = wait(NULL); } } <p><p> -- ricardo "I just stopped using Windows and now you tell me to use Mirrors?" - said Aunt Tillie, just before downloading 2.5.3 kernel. --- >8 ---- List archives: http://www.xiph.org/archives/ icecast project homepage: http://www.icecast.org/ To unsubscribe from this list, send a message to 'icecast-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Ricardo Galli
2004-Aug-06 14:57 UTC
[icecast-dev] PROBLEM REPORT (and example): EPIPE errors (PATCH)
Find attached a patch which solves the (serious) bug reported days ago. The problem resided on the conditional variable being signaled twice (or more) after new connections, but the server thread (connection.c) only get the first of the several new connections. The patch just added a while() to check for more new connections, but I don't like because the code in already too much indented. Nevertheless, it solves the problem. Regards, -- ricardo "I just stopped using Windows and now you tell me to use Mirrors?" - said Aunt Tillie, just before downloading 2.5.3 kernel. On 03/03/02 17:32, Ricardo Galli shaped the electrons to say:> This small example will make icecast unusable after few seconds. The > problem resides on EPIPE received when trying to send the first (58) bytes > of the vorbis predata. > > Change the URL for your own, and try it in a LAN. > > I have no idea on the reasons of these errors, altough I suspect it's > related to the fact that the headers are sent in blocking state and then we > change to non-blocking. I will try to put all headers in a refbuf and > append it to the client queue. > > for i in `seq 100` > do echo $i > timelimit -s 3 wget -q http://mcrg.uib.es:8000/live.ogg & > timelimit -s 3 wget -q http://mcrg.uib.es:8000/live.ogg & > timelimit -s 3 wget -q http://mcrg.uib.es:8000/live.ogg > done > > > (timelimit is a small program in C to limit the execution of the command to > 3 wallclock seconds). > > /****** > timelimit.c > *******/ > #include <stdlib.h> > #include <signal.h> > #include <sys/types.h> > #include <sys/wait.h> > #include <unistd.h> > > > > pid_t pid, ended=0; > > void wakeup(int s) > { > printf("Signal %d received\n", s); > kill(pid, SIGTERM); > } > > usage() > { > printf("timelimit {-s secs | -m mins} commands arg1 arg2...\n"); > exit(1); > } > > > main(int argc, char *argv[]) > { > int i, seconds = -1; > > i = 1; > if (argc > 3) { > if (strcmp(argv[i], "-s") == 0) > seconds = atoi(argv[i+1]); > else if (strcmp(argv[i], "-m") == 0) > seconds = atoi(argv[i+1]) * 60; > } > if (seconds <= 0) usage(); > > if((pid = fork()) == 0) { > execvp(argv[3], &argv[3]); > printf("Error in exec\n"); > exit(1); > } > > > signal(SIGALRM, wakeup); > alarm(seconds); > while(ended != pid) { > ended = wait(NULL); > } > > }<p> -------------- next part -------------- A non-text attachment was scrubbed... Name: patch4.diff Type: text/x-diff Size: 15515 bytes Desc: patch4.diff Url : http://lists.xiph.org/pipermail/icecast-dev/attachments/20020311/60ad6ec6/patch4.bin