[Date Prev][Date Next] [Chronological] [Thread] [Top]

ldap_unbind_s crashes, iphone

Hi, I am using the OpenLDAP SDK for an iPhone project.
On the iPhone 4, applications can go into the background (in a frozen
state) and then come back to the foreground.

When the app comes to the foreground, I do a unbind and then
reconnect, to ensure I have a good connection (the LDAP server could
do idle time out...). Sometimes, this ldap_unbind_s crashes the app,
as noted below in the code and logs:

      if (LDAPServer)
              NSLog(@"ldap_unbind_s req: %@", description);
              NSLog(@"ldap_unbind_s completed: %@", description);
      LDAPServer = NULL;

Fri Oct 22 21:35:01 unknown CloudFace[780] <Warning>: ldap_unbind_s
req: Entic.net
Fri Oct 22 21:35:01 unknown com.apple.launchd[1] <Warning>:
(UIKitApplication:net.entic.cf[0xb4bf]) Exited abnormally: Broken pipe
Fri Oct 22 21:35:01 unknown SpringBoard[26] <Warning>: Application
'CloudFace' exited abnormally with signal 13: Broken pipe

How should I handle proper unbind operation for this?
I could just skip the whole unbind operation, and then make a *new*
connection when the app is brought to the foreground and skip the
whole ldap_unbind_s call. Is that the recommended action?

Remember, the app can be in the background for just a few seconds or
could be hours (when the connection would be dropped). I am trying to
avoid having to make new connections repeatedly.

I also have a method, setupServer() that is something like this:

+ (void) setupServer:(Server *)server {
      if ([server LDAPServer])
              NSLog(@"setupServer skipped... connection exists");

I have idle timeout set to 5 minutes on the LDAP server. Sometimes,
even after 5-10 minutes, it doesn't crash, but sometimes it does...
and it always seems to be in the ldap_unbind_s, I think.