Re: [squid-users] Problems logging to a FIFO Pipe

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 18 Sep 2001 00:25:52 +0200

The log file is not meant to be opened O_NONBLOCK. This is a bug.

The O_NONBLOCK flag is set by disk.c:file_open. It should be safe to
remove it from there I think.

--
Henrik
Simon Morley wrote:
> 
> 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 - 16:42:19 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:21 MST