Multithreaded RPC server failed using TCP client (Redhat)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Not knowing anything about your code or the implementation
details ... tcp maintains state, udp doesn't. Are you missing
state handling in your code, does one thread not know the
state of a connection a previous/different thread established?
I am creating a Multi-threaded RPC server on linux version ( Red Hat Enterprise Linux ES release 3 (Taroon), redhat kernal release 2.4.21-4.ELsmp, version #1 SMP Fri Oct 3 17:52:56 EDT 2003 ) where-in i am following the example as stated @ the url: http://www.linuxquestions.org/questi...riting-188816/
Upon each request, a new thread is created and we assign the struct svc_req *rqstp & register SVCXPRT *transp parameters to the thread data.
The problems occurs when calling svc_getargs, most of the times it throws the error RPC:Server can't decode arguments to the client. Sporadically it does seems to work though.
From the client, we use TCP transport to connect to this RPC server and we transmit very less amount of data, less than 250 bytes. However the problem magically disappears when we use UDP as transport mechanism from the client.
On linux machine the rpcgen command we used to generate MT-safe code doesn't do much to the stubs generated, apart from changing result as an argument to the functions.
Can you please shed some light as to where i could be going wrong or is there any else i need to consider when writing the code.
Last edited by yadavamitesh; 05-12-2009 at 11:29 AM.
@yadavamitesh: did you find a solution for your problem?!
i try to find one for this problem, too! so i know your problem
please let me know, if you found a solution!!
a possible solution of me:
try to develop your own svc_run() method and then handle the requests. my problem is, that i get an error the svc_getreqset() or an segmentation fault in the svc_getreq_common() method when i start the thread! i don't know how to solve this.
However, by the looks of it, seems lot of work
I am trying to find if i can upgrade to a new version of library/OS -or- as last resort "yes" implement my own svc_run. But looks like libnsl is part of glibc and we need to upgrade the whole thing !!!
Please correct me if my understanding is wrong in this regard!
Any insights would be helpful.
svc_getreqset() calls the remote procedure. So the idea is to put the function into a thread.
But as soon as i call the svc_getreqset() function in a thread, i get a segmentation fault in svc_getreq_common(), which will be called after svc_getreqset().
So if you search for the function, you will find the information that svc_getreqset() is NOT thread-safe. Even if you try to protect getreqset() with mutexes, it won't work.
Maybe i overlooked something and you will find it.