Part of our application, which runs in a mixed Windows / Linux / Solaris environment, is a small Perl program, which ats ome point executes
if(-e $rule_file) { if(open(my $rule_fh,'<',$rule_file)) { .... } else { die "Can not read file $rule_file : $!"; } }
The variable $rule_file contains one of two values, depending on whether the script runs on Linux/Solaris, or Windows, but in both cases, it points (absolute path) to the same file. On Linux and Solaris, the file is mounted via NFS. On Windows, the file is accessed via CIFS, and $rule_file is an UNC path.

This small program is executed frequently. It might well be that at a certain point in time, a dozen processes on various Linux-, Solaris- and Windows processes execute the script and try to open the file. Since the file is only opened for reading, I believe that this should not be a problem.

From our logs, I see however that the open occasionally fails with

Can not read file ....... : Invalid argument

This happens rarely (maybe in 1 out of 1000-2000 executions), and if it happens, it always fails on Windows, never on Linux or Solaris. It looks very much like a concurrency issue, but the wording of the error message, "invalid argument", surprises me.

Any idea what could be the reason? Maybe some Windows or CIFS quirk, when many processes try to open a file at the same time?

-- 
Ronald Fischer <ynnor@mm.st>

In reply to Spurious "Invalid Argument" on file open by rovf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.