# Cocoa - NSTimer stops repeating in 1 hour



## Jollyprez (Mar 20, 2006)

Hello, 

I have an application that requires it to notify a central server that it is still running. It does this through a webservice, passing enough information to the webservice to say, "Here I am".

The application is a very small cocoa application, and I use an NSTimer repeating every 15 seconds. Invariably, after almost exactly an hour - the program stops accessing the webservice.

It isn't related to sleeping or lack of use - I have tested for that. But the NSTimer just stops. No errors are encountered that I can find, either.

Any ideas about this? Should I be using another call? This app is basically a daemon that must be on 24/7.

Thanks,

Jolly


----------



## ksv (Mar 24, 2006)

Are you sure it's the timer that stops, rather than the application e.g. dropping the connection? You could test that by writing a message to the log on every iteration and see if it continues after an hour, when it stops sending messages.
Have you tried to run the program for an hour on another computer?


----------



## Jollyprez (Mar 25, 2006)

Well, after further debugging - it turns out the NSTimer is going strong, but the 	result = (NSDictionary *)WSMethodInvocationInvoke(soapCall);
is crapping out after exactly 248 iterations - no matter what the interval I'm using.

It returns a CFStreamFault - error -65794

I can't seem to find what that number means. Arg.


Jolly


----------



## lurk (Mar 26, 2006)

My bet is that you are not properly closing the connection and leaking a file handle o each iteration.  That is a 5 second diagnosis so take it for what it is worth


----------

