Online Book Reader

Home Category

Squid_ The Definitive Guide - Duane Wessels [168]

By Root 2130 0
messages. Nonetheless, you may want to take a close look at the access.log from time to time and see what sort of errors, if any, your users might be seeing.

Purging Objects

You may find the PURGE method particularly useful when operating a surrogate. Because you have a good understanding of the content being served, you are more likely to know when a cached object must be purged. The technique for purging an object is the same as I mentioned previously. See Section 7.6 for a refresher.

Neighbors

Although I don't recommend it, you can configure Squid as a surrogate and as part of a mesh or hierarchy. If you choose to take on such an arrangement, note that, by default, Squid forwards cache misses to parents (rather than the backend server). Assuming that isn't what you really want, be sure to use the cache_peer_access directives so that requests for your backend server don't go to your neighbors instead.

Exercises

Install and configure Squid as a surrogate on the same system where you run an HTTP server.

Make a few test requests with squidclient. Pay particular attention to the reply headers and notice how the requests appear in both access logs.

Try to poison your own surrogate with fake HTTP requests. It is probably easier with httpd_accel_single_host enabled.

Estimate the size of your origin server's document set. What percentage of the data can fit into 1 GB of memory or disk space?

Chapter 16. Debugging and Troubleshooting

No matter how hard the Squid developers try to be perfect, you may encounter some problems with Squid. These problems range from misbehaving clients and servers to fatal bugs in the Squid code. In this chapter, I'll talk about various ways you can debug these problems.

Some Squid problems may require you to turn on debugging. In most cases, you'll want to increase the debugging levels for specific parts of the code. I'll describe how to find out what those debugging sections are and how to change the settings. Also, I'll talk about the importance of providing detailed debugging when reporting bugs.

Finally, you may experience fatal bugs in the Squid code. These can result in segmentation violations, aborts, assertions, and core dumps. The core dump is a useful debugging aid. With a debugger, such as gdb, you can generate a process stack trace and send it to the developers for assistance.

If you suspect you have a Squid bug, but aren't sure, check with the squid-users mailing list or one of the other resources described in Section 1.6.

Some Common Problems

Before discussing debugging in general, I'll mention a few specific problems that commonly arise.

"Failed to make swap directory"

Failed to make swap directory /var/spool/cache: (13) Permission denied

This happens when you run squid -z, and the Squid user ID doesn't have write permission to the /var/spool directory. Remember that if you start Squid as root and don't add a cache_effective_user line, Squid runs as the user nobody by default. Thus, your solution may be to simply run:

# chown nobody:nobody /var/spool

"Address already in use"

commBind: Cannot bind socket FD 10 to *:3128: Address already in use

This message appears when the bind( ) system call fails because the requested port is already opened by another application. Usually, this happens when you try to start a second instance of Squid when the first one is still running. If you see this error message, use ps to see if Squid is already running.

Squid uses the SO_REUSEADDR socket option, so that the bind( ) call should succeed even if there are some leftover sockets in the TIME_WAIT state. If you get the message, even though Squid isn't already running, your operating system may be buggy or especially finicky. Rebooting your system is one way to get around this problem.

Another possibility to consider is that the port (e.g., 3128) is currently being used by a different application. If you suspect this, you can use the lsof program (ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof) to find which application is listening on the port. FreeBSD

Return Main Page Previous Page Next Page

®Online Book Reader