Follow-up Comment #2, bug #42781 (project gnustep): Instead of hanging it has began to segfault with my code.
I have a class which is used as a container for all data needed to make a request to customer's service. The idea is to create that class's instances with all parameters are filled and to call the instance's methods -[start:] and -[stop] with the runloop between. The instance makes the custom request (from provided data), the NSURLConnection and assigns itself as a delegate. I have the test checking how that class behaves when the customer's service is dead (not-listening). The test's code chunk is: ----------------------------------------------------------- // connect to nowhere url = [NSURL URLWithString: @"https://localhost:30011"]; cmnd = [[testedClass alloc] initWithGateway: nil URL: url factory: nil object: nil type: C0INFO parameters: nil]; [cmnd start: nil]; while(![cmnd isCompleted]) { [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: timing]]; } err = [cmnd error]; ----------------------------------------------------------- The segmentation fault occurs within the runloop and here is the gdb session: ----------------------------------------------------------- Program received signal SIGSEGV, Segmentation fault. 0x00007ffff6cd973f in objc_msg_lookup () from /usr/lib/x86_64-linux-gnu/libobjc.so.4 (gdb) bt #0 0x00007ffff6cd973f in objc_msg_lookup () from /usr/lib/x86_64-linux-gnu/libobjc.so.4 #1 0x00007ffff706a0c7 in -[GSTLSHandler stream:handleEvent:] (self=0x76f5a0, _cmd=0x7ffff75dada0 <_OBJC_SELECTOR_TABLE+576>, stream=0xc22c10, event=8) at GSSocketStream.m:660 #2 0x00007ffff7070964 in -[GSStream(Private) _sendEvent:] (self=0xc22c10, _cmd=0x7ffff75d82b0 <_OBJC_SELECTOR_TABLE+688>, event=8) at GSStream.m:508 #3 0x00007ffff706c871 in -[GSSocketStream _sendEvent:] (self=0xc22c10, _cmd=0x7ffff75d82b0 <_OBJC_SELECTOR_TABLE+688>, event=8) at GSSocketStream.m:1451 #4 0x00007ffff706da45 in -[GSSocketInputStream _dispatch] (self=0xc22a10, _cmd=0x7ffff75dac70 <_OBJC_SELECTOR_TABLE+272>) at GSSocketStream.m:1993 #5 0x00007ffff706fe50 in -[GSStream receivedEvent:type:extra:forMode:] (self=0xc22a10, _cmd=0x7ffff76c5ed0 <_OBJC_SELECTOR_TABLE+304>, data=0x7, type=ET_WDESC, extra=0x7, mode=0x7ffff765b920 <_OBJC_INSTANCE_2>) at GSStream.m:221 #6 0x00007ffff7283efb in -[GSRunLoopCtxt pollUntil:within:] (self=0x6f6850, _cmd=0x7ffff765cb40 <_OBJC_SELECTOR_TABLE+1216>, milliseconds=79, contexts=0x6f1150) at GSRunLoopCtxt.m:601 #7 0x00007ffff71b3362 in -[NSRunLoop acceptInputForMode:beforeDate:] (self=0x6f0210, _cmd=0x7ffff765cb80 <_OBJC_SELECTOR_TABLE+1280>, mode=0x7ffff765b920 <_OBJC_INSTANCE_2>, limit_date=0x708b50) at NSRunLoop.m:1217 #8 0x00007ffff71b378a in -[NSRunLoop runMode:beforeDate:] (self=0x6f0210, _cmd=0x7ffff765cba0 <_OBJC_SELECTOR_TABLE+1312>, mode=0x7ffff765b920 <_OBJC_INSTANCE_2>, date=0xc21880) at NSRunLoop.m:1288 #9 0x00007ffff71b3924 in -[NSRunLoop runUntilDate:] (self=0x6f0210, _cmd=0x6067f0 <_OBJC_SELECTOR_TABLE+176>, date=0xc21880) at NSRunLoop.m:1319 #10 0x0000000000403bd5 in -[PatternCommand2 startTest:] (self=0x647f60, _cmd=0x606b20 <_OBJC_SELECTOR_TABLE+160>, args=0x6d8830) at patternCommand2.m:351 #11 0x0000000000404005 in main (argc=1, argv=0x7fffffffd4c8, env=0x7fffffffd4d8) at testNetworkCommand2.m:42 (gdb) up #1 0x00007ffff706a0c7 in -[GSTLSHandler stream:handleEvent:] (self=0x76f5a0, _cmd=0x7ffff75dada0 <_OBJC_SELECTOR_TABLE+576>, stream=0xc22c10, event=8) at GSSocketStream.m:660 660 if ([ostream streamStatus] == NSStreamStatusOpen) (gdb) up #2 0x00007ffff7070964 in -[GSStream(Private) _sendEvent:] (self=0xc22c10, _cmd=0x7ffff75d82b0 <_OBJC_SELECTOR_TABLE+688>, event=8) at GSStream.m:508 508 handleEvent: NSStreamEventErrorOccurred]; (gdb) l 503 { 504 _events |= NSStreamEventErrorOccurred; 505 if (_delegateValid == YES) 506 { 507 [_delegate stream: self 508 handleEvent: NSStreamEventErrorOccurred]; 509 } 510 } 511 } 512 else if (event == NSStreamEventEndEncountered) (gdb) p _delegate $4 = (struct objc_object *) 0x0 (gdb)) up #3 0x00007ffff706c871 in -[GSSocketStream _sendEvent:] (self=0xc22c10, _cmd=0x7ffff75d82b0 <_OBJC_SELECTOR_TABLE+688>, event=8) at GSSocketStream.m:1451 1451 [super _sendEvent: event]; (gdb) l 1446 id del = _delegate; 1447 BOOL val = _delegateValid; 1448 1449 _delegate = _handler; 1450 _delegateValid = YES; 1451 [super _sendEvent: event]; 1452 _delegate = del; 1453 _delegateValid = val; 1454 } 1455 else (gdb) p _handler $5 = (struct objc_object *) 0x0 (gdb) ..... ----------------------------------------------------------- Somehow the _handler has been released during the call [super _sendEvent: event]. If i step up to the my code's frame: ----------------------------------------------------------- ..... (gdb) up #10 0x0000000000403bd5 in -[PatternCommand2 startTest:] (self=0x647f60, _cmd=0x606b20 <_OBJC_SELECTOR_TABLE+160>, args=0x6d8830) at patternCommand2.m:351 351 [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: timing]]; (gdb) l 346 type: C0INFO 347 parameters: nil]; 348 [cmnd start: nil]; 349 while(![cmnd isCompleted]) 350 { 351 [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: timing]]; 352 } 353 err = [cmnd error]; 354 d = [[err userInfo] objectForKey: @"description"]; 355 if(nil != err && (gdb) ) po [[cmnd error] userInfo] {description = "Connection refused"; source = "<C0NetworkCommand: 0xc476e0 info>"; } (gdb) ----------------------------------------------------------- As you see my class's instance has already got the backcall -[connection:didFailWithError:] and stored the error from the NSURLConnection. _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?42781> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-gnustep
