Click to See Complete Forum and Search --> : Perl or Apache line truncation


goofball
07-23-2003, 11:06 AM
I'm scripting a perl library database on a server that's running Apache 1.3 server software on a FreeBSD system, host is Verio.

Recently, one of the .pl library files used to store member data was somehow truncated (don't know how) and the result was that when other scripts in the system tried to require that file, there were errors updating the database. The file was truncated in the middle of a really long line, but since Perl lets you build and store strings that are only limited by system memory I think it may be an Apache file system limitation.

I just want to ask if anyone knows what may have caused the .pl file to be truncated. Do you know what the length of a line within a file is allowed to be by Apache or Perl?

Thanks

Jeff Mott
07-23-2003, 01:31 PM
There are no additional limitations in Apache that I am aware of. How big of a string are we talking? If you amount of data is becoming ver large then you may want to consider using a fixed length database, so you only read into memory the records needed at that time.

goofball
07-24-2003, 09:29 AM
The string was several hundred characters long. But I know it wasn't a memory problem - for 1 there were no "out of memory" lines in the error_log file, and 2 the database conserves memory by replacing the data from the last record with the next record it "require"s

Maybe I restarted the server in the exact same moment that the perl script was closing the file handle on that file's write operation... (?) I dunno ..

What do you mean by "fixed length database"?

goofball
07-25-2003, 10:28 AM
I figured it out - (I'm such an idiot!)

I forgot to lock the file before the read/write operation.
Another process must have gotten ahold of the unlocked file while it was in the middle of being written. oops.

The same thing happened today with a perl-based log file. There goes 3 days worth of data....