Trouble is this: program terminated by signal SEGV (no mapping at the fault address) Current function is sh_close 635 *sh.fdptrs[fd] = -1; (dbx) print *sh.fdptrs[fd] dbx: cannot access address 0x100000000000000 (dbx) print sh.fdptrs[fd] sh.fdptrs[fd] = 0x100000000000000 (dbx) print fd fd = 3 (dbx) print sh.lim.open_max sh.lim.open_max = 256
The sh.fdptrs array is allocated at shell based on sh.lim.open_max and is not reallocated after builtin ulimit changes the limit. sh.lim.open_max must be updated after each ulimit call and sh.fdptrs reallocated if open_max grows. However sh.fdptrs must NEVER shrink as files with higher fds may already be open and ulimit is used to shrink the maximum number of fds. Olga 2010/3/4 ольга крыжановская <[email protected]>: > ksh93 (2010-03-01) crashes if I open too many file descriptors: > > ksh93 -c 'ulimit -n 60000 ; while redirect {x}< "/etc/profile" ; do > print $x ; done 2>&1' | tail -3 > 293 > 294 > 295 > -ksh93: 1759: Memory fault(coredump) > fle...@meridian:~$ pstack core > core 'core' of 1759: ksh93 -c ulimit -n 60000 ; while redirect {x}< > "/etc/profile" ; do pri > ffffffff7d544fb4 sh_close (3, 0, 0, ffffffff7d6a6000, > ffffffff7d6a9498, 18) + d0 > ffffffff7d546c64 sh_redirect (ffffffff7d6a8f08, 1001095c0, 3, 2, > ffffffff7d6a6000, 20000) + 1068 > ffffffff7d582378 sh_exec (100109540, 0, ffffffffffffffff, 100109840, > 0, 0) + 1318 > ffffffff7d584d68 sh_exec (0, ffffffff7d6a8f08, ffffffff7d6a8f08, 4, > 0, 1001094c0) + 3d08 > ffffffff7d583c54 sh_exec (100109780, 5, ffffffff7d6a8f08, 1001097c0, > 5, ffffffff7d6a6000) + 2bf4 > ffffffff7d5813ac sh_exec (1001097a0, 25, 4, e, 1, 0) + 34c > ffffffff7d55c0f4 exfile (24, 25, 1001097a0, 24, 4, 4) + be8 > ffffffff7d55b4f0 sh_main (0, 40000200001, 0, ffffffff7d6a6000, > ffffffff7d6a8f08, ffffffff7d6a6000) + c80 > 0000000100000d58 main (3, ffffffff7ffffa78, ffffffff7ffffa98, 1f5940, > 1c80, 10000) + 44 > 0000000100000cfc _start (0, 0, 0, 0, 0, 0) + 17c > > I would assume that the shell supports at least 1024 open files. > > Olga > -- > , _ _ , > { \/`o;====- Olga Kryzhanovska -====;o`\/ } > .----'-/`-/ [email protected] \-`\-'----. > `'-..-| / Solaris/BSD//C/C++ programmer \ |-..-'` > /\/\ /\/\ > `--` `--` > -- , _ _ , { \/`o;====- Olga Kryzhanovska -====;o`\/ } .----'-/`-/ [email protected] \-`\-'----. `'-..-| / Solaris/BSD//C/C++ programmer \ |-..-'` /\/\ /\/\ `--` `--` _______________________________________________ ast-developers mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-developers
