Dear managers, thanks to Michael Maciolek <sunman@noop.org> "Buckingham Michael K NGA-ES USA CTR" <Michael.K.Buckingham.ctr@nga.mil> Rob McMahon <Rob.McMahon@warwick.ac.uk> Tobias Nutt <tobias.nutt@gmx.de> Hindley Nick <Nick.Hindley@hfbp.co.uk> for their responses. The solution is/was to almost look for the most obvious! :-( I inserted a NSLog(@"_sock %d", _sock); if (_sock < 0) { NSLog(@"No valid socket! We are leaving ..."); return nil; } FD_ZERO(&fdset); FD_SET(_sock, &fdset); and the problem is gone. From time to time _sock is still -1 and I have no idea why. But it no longer crashes the application. Thanks a lot!! Andreas >> we have a very annoying problem on Solaris 10 that pops up every now >> and then. The FD_SET in the following code snippet causes a >> SEGMENTATION FAULT (core dumped) from time to time and then crashes >> the application. >> ... >> char *cbuf; >> int readLength; >> fd_set fdset; >> >> cbuf = (char*)malloc(length * sizeof(char) * 2); >> if (!cbuf) >> { >> perror("[SRFileHandle readDataOfLength] failed."); >> return nil; >> } >> >> FD_ZERO(&fdset); >> FD_SET(_sock, &fdset); // <-- this is line 494 >> >> [_readLock lock]; >> switch (select(_sock+1, &fdset, NULL, NULL, (_timeout.tv_sec == 0 >> ? >> NULL : &_timeout))) >> ... >> >> I am not sure whether this is Solaris related or some other kind of >> problem. It's just that we only have Solaris here to test this on. gdb >> gives us the following: >> >> Loaded symbols for /usr/local/ssl/lib/libcrypto.so.0.9.8 >> #0 0xfea6f60c in -[SRFileHandle readDataOfLength:] (self=0x92b2298, >> _cmd=0xfeabff38, >> length=4096) at SRFileHandle.m:494 >> 494 FD_SET(_sock, &fdset); >> (gdb)bt >> #0 0xfea6f60c in -[SRFileHandle readDataOfLength:] (self=0x92b2298, >> _cmd=0xfeabff38, >> length=4096) at SRFileHandle.m:494 >> #1 0xfea6f579 in -[SRFileHandle availableData] (self=0x92b2298, >> _cmd=0xfeabff28) >> at SRFileHandle.m:477 >> #2 0xfea6f169 in -[SRFileHandle _readInBackgroundAndNotifyThread] >> (self=0x92b2298, >> _cmd=0xfeabff20) at SRFileHandle.m:448 >> #3 0xfe1477db in -[NSObject performSelector:withObject:] >> (self=0x92b2298, _cmd=0xfe371f00, >> >> Not very helpful. It just tells me that the FD_SET line crashes the >> application. Any idea what that is and what can be done to fix that? _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Wed Aug 26 10:43:37 2009
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:14 EST