ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
the program I am running have no problem performing socket operations when it first started up. After running the program and be doing task for prolong time, the program exits.
using Strace it state that the program quits on EBADF, I can see why its getting a EBADF. why its doing a close on a incomplete read (recvfrom)? I am using Linux Datagram.
I did set ulimit -c unlimited and I did not get any core dump.
I am running the code in a embedded system. Its is possible to do a remote GDB to debug the issue. problem is this issue is 90% reproducible.
anyone has ideas why its doing a close on a unfinished read?
2. if the system is set up for remote debugging then you can use remote debugging; there are some extra things to do though, it doesn't happen magically.
3. no idea; the information you provided really doesn't tell us much so you'll have to trace through the program and look at what things might cause the failure and test which case did cause the failure. In general, when dealing with sockets you can expect them to close at any time; 'SIGPIPE' can also be generated. It is even possible for a memory management problem in your code to cause the failure. It really is up to you to debug this because it is not a problem which can be resolved with a fixed set of instructions.
3. no idea; the information you provided really doesn't tell us much so you'll have to trace through the program and look at what things might cause the failure and test which case did cause the failure. In general, when dealing with sockets you can expect them to close at any time; 'SIGPIPE' can also be generated. It is even possible for a memory management problem in your code to cause the failure. It really is up to you to debug this because it is not a problem which can be resolved with a fixed set of instructions.
+1
OP: Please list the code around, and including, the area where the recv() is being used. Perhaps it is possible that you are somehow smashing the stack where your file descriptor resides as you are reading data.
2. if the system is set up for remote debugging then you can use remote debugging; there are some extra things to do though, it doesn't happen magically.
3. no idea; the information you provided really doesn't tell us much so you'll have to trace through the program and look at what things might cause the failure and test which case did cause the failure. In general, when dealing with sockets you can expect them to close at any time; 'SIGPIPE' can also be generated. It is even possible for a memory management problem in your code to cause the failure. It really is up to you to debug this because it is not a problem which can be resolved with a fixed set of instructions.
1) don't know what number to put, so had it unlimited. unlimited is a bad thing in linux?
2) I understand that perfectly, no hoping any thing to happen magically in this world. Not asking it to happen magically too! ^^;
3) Problem is I don't know why it happen. if a SIGPIPE was to happen will STRACE capture it? I am not aware that sockets are unreliable and I have expect it to close anytime unexpectly. I will take care of it. I am not asking guru here to help me debug the problem or magically resolve my issue. I should have phrase it better, I am asking if ppl experience similar incident what approach is taken to resolve it.
yes it might be possible its a memory issue. I will spend time adding self ptr to ensure no memory are trash.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.