ginjo / rfm

FileMaker to Ruby adapter.
MIT License
45 stars 22 forks source link

Filemaker WPE bad response results in Errno::ENOENT: No such file or directory @ rb_sysopen #40

Open emptyflask opened 7 years ago

emptyflask commented 7 years ago

It’s possible for this io variable to contain just about anything, and as long as it isn’t obviously XML, then it will try to open the string as a file:

# lib/rfm/utilities/sax_parser.rb:838
        def run_parser(io)
          parser = Nokogiri::XML::SAX::Parser.new(self)
          parser.parse case
                       when (io.is_a?(File) || io.is_a?(StringIO))
                         io
                       when io[/^</]
                         StringIO.new(io)
                       else
                         File.new(io)
                       end
        end

I'm still not sure what Filemaker was responding with, since restarting the WPE fixed the problem, but it was really confusing to see Errno::ENOENT in multiple apps' log files.

If this happens again I'll take a closer look and hopefully make a pull request to at least make the error more descriptive.

ginjo commented 6 years ago

Hey @emptyflask , I don't know how I missed this post (sheepish-grin). I've been working on the future-version-4 and have been buried in IO madness for several days, so I'm familliar with this error now. It's actually a system call error that blows up when a IO.open system call fails. There's a short explanation of Errno here. I get this rb_sysopen error when the parsing template cannot be found on disk. I may also get it when doing some other IO stuff that goes bad.

The IO stuff in rfm v3 is kinda messy. In the upcoming v4, it's been simplified. Rfm v4 separates functionality into independent libraries, where each library is tightly defined and does not get muddied by the needs of another library. I'll be posting some info about v4 sometime in the (hopefully near) future.

Regarding the WPE, it can definitely go bad and start responding with nonsense. Maybe it's an Apache thing, or an interaction between FMS, WPE, and Apache... But the only solution is to restart WPE (and sometimes Apache and FMS, or even the entire OS).