0

I use mod_perl scripts under Apache 2.4.18 on a VPS under Ubuntu 16.04. The scripts open files from the disk (web page templates). From time to time, they stop seeing these files, the server error log is full of the following errors:

[TIME] [:error] [pid PID:tid TID] file error - FILENAME: not found\n

These messages are generated by the Template package when Perl open() function returns false. After Apache restart, the files are visible again, but only for some time. After a while, the problem reappears.

What can be the reason of such behaviour?

2

Maybe mod_perl/apache is not closing filehandles properly. After some time, when the maximum amount of open files is reached (1024 soft/4096 hard see ulimit -Sn;ulimit -Hn) the restart of apache closes all stale handles.

Next time when the error occurs you can investigate this theory by getting the pid from apache/perl.

# ps aux | grep apache

or

# pidof apache

or perl module if it has an own process..

sample output:

28294

List File Opened By a PID

# lsof -p 28294
# lsof -a -p 28294
# counting
# lsof -a -p 28294| wc -l

or

# cd /proc/28294/fd
# ls -l | less
# count open files with
# ls -l | wc -l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.