Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Alternative flock?

Expand Messages
  • antonio.neves@ig.com.br
    Thanks, I ll try... but what really got me is raising the system open file quota. How do I do such a thing? Antonio ...
    Message 1 of 2 , May 9, 2000
    • 0 Attachment
      Thanks, I'll try...

      but what really got me is raising the system open file quota. How do I do
      such a thing?


      Em 09 May 2000, Tom Barron escreveu:

      >Antonio Neves wrote:
      >> ...
      >> I am working with a CGI program, on Unix, and when traffic
      >> is heavy I have problems with exceeding the systems open
      >> file limits. Unix opens the files, then says "oops! I have exceeded
      >> my limit!" and drops it, effectively truncating the file. These are
      >> simple text files...
      >> I am opening with +< but even then, good bye data.
      >> Is there any way in Perl to protect text files that are
      >> opened for writing, instead of losing the data when the file
      >> limits are reached, without using the flock() ?
      >> I had hoped that by changing from
      >> open(F, ">$data") or die "can't open file : $data $!\n";
      >> to
      >> open(F, "+<$data") or die "can't open file : $data $!\n";
      >> and then seeking and truncating, I would solve the loss
      >> data problem. There is obviously ( I think ) something
      >> that I am missing here. I have tried everything I can
      >> think of / find all to no avail.
      >Several ideas:
      > - figure out why you're running into the quota and fix it so you
      >don't. Are you failing to close files after you're done with them?
      >Could you consolidate some of your data files so you can open fewer of
      > - raise the system open file quota. This probably wouldn't be a
      >permanent solution because your traffic would just increase to the new
      > - Keep a count of the number of files you open and don't attempt to
      >open the Nth one. This would be difficult in a CGI environment,
      >although what you might do is funnel all your open requests through one
      >particular routine which maintains a count of open files in a chunk of
      >shared memory.
      > - Never open for writing a file that contains data you care about.
      >Perform all your updates in the context of copying from an old file to a
      >new file. This approach would require some redesign of your code and
      >would consume even more open file descriptors, but you wouldn't lose
      >Save 75% on Products!
      >Find incredible deals on overstocked items with Free shipping!

      Oi! Você quer um iG-mail gratuito?
      Então clique aqui: http://www.ig.com.br/paginas/assineigmail.html
    Your message has been successfully submitted and would be delivered to recipients shortly.