? config.status ? config.cache ? Makefile ? config.log ? contrib/Makefile ? errors/Makefile ? icons/anthony-compressed.gif ? icons/anthony-f.gif ? icons/anthony-tar.gif ? icons/anthony-dir.gif ? icons/anthony-box2.gif ? icons/anthony-bomb.gif ? icons/anthony-text.gif ? icons/anthony-c.gif ? icons/Makefile ? icons/anthony-layout.gif ? icons/anthony-pdf.gif ? icons/anthony-quill.gif ? icons/anthony-image2.gif ? icons/anthony-tex.gif ? icons/anthony-box.gif ? icons/anthony-unknown.gif ? icons/anthony-dvi.gif ? icons/anthony-binhex.gif ? icons/anthony-dirup.gif ? icons/anthony-link.gif ? icons/anthony-ps.gif ? icons/anthony-xpm.gif ? icons/anthony-xbm.gif ? icons/anthony-portal.gif ? icons/anthony-script.gif ? icons/anthony-sound.gif ? icons/anthony-image.gif ? icons/anthony-movie.gif ? include/autoconf.h ? include/stamp-h ? include/stamp-h1 ? lib/Makefile ? lib/.deps ? scripts/RunAccel ? scripts/RunCache ? scripts/Makefile ? snmplib/Makefile ? snmplib/.deps ? src/squid.conf.default ? src/auth_modules.c ? src/squidclient ? src/squid ? src/Makefile ? src/cf_parser.h ? src/string_arrays.c ? src/cf_gen ? src/globals.c ? src/store_modules.c ? src/cachemgr ? src/repl_modules.c ? src/client ? src/unlinkd ? src/.deps ? src/cf.data ? src/cf_gen_defines.h ? src/auth/Makefile ? src/auth/.deps ? src/auth/basic/.dirstamp ? src/auth/basic/Makefile ? src/auth/basic/helpers/Makefile ? src/auth/basic/helpers/LDAP/Makefile ? src/auth/basic/helpers/LDAP/.deps ? src/auth/basic/helpers/MSNT/Makefile ? src/auth/basic/helpers/MSNT/.deps ? src/auth/basic/helpers/NCSA/Makefile ? src/auth/basic/helpers/NCSA/.deps ? src/auth/basic/helpers/PAM/Makefile ? src/auth/basic/helpers/PAM/.deps ? src/auth/basic/helpers/SMB/Makefile ? src/auth/basic/helpers/SMB/.deps ? src/auth/basic/helpers/YP/Makefile ? src/auth/basic/helpers/YP/.deps ? src/auth/basic/helpers/getpwnam/Makefile ? src/auth/basic/helpers/getpwnam/.deps ? src/auth/basic/helpers/multi-domain-NTLM/Makefile ? src/auth/digest/Makefile ? src/auth/digest/helpers/Makefile ? src/auth/digest/helpers/password/Makefile ? src/auth/digest/helpers/password/.deps ? src/auth/ntlm/Makefile ? src/auth/ntlm/helpers/Makefile ? src/auth/ntlm/helpers/NTLMSSP/Makefile ? src/auth/ntlm/helpers/NTLMSSP/.deps ? src/auth/ntlm/helpers/NTLMSSP/smbval/Makefile ? src/auth/ntlm/helpers/NTLMSSP/smbval/.deps ? src/auth/ntlm/helpers/fakeauth/Makefile ? src/auth/ntlm/helpers/fakeauth/.deps ? src/auth/ntlm/helpers/no_check/Makefile ? src/fs/Makefile ? src/fs/.deps ? src/fs/aufs/.dirstamp ? src/fs/aufs/Makefile ? src/fs/coss/.dirstamp ? src/fs/coss/Makefile ? src/fs/diskd/.dirstamp ? src/fs/diskd/diskd ? src/fs/diskd/Makefile ? src/fs/diskd/.deps ? src/fs/null/.dirstamp ? src/fs/null/Makefile ? src/fs/ufs/.dirstamp ? src/fs/ufs/Makefile ? src/repl/Makefile ? src/repl/.deps ? src/repl/heap/Makefile ? src/repl/lru/.dirstamp ? src/repl/lru/Makefile Index: src/fs/diskd/store_dir_diskd.c =================================================================== RCS file: /server/cvs-server/squid/squid/src/fs/diskd/store_dir_diskd.c,v retrieving revision 1.58 diff -u -r1.58 store_dir_diskd.c --- src/fs/diskd/store_dir_diskd.c 2001/11/13 18:11:20 1.58 +++ src/fs/diskd/store_dir_diskd.c 2001/12/01 09:39:10 @@ -1630,12 +1630,18 @@ * SHM manipulation routines */ +/* + * storeDiskdShmGet - return a chunk of free SHM memory, or NULL If + * none was found. + */ void * storeDiskdShmGet(SwapDir * sd, off_t * shm_offset) { char *buf = NULL; diskdinfo_t *diskdinfo = sd->fsdata; int i; + static time_t last_logtime = 0; + for (i = 0; i < SHMBUFS; i++) { if (CBIT_TEST(diskdinfo->shm.inuse_map, i)) continue; @@ -1644,7 +1650,14 @@ buf = diskdinfo->shm.buf + (*shm_offset); break; } - assert(buf); + if (buf == NULL) { + if (last_logtime + 5 < squid_curtime) { + debug(20, 1) ("storeDiskdShmGet: Out of SHM memory. Increase SHMBUFS\n"); + debug(20, 1) ("storeDiskdShmGet: and recompile, or decrease Q1/Q2!\n"); + last_logtime = squid_curtime; + } + return NULL; + } assert(buf >= diskdinfo->shm.buf); assert(buf < diskdinfo->shm.buf + (SHMBUFS * SHMBUF_BLKSZ)); diskd_stats.shmbuf_count++; Index: src/fs/diskd/store_io_diskd.c =================================================================== RCS file: /server/cvs-server/squid/squid/src/fs/diskd/store_io_diskd.c,v retrieving revision 1.22 diff -u -r1.22 store_io_diskd.c --- src/fs/diskd/store_io_diskd.c 2001/05/30 17:40:26 1.22 +++ src/fs/diskd/store_io_diskd.c 2001/12/01 09:39:10 @@ -88,6 +88,13 @@ diskdstate->id = diskd_stats.sio_id++; buf = storeDiskdShmGet(SD, &shm_offset); + if (buf == NULL) { + debug(50, 2) ("storeDiskdOpen: Out of SHM, aborting operation\n"); + cbdataUnlock(sio->callback_data); + cbdataFree(sio); + diskd_stats.open.fail++; + return NULL; + } xstrncpy(buf, storeDiskdDirFullPath(SD, f, NULL), SHMBUF_BLKSZ); x = storeDiskdSend(_MQD_OPEN, SD, @@ -147,6 +154,13 @@ diskdstate->id = diskd_stats.sio_id++; buf = storeDiskdShmGet(SD, &shm_offset); + if (buf == NULL) { + debug(50, 2) ("storeDiskdCreate: Out of SHM, aborting operation\n"); + cbdataUnlock(sio->callback_data); + cbdataFree(sio); + diskd_stats.create.fail++; + return NULL; + } xstrncpy(buf, storeDiskdDirFullPath(SD, f, NULL), SHMBUF_BLKSZ); x = storeDiskdSend(_MQD_OPEN, SD, @@ -156,7 +170,7 @@ sio->mode, shm_offset); if (x < 0) { - debug(50, 1) ("storeDiskdSend OPEN: %s\n", xstrerror()); + debug(50, 1) ("storeDiskdSend OPEN (CREATE): %s\n", xstrerror()); storeDiskdShmPut(SD, shm_offset); cbdataUnlock(sio->callback_data); cbdataFree(sio); @@ -214,7 +228,12 @@ sio->offset = offset; diskdstate->flags.reading = 1; rbuf = storeDiskdShmGet(SD, &shm_offset); - assert(rbuf); + if (rbuf == NULL) { + debug(50, 2) ("storeDiskdRead: Out of SHM, aborting operation\n"); + storeDiskdIOCallback(sio, DISK_ERROR); + diskd_stats.read.fail++; + return; + } x = storeDiskdSend(_MQD_READ, SD, diskdstate->id, @@ -245,6 +264,13 @@ } diskdstate->flags.writing = 1; sbuf = storeDiskdShmGet(SD, &shm_offset); + if (buf == NULL) { + debug(50, 2) ("storeDiskdWrite: Out of SHM, aborting operation\n"); + cbdataUnlock(sio->callback_data); + storeDiskdIOCallback(sio, DISK_ERROR); + diskd_stats.write.fail++; + return; + } xmemcpy(sbuf, buf, size); if (free_func) free_func(buf); @@ -283,6 +309,12 @@ } /* We can attempt a diskd unlink */ buf = storeDiskdShmGet(SD, &shm_offset); + if (buf == NULL) { + debug(50, 2) ("storeDiskdUnlink: Out of SHM, forcing a sync unlink\n"); + unlink(storeDiskdDirFullPath(SD, e->swap_filen, NULL)); + diskd_stats.unlink.fail++; + return; + } xstrncpy(buf, storeDiskdDirFullPath(SD, e->swap_filen, NULL), SHMBUF_BLKSZ); x = storeDiskdSend(_MQD_UNLINK, SD,