[squid-users] Problems logging to a FIFO Pipe

From: Simon Morley <simon@dont-contact.us>
Date: Mon, 17 Sep 2001 18:33:32 +0100

Hi,
        I have been working on a small application which is intended to sit on a
FIFO pipe that squid writes to, and compiles in memory 'x' minutes of logged
data, then to fork off and flush this information to a database.

I am however running into problems with Squid-2.4.STABLE2 writing to a FIFO
pipe.

I have created the pipe in the normal way using the "mkfifo" command and
assigned it the relevant permissions and ownership.

When I run squid and a request is processed, squid then crashes.

I did an strace of the crashing squid, and it appears the following section
is the most relevant, in that it shows squid failing to open the access.log
file (the pipe):-

read(6, "<HTML><HEAD>\n<TITLE>ERROR: The r"..., 766) = 766
close(6) = 0
open("/usr/local/squid/logs/access.log",
O_WRONLY|O_NONBLOCK|O_APPEND|O_CREAT, 0644) = -1 ENXIO (Device not
configured)
open("/usr/share/locale/locale.alias", O_RDONLY) = 6

So the problem appears to be because squid is attempting to open the file
using non blocking io (the O_NONBLOCK flag).

I had a quick look through the source to see if I could just do a quick and
dirty hack to get it working, however from what I can see it's not meant to
open the file using non blocking io?

I'm afraid I am not familiar with squids source, so I might be looking in
completely the wrong place, but from what I could tell the following was the
relevant section of code:-

In logfile.c in the function logfileOpen:-

logfileOpen(const char *path, size_t bufsz, int fatal_flag)
{
    int fd;
    Logfile *lf;
    fd = file_open(path, O_WRONLY | O_CREAT | O_TEXT);

Which seems to indicate that it's not attempting to open the file with the
O_NONBLOCK flag ?!?

Does anyone know how I can overcome this, be it a code or configuration
change ?

I am aware of the potential problems if my application does not read the
data quick enough, and would block squid, but I am confident that I can
avoid that in my application.

Any assistance would be greatly appreciated!

--
Simon Morley (simon@xaraonline.com)
Network Manager for Xara Online (http://www.xaraonline.com/)
"Thou shalt not follow the Null Pointer, for at it's end Madness and Chaos
lie."
Received on Mon Sep 17 2001 - 11:33:34 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:02:13 MST