FROM : Chris Suter
DATE : Mon Oct 30 02:01:30 2006
> My guess is that what's probably happening is that your program is
> getting a signal (probably SIGCHILD or SIGPIPE or something), which
> is causing the read() call inside -readDataOfLength: to return
> prematurely with EINTR, hence the exception you're seeing. It's
> quite annoying that the -readData methods don't handle this
> better. I think in at least one place in our code we intentionally
> avoid using NSFileHandle's -read methods for this very reason.
>
> I'm sure we must have filed a bug report about this, but I can't
> find anything. Maybe my colleague Chris did, I'm not sure.
I did file a bug.
I also changed all our code to use:
@implementation NSFileHandle (CSFileHandleExtensions)
- (NSData *)availableDataOrError:(NSException **)returnError;
{
for (;;) {
@try {
return [self availableData];
} @catch (NSException *e) {
if ([[e name] isEqualToString:NSFileHandleOperationException]) {
if ([[e reason] isEqualToString:
@"*** -[NSConcreteFileHandle availableData]: Interrupted system
call"]) {
continue;
}
if (returnError)
*returnError = e;
return nil;
}
@throw;
}
}
}
@end
Not particularly pleasant, I'll admit.
- Chris
DATE : Mon Oct 30 02:01:30 2006
> My guess is that what's probably happening is that your program is
> getting a signal (probably SIGCHILD or SIGPIPE or something), which
> is causing the read() call inside -readDataOfLength: to return
> prematurely with EINTR, hence the exception you're seeing. It's
> quite annoying that the -readData methods don't handle this
> better. I think in at least one place in our code we intentionally
> avoid using NSFileHandle's -read methods for this very reason.
>
> I'm sure we must have filed a bug report about this, but I can't
> find anything. Maybe my colleague Chris did, I'm not sure.
I did file a bug.
I also changed all our code to use:
@implementation NSFileHandle (CSFileHandleExtensions)
- (NSData *)availableDataOrError:(NSException **)returnError;
{
for (;;) {
@try {
return [self availableData];
} @catch (NSException *e) {
if ([[e name] isEqualToString:NSFileHandleOperationException]) {
if ([[e reason] isEqualToString:
@"*** -[NSConcreteFileHandle availableData]: Interrupted system
call"]) {
continue;
}
if (returnError)
*returnError = e;
return nil;
}
@throw;
}
}
}
@end
Not particularly pleasant, I'll admit.
- Chris
| Related mails | Author | Date |
|---|---|---|
| Theodore H. Smith | Oct 25, 19:19 | |
| Theodore H. Smith | Oct 25, 20:05 | |
| Shawn Erickson | Oct 25, 20:11 | |
| John Stiles | Oct 25, 20:14 | |
| Stephen Deken | Oct 25, 20:17 | |
| Alastair Houghton | Oct 25, 20:42 | |
| Theodore H. Smith | Oct 25, 21:49 | |
| Alastair Houghton | Oct 25, 22:23 | |
| Thomas Engelmeier | Oct 29, 22:16 | |
| Chris Suter | Oct 30, 02:01 |






Cocoa mail archive

