in reply to Re: Problem opening file
in thread Problem opening file

"As to why it's failing -- without more information, hard to tell. My guess is that in the process of opening a file -- usually an atomic operation -- the thread may have stepped on something another thread was doing (or vice versa), and failed without a highly visible cause."

I agree with your comment in principle, however the error returned by open indicates something a bit more basic is occurring. Its as though the arguments I am passing to open aren't being received (at least that is how I interpret the error).

I've also done everything I can think of to separate the threads and prevent any toe stomping (such as not share'ing variables, using Thread::Queue for IPC, having a single control to ensure work units that interact with each other can only be passed to the same thread). Although thinking about it now, it is entirely possible that an external process is attempting something it shouldn't be doing. Thanks for your comments and suggestions so far, I'll go have a look at what else is running on the server.

Replies are listed 'Best First'.
Re^3: Problem opening file
by marinersk (Priest) on Jul 09, 2015 at 13:54 UTC

    Its as though the arguments I am passing to open aren't being received

    I agree, and that's my point.

    If very far under the covers, these threads are sharing some common space for performing the atomic openoperation, there could be a race condition where one starts to set up up the parameter block, but before the system call is triggered, another thread goes to update the same block of memory, resulting in invalid parameters being in that space once the service call starts to try to read it.

    No doubt one of many possible explanations, but if that's the case, two things come to mind:

    1. A workaround involving retries could buy you a quick and effective, if less than completely graceful, solution, and;
    2. The correct fix, from an engineering perspective, might involve poring over the code for the threads as well as the I/O modules/features to see if there is a prudent place to establish a semaphore or similar gating mechanism to eliminate the race condition.

      This suggestion scares the hell out of me, to be honest. You seem to be implying that threads is inherently broken!

      Remember, I'm not using any shared variables at all other than Thread::Queue

        This suggestion scares the hell out of me, to be honest. You seem to be implying that threads is inherently broken!

        Trust me, if they were that broken I would have seen the problem years ago. They aren't, and the above is simply unfounded speculation.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
        I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!