From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 6 Dec 2006 07:04:07 -0800 (PST) From: mani bhatti In-Reply-To: <45463851.3030202@domain.hid> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-984976661-1165417447=:36703" Content-Transfer-Encoding: 8bit Message-ID: <995989.36703.qm@domain.hid> Subject: [Xenomai-help] problem persists with rt_queue List-Id: Help regarding installation and common use of Xenomai List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: xenomai@xenomai.org --0-984976661-1165417447=:36703 Content-Type: multipart/alternative; boundary="0-1422083311-1165417447=:36703" --0-1422083311-1165417447=:36703 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi I had a problem of rt_queue overflow in xenomai 2.1.Then installed xenomai 2.2.5 but previous poblem with rt_queue is still there.I repeat the problem that when there is no listener on the queue the sender the sender displays the error message rt_queue_send(queue_input) failed sent bytes: 0 rt_queue_send(queue_input) failed sent bytes: 0 rt_queue_send(queue_input) failed sent bytes: 0 rt_queue_alloc(queue_inout, 8) failed and then stops and if i try to start my program again following message start rt_queue_alloc(queue_inout, 8) failed Segmentation fault is displayed and program doesnot work at all.I would be very thankful for the correcting me what wrong am i doing.the code for the sender is attached. Jan Kiszka wrote: mani bhatti wrote: > Thanks Jan . > I have executed # patch -p0 < native-queue-bcast-fix.patch in directory where xenomai is installed and in my case it is /usr/xenomai directory but sender still goes out of memory if no listener is waiting on the queue and displays the message > > rt_queue_alloc(queue_inout, 8) failed > > After this message is displayed and i try to execute sender again then sender doesnot execute at all and simply displays above message so i need to restart my computer if i want to eecute sender again .Should i execute patch in some other directory or is it some other problem? Nope. Executing your original test case after applying my patch (AND rebuilding Xenomai - did you check if the kernel you run got updated?) clearly demonstrated on my box that the problem was fixed. I would suggest to do a clean rebuild from latest SVN. Jan --------------------------------- Any questions? Get answers on any topic at Yahoo! Answers. Try it now. --0-1422083311-1165417447=:36703 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi
I had a problem of rt_queue overflow in xenomai 2.1.Then installed xenomai 2.2.5 but previous poblem with rt_queue is still there.I repeat the problem that when there is no listener on the queue the sender the sender displays the error message

rt_queue_send(queue_input) failed sent bytes: 0
rt_queue_send(queue_input) failed sent bytes: 0
rt_queue_send(queue_input) failed sent bytes: 0
rt_queue_alloc(queue_inout, 8) failed


 and then stops and if i try to start my program again following message

start
rt_queue_alloc(queue_inout, 8) failed
Segmentation fault

is displayed and program doesnot work at all.I would be very thankful for the correcting me what wrong am i doing.the code for the sender is attached.


Jan Kiszka <jan.kiszka@domain.hid> wrote:
mani bhatti wrote:
> Thanks Jan .
> I have executed # patch -p0 < native-queue-bcast-fix.patch in directory where xenomai is installed and in my case it is /usr/xenomai directory but sender still goes out of memory if no listener is waiting on the queue and displays the message
>
> rt_queue_alloc(queue_inout, 8) failed
>
> After this message is displayed and i try to execute sender again then sender doesnot execute at all and simply displays above message so i need to restart my computer if i want to eecute sender again .Should i execute patch in some other directory or is it some other problem?

Nope. Executing your original test case after applying my patch (AND
rebuilding Xenomai - did you check if the kernel you run got updated?)
clearly demonstrated on my box that the problem was fixed.

I would suggest to do a clean rebuild from latest SVN.

Jan



Any questions? Get answers on any topic at Yahoo! Answers. Try it now. --0-1422083311-1165417447=:36703-- --0-984976661-1165417447=:36703 Content-Type: text/x-csrc; name="queue_sender.c" Content-Description: 3236561751-queue_sender.c Content-Disposition: inline; filename="queue_sender.c" #include #include #include #include #include #include #include #include #include #include #include #include #define STACK_SIZE 8192 #define STD_PRIO1 2 #define STD_PRIO2 1 #define QUEUE_INPUT_LEN 1024 #define USE_READ_WRITE RT_TASK zaehler1_task_ptr; RT_TASK zaehler2_task_ptr; int count1 = 0; int count2 = 0; int i; int end = 0; typedef struct { int counter; int data; }TInputData; int missedpackets=0; RT_QUEUE queue_input; // --s-ms-us-ns RTIME task_period_ns1 = 10000000llu; RTIME task_period_ns2 = 10000000000llu; void zaehler1_task(void *cookie){ int ret; TInputData sendData; memset(&sendData, 0, sizeof(TInputData)); // ************************* Xenomai-Krempel ******************************************************************** ret = rt_task_set_periodic(NULL, TM_NOW, rt_timer_ns2ticks(task_period_ns1)); if (ret) { printf("error while set periodic, code %d\n",ret); return; } // ************************* Ende Xenomai-Krempel **************************************************************** // ********************** Beginn des wiederholt ausgefuehrten Codes ********************************************** while(!end){ rt_task_wait_period(NULL); void *msg = rt_queue_alloc(&queue_input, sizeof(TInputData)); if(msg == NULL) { printf("rt_queue_alloc(queue_inout, %d) failed\n", sizeof(TInputData)); } memcpy(msg, &sendData, sizeof(TInputData)); int bytesSent = rt_queue_send(&queue_input, msg,sizeof(TInputData), Q_BROADCAST); if (bytesSent <= 0) { printf("rt_queue_send(queue_input) failed sent bytes: %d\n", bytesSent); rt_queue_free(&queue_input, msg); } sendData.counter++; } // ********************** Ende des wiederholt ausgefuehrten Codes *********************************************** } // signal-handler, to ensure clean exit on Ctrl-C void clean_exit(int dummy) { printf("cleanup\n"); end = 1; rt_task_delete(&zaehler1_task_ptr); rt_task_delete(&zaehler2_task_ptr); printf("end\n"); } int main(int argc, char *argv[]) { int err, ret; int res; res = mlockall(MCL_CURRENT | MCL_FUTURE); if (res < 0) { printf("mlockall failed: %d\n", res); } // INPUT_QUEUE res = rt_queue_create(&queue_input, "queue_input", sizeof(TInputData) * QUEUE_INPUT_LEN, QUEUE_INPUT_LEN, Q_FIFO | Q_SHARED); if (res == -EEXIST) { res = rt_queue_bind(&queue_input, "queue_input", 1000); //rt_queue_clear(&queue_input); } if (res < 0) { printf("rt_queue_create(queue_input) failed: %d\n", res); } printf("start\n"); // install signal handler signal(SIGTERM, clean_exit); signal(SIGINT, clean_exit); /* create zaehler1_task */ err = rt_task_create(&zaehler1_task_ptr,"alpha",STACK_SIZE,STD_PRIO1,0); /* start zaehler1_task */ err = rt_task_start(&zaehler1_task_ptr,&zaehler1_task,NULL); // wait for signal & return of signal handler pause(); fflush(NULL); return 0; } --0-984976661-1165417447=:36703--