UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C
  • » C 3 years old program stopped working?

#1 2009-10-21 03:16 AM

Rick
Member
Registered: 2009-10-21
Posts: 8

Re: C 3 years old program stopped working?

Hello All-

I read the forum from a long time, but it's my first post.

I have a program developed in C that basically does a lot of DNS queries in a small piece of time. The code use threads and getaddrinfo(), the code worked perfectly 3 years ago, now I needed to use it again and for my surprise it doesn't work anymore.

3 years ago, the code was very fast and requested a lot of DNS requests, now it simple get "stopped / freeze".

So I started think what changed in 3 years, one of my best guess is that DNS servers today enhance because of recent DNS vulnerabilities and now they don't accept a high load of DNS requests in sequence.

I tried to use a few sleep() and usleep() in my code to see if that was the problem, it was not able to solve the problem, however the application now works a few seconds more.

I was looking getaddrinfo() and appear that there is no timeout option to set. What I can do like a timeout option for getaddrinfo() ?

Also, do you think it could be other problem? some suggestion?

I know the basic about debug with gdb, but in this case it's not helpful. Debug threads appear complex, I set a bp at main and start the program, but when I get in the threads it appears that gdb lose the control...

Thank you.

Regards

Offline

#2 2009-10-21 11:33 AM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: C 3 years old program stopped working?

What's probably easiest is to attach gdb with the -p option when your
program freezes and get a backtrace then. Get a list of all threads with
"info threads" and switch with "thread N". Or attach and run, and do a
ctrl+c when it's stuck to give gdb control again.

Or run it through Strace, that's often more useful.

A thing to do would be to test it against a local dns server to see if it's
a problem with your code or not.

The reason why your code stopped working could be because it has a
timing related bug that only now shows up, either because of kernel
or pthread changes, or because of real SMP hardware making race
conditions easier to hit. Or it's glibc's getaddrinfo() implementation
that changed and causing you problems.

Offline

#3 2009-10-21 02:48 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,839
Website

Re: C 3 years old program stopped working?

Offline

#4 2009-10-23 07:53 PM

Rick
Member
Registered: 2009-10-21
Posts: 8

Re: C 3 years old program stopped working?

Hi!

Thanks for the suggestions, I did it and figured out the problem really is with my ISP DNS, the problem is that I tried in another ISP and the same happens, I think it's a king of limit of resources in new DNS implementations..

Thank you

Offline

  • Index
  • » C
  • » C 3 years old program stopped working?

Board footer

Powered by FluxBB