<p dir="ltr">Also <a href="http://perldoc.perl.org/functions/system.html">http://perldoc.perl.org/functions/system.html</a> suggests using backticks to get output rather than system.</p>
<div class="gmail_quote">On 2014-02-01 4:15 PM, &quot;Robert Keizer&quot; &lt;<a href="mailto:robert@keizer.ca">robert@keizer.ca</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">I would write a small test case in bash. Not hating on perl, but if it also exhibits those symptoms, rules perl out completely.</p>
<p dir="ltr">Also post bash script if you do end up doing this -I wouldn&#39;t mind taking a stab at it.</p>
<p dir="ltr">What file system are you using?</p>
<p dir="ltr">You could run strace on process-file which should tell you if it is indeed doing something funny.. </p>
<p dir="ltr">My guess is perl specific; I&#39;d test without it and replicate.</p>
<p dir="ltr">Rob</p>
<div class="gmail_quote">On 2014-02-01 3:10 PM, &quot;Trevor Cordes&quot; &lt;<a href="mailto:trevor@tecnopolis.ca" target="_blank">trevor@tecnopolis.ca</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I&#39;m running into a strange race condition, that appears to me to be a<br>
Linux bug of some sort.<br>
<br>
I&#39;m doing, perl pseudocode:<br>
<br>
system &quot;process-file outputfileprefix&quot;<br>
# does work and puts it in files named outputfileprefix-0, outputfileprefix-1, etc<br>
<br>
sleep 1;<br>
if (!&lt;outputfileprefix-[0-9]*&gt;) {<br>
  warn &quot;try #2\n&quot;;<br>
  sleep 2;<br>
  if (!&lt;outputfileprefix-[0-9]*&gt;) {<br>
    warn &quot;try #3\n&quot;;<br>
    die;<br>
  }<br>
}<br>
<br>
# do something on outputfile*<br>
<br>
For those that don&#39;t know &lt;&gt; is perl&#39;s glob op, which simply returns an<br>
array of all the files matching the glob.  !&lt;&gt; is thus true if no files<br>
match the glob.<br>
<br>
What is happening is that 10-30% of the time, I get a &quot;try #2&quot; output.  I<br>
haven&#39;t yet seen a try #3.  Of course, having those retries (and sleeps)<br>
in there at all should not be required: I had to add them as I was seeing<br>
this program blow up in unexpected ways.<br>
<br>
process-file does not do anything async&#39;ly, AFAIK.  The final thing it<br>
does, the output that I need, is use the GD library to write a png file.<br>
Only after that does process-file exit.  There are no threads or forks,<br>
unless GD is doing one, but even then the mini-program above should not<br>
return from system until all threads and (non-daemonized) forks are done.<br>
<br>
It appears the problem is process-file writes and closes a file, returns,<br>
yet the directory entry doesn&#39;t become visible to the calling script for 0<br>
to 3 seconds!  I was under the impression that such UNIX OS actions were<br>
guaranteed to occur reliably in sequence!<br>
<br>
Note, the fs I&#39;m using is local and normal harddisk-based.  It is not on<br>
NFS or SMB, which of course could show such results.<br>
<br>
Comments?  Ideas?<br>
_______________________________________________<br>
Roundtable mailing list<br>
<a href="mailto:Roundtable@muug.mb.ca" target="_blank">Roundtable@muug.mb.ca</a><br>
<a href="http://www.muug.mb.ca/mailman/listinfo/roundtable" target="_blank">http://www.muug.mb.ca/mailman/listinfo/roundtable</a><br>
</blockquote></div>
</blockquote></div>