Re: strace, accept(), ERESTARTSYS and EINTR

From: Andi Kleen
Date: Sat Jan 05 2008 - 10:03:21 EST


"Phil Endecott" <phil_wueww_endecott@xxxxxxxxxxxx> writes:
>
> Many thanks for any suggestions.

It's a long standing bug reported regularly but so far nobody has tracked
it down. That's mostly because most people cannot really reproduce it.

If you can reproduce it reliably: you could do the brute force debugging
method. Simply grep all places in the kernel code that set or pass ERESTART
and add a

printk("%s:%d ERESTART\n", __FILE__, __LINE__);

or perhaps

printk("%s:%d %s:%d ERESTART\n", current->comm, current->pid, __FILE__,
__LINE__);

or perhaps

if (!strcmp(current->comm, "yourprogramwithoutpath"))
printk("%s:%d ERESTART\n", __FILE__, __LINE__);

[the later two might need adding linux/string.h and/or linux/sched.h includes
to the files if they don't compile]

to all of them. Then recompile and boot that kernel.

Now if you can match such a output line to your program
malfunction we would know where the problem is and then it would be likely
reasonable easy to fix.

Note that the above first two might produce a lot of output if you're
unlucky -- definitely don't do it on a production machine and kill
syslog first so that it doesn't all end up on disk.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/