Echo Write Error Interrupted System Call
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this script write error interrupted system call site About Us Learn more about Stack Overflow the company Business Learn more
Bash Read Interrupted System Call
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss waitpid error interrupted system call Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Bash file descriptor leak up vote 4 down vote favorite 4 I get a file descriptor leak when running the following code: function get_fd_count() { local fds cd /proc/$$/fd; fds=( * ) # avoid a StackOverflow source colorizer bug echo "${#fds[@]}" } function fd_leak_func() { while : ; do echo ">> Current FDs: $(get_fd_count)" read retval new_state < <(set +e; new_state=$(echo foo); retval=$?; printf "%d %s\n" $retval $new_state) done } fd_leak_func Tested on both 3.2.25 and 4.0.28. This only happens when the loop is happening within a function; every time we return to top-level context, the extra file descriptors are closed. Is this intended behavior? More to the point, are workarounds available? Followup: After reporting to the bash-bug mailing list, this was confirmed as a bug. Chet indicated that a fix will be included in the next release (as of 4/17/2010). bash share|improve this question edited Apr 19 '10 at 10:53 asked Apr 15 '10 at 21:51 Charles Duffy 95.1k15102142 Even weirder, if I put a true at the end of the loop it keeps going up, but putting a /bin/true keeps it level at 5. –Ignacio Vazquez-Abrams Apr 15 '10 at 23:17 Report it to the newsgroup using the bashbug program and see what the maintainer, Chet Ramey, says about it. –Dennis Williamson Apr 16 '10 at 0:40 Still leaks in CentOS 6 bash 4.1.2(1)-release. –clacke Mar 4 '13 at 8:52 Adding /bin/true does not help in my bash (version noted above), but adding (exit 0) does. My wild gue
come to think of (IRC and GNU mailing list) but was in the end recommended this newsgroup. I hope my article follows the USENET etiquette since this is my first time using the service. REAL CONTENT: A problem occurs when running the following script (just a proof of concept without any real purpose): #!/usr/bin/env bash for (( q = 0 ; q < 10 ; q++ )); do while read -d '' z; do result+=("$z"); done < <(printf "%s \000\n" test | grep http://stackoverflow.com/questions/2649240/bash-file-descriptor-leak -a 'test') done It results in the following output: [20:39:19][flagel@rose ~/private/system] ./test.bash ../test.bash: line 4: /var/tmp//sh-np-4192218989: Interrupted system call ../test.bash: line 4: /var/tmp//sh-np-920736717: Interrupted system call ../test.bash: line 4: /var/tmp//sh-np-1324053371: Interrupted system call ../test.bash: line 4: /var/tmp//sh-np-2394681976: Interrupted system call etc etc. It seems that the number of "Interrupted system call"-print outs are approximately half of the iterations http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2008-06/msg00375.html in the for-loop, this holds true with 5, 10, 20 and 30 iterations. Changing the script to... #!/usr/bin/env bash for (( q = 0 ; q < 10 ; q++ )); do while read -d '' z; do result+=("$z"); done < <(printf "%s \000\n" test | grep -a 'test') sleep 1 #THE ONLY CHANGE done ....solves the problem completely. My best guess would be that the next iteration in the for loop is beginning before the grep process finishes but I'm hoping for a more qualified guess since I am after all only a beginner in this field. I am most thankful for any help or ideas you might give me. Yours sincerely, Tanel Rebane . Prev by Date: Removing comments from xml with gawk Next by Date: Re: Removing comments from xml with gawk Previous by thread: Removing comments from xml with gawk Next by thread: Re: Crontab: Do something exactly every 3 week on Tuesday? Index(es): Date Thread Flag as inappropriate (AWS) Security UNIX Linux Coding Usenet Mailing-ListsNewsgroupsAboutPrivacyImprint unix.derkeiler.com >Newsgroups >comp.unix.shell >2008-06
Bug #6533 Bash script generates "interrupted system call" events on tty window resize Added by Granville Moore 10 months ago. Updated 5 months ago. Status:NewStart date:2015-12-26Priority:NormalDue date:Assignee:-% Done:0%Category:-Target version:- https://www.illumos.org/issues/6533 Difficulty:Medium Tags:needs-triage Description When pasted into an interactive bash shell in a remote tty (ssh/putty) on OI151a7, the attached script generates a "-bash: echo: write error: Interrupted system call" event when the window is resized. Function A simply outputs zero (in hex); function B fills a data file with garbage and then loops infinitely reads the data file one line interrupted system at a time, passing the line to a shell that reads it, calls A and then outputs 0 to /dev/null using printf. Calling function B and then resizing the terminal window (i.e sending a SIGWINCH signal to the process) causes the "Interrupted system call". Removing almost any element of the script causes the behaviour to change, suggesting a race condition (which interrupted system call might mean that it may not occur on all systems). Blocking SIGWINCH events using trap "" 20 inhibits the behaviour. This is a cut-down version of a real script that exhibited this behaviour, reduced to the point just before the behaviour stops occuring. OI151-bash-interrupted-system-call-issue - OI151-bash-interrupted-system-call-issue-script (1.12 KB) Granville Moore, 2015-12-26 10:56 PM History #1 Updated by Granville Moore 10 months ago Just to clarify, when this interrupted system call occurs in a non-trivial example, any data that should have been written by the interrupted echo statement is lost. #2 Updated by Nikola M. 9 months ago 151a7 is older dev release but, it is neded to report bugss in newest possible OI. Please confirm it it behaves the same in newest /dev , 151a9 , also check to see how it behaves in latest updated OI Hipster rolling release (/hipster-2015, dlc.openindiana.org). Could be nice excuse to test upgrading from dev to hipster or install hipster in Virtualbox and zfs send it to new emptied Boot Eenvironment. #3 Updated by Nikola M. 5 months ago Newest hipster change publisher addr