There seems a pty race condition in 2.6 kernel on SMP machines. I have seen it on dual ia32 and ia64 machines under 2.6.10-rc3.
Created attachment 4260 [details] A testcase On my dual 2.8GHz P4 machine with 1GB RAM, I got # nohup make& # ps xa 5159 pts/0 S 0:00 make 5160 pts/0 S 0:01 /bin/sh -c for ((i = 0; i < 50000; i++)) do echo $i; 11540 pts/0 S 0:00 ./pty 11541 ? Zs 0:00 [true] <defunct> # tail nohup.out 3186 select (4) returns: 1 Read -1 characters. 3187 select (4) returns: 1 Read -1 characters. 3188 select (4) returns: 1 Read -1 characters. 3189
Are you sure it's a bug? I get the same behaviour on 2.4.29-pre1.
I have seen it under 2.4.2x SMP kernel too. Since the current behavior isn't consistent with itself nor UP kernel, I consider it a bug. What do other OSes do?
Created attachment 4270 [details] A patch for 2.6.10-rc3 I got this patch for 2.6.10-rc3 from Nanhai Zou, nanhai.zou@intel.com. It works for me. A similar patch for 2.4 kernel also works.
It doesn't work for me. I still get 539 select (3) returns: 1 Read -1 characters. errno: Input/output error 540 select (3) returns: 1 Read -1 characters. errno: Input/output error
Created attachment 4276 [details] The config file for P4 SMP machine Sorry I didn't make myself clear. The problem is my testcase may hang on a fast SMP machine. I have seen it on a quad 1.3GHz Itanium 2, a dual 800MHz Itanium 1, a single P4 HT and a single EM64T HT. It happens on both 2.4 and 2.6 SMP kernels.
yup, I was able to reproduce the hang on an unpatched kernel too. I'll merge the patch for 2.6.10, thanks. Maybe 2.4 needs a patch too??
Created attachment 4277 [details] A patch for kernel 2.4.29 This patch should apply to kernel 2.4.29.
Fix is in mainline, closing.