Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#47880 closed defect (fixed)

squid3 @3.5.5 run fails with "cannot change current directory to /opt/local/var/squid/cache/squid"

Reported by: TP75 Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: danielluke (Daniel J. Luke)
Port: squid3

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Squid3 compiles but "load squid3" run fails with syslog err "failed to ftruncate" regularily. The child squid is stopped due to the resulting file troubles apparently.

This issue seems not be solved by Ticket #47080

Error is active since changing from 3.4.11 to 3.5.x and would be good to have a squid3_3.4.x variant continued, I suppose.


entry for error from system.log:

Ipc::Mem::Segment::create failed to ftruncate(/squid-cf__metadata.shm): (22) Invalid argument

squid -v

Squid Cache: Version 3.5.5
Service Name: squid
configure options:  '--prefix=/opt/local' '--mandir=/opt/local/share/man' '--sysconfdir=/opt/local/etc/squid' '--datadir=/opt/local/share/squid' '--localstatedir=/opt/local/var/squid' '--libexecdir=/opt/local/libexec/squid' '--with-pidfile=/opt/local/var/run/squid/squid.pid' '--disable-strict-error-checking' '--disable-loadable-modules' '--disable-arch-native' '--without-gnutls' '--without-mit-krb5' '--without-heimdal-krb5' '--without-gnugss' '--enable-delay-pools' '--enable-zph-qos' '--enable-removal-policies' '--enable-storeio=ufs,aufs,diskd,rock' '--enable-disk-io=AIO,Blocking,DiskDaemon,DiskThreads,Mmapped' '--enable-log-daemon-helpers' '--with-default-user=squid' '--enable-auth' '--enable-auth-basic' '--enable-auth-digest' '--enable-auth-negotiate=wrapper' '--enable-auth-ntlm' '--enable-external-acl-helpers=SQL_session eDirectory_userip file_userip time_quota unix_group wbinfo_group' '--with-openssl=/opt/local' 'CC=/usr/bin/clang' 'CFLAGS=-pipe -Os -arch x86_64' 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64' 'CPPFLAGS=-I/opt/local/include' 'CXX=/usr/bin/clang++' 'CXXFLAGS=-pipe -Os -arch x86_64 -stdlib=libc++'

environment:

Apple Mac OS X 10.9.5 (13F1077)
Apple XCode Version 6.2 (6C131e)

macports 2.3.3
squid3 @3.5.5_0+openssl

=====

Change History (10)

comment:1 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jmr@… removed
Description: modified (diff)
Keywords: squid3 squid 3.5.5 removed
Owner: changed from macports-tickets@… to jmr@…

comment:2 Changed 9 years ago by jmroot (Joshua Root)

The ftruncate failure happens when squid is starting up again after it has exited abnormally (and thus not unlinked its shared memory segments before exiting). So the actual problem is whatever is causing the abnormal termination before squid restarts and prints that message.

comment:3 in reply to:  2 Changed 9 years ago by TP75

Replying to jmr@…:

The ftruncate failure happens when squid is starting up again after it has exited abnormally (and thus not unlinked its shared memory segments before exiting). So the actual problem is whatever is causing the abnormal termination before squid restarts and prints that message.

Thanks. However, this issue comes around both on different machines with prior squid3 3.4.11 directories and with total fresh installation of MacPorts 2.3.3 with squid3 3.5.5 variant.

Please find the first two startup logs from system.log after a fresh install below:


  • squid[18516]: Squid Parent: will start 1 kids
  • squid[18516]: Squid Parent: (squid-1) process 18518 started
  • squid[18519]: storeDirWriteCleanLogs: Starting...
  • squid[18518]: cannot change current directory to /opt/local/var/squid/cache/squid: (2) No such file or directory
  • squid[18519]: Finished. Wrote 0 entries.
  • squid[18518]: Current Directory is /opt/local/var/squid
  • squid[18519]: Took 0.00 seconds ( 0.00 entries/sec).
  • squid[18519]: Ipc::Mem::Segment::create failed to ftruncate(/squid-cfmetadata.shm): (22) Invalid argument
  • squid[18518]: Creating missing swap directories
  • squid[18518]: No cache_dir stores are configured.
  • squid[18516]: Squid Parent: (squid-1) process 18518 exited with status 0
  • com.apple.launchd[1] (org.macports.Squid[18513]): Exited with code: 2
  • squid[18526]: Squid Parent: will start 1 kids
  • squid[18526]: Squid Parent: (squid-1) process 18528 started
  • squid[18528]: cannot change current directory to /opt/local/var/squid/cache/squid: (2) No such file or directory
  • squid[18529]: storeDirWriteCleanLogs: Starting...
  • squid[18529]: Finished. Wrote 0 entries.
  • squid[18528]: Current Directory is /opt/local/var/squid
  • squid[18529]: Took 0.00 seconds ( 0.00 entries/sec).
  • squid[18529]: Ipc::Mem::Segment::create failed to ftruncate(/squid-cfmetadata.shm): (22) Invalid argument
  • squid[18528]: Creating missing swap directories
  • squid[18528]: No cache_dir stores are configured.
  • squid[18526]: Squid Parent: (squid-1) process 18528 exited with status 0
  • com.apple.launchd[1] (org.macports.Squid[18523]): Exited with code: 2

This chain of failed runs will continue both on fresh and on pre-used machines similarly or even after successful directory builds until a "port unload squid3" is given.

How to continue on this issue? Which data do you need for further investigation?

comment:4 Changed 9 years ago by jmroot (Joshua Root)

That should be plenty. It is in fact the same as #47080:

cannot change current directory to /opt/local/var/squid/cache/squid: (2) No such file or directory

comment:5 Changed 9 years ago by jmroot (Joshua Root)

Summary: squid 3.5.4 and squid 3.5.5 run fails with syslog err "failed to ftruncate"squid @3.5.5 run fails with "cannot change current directory to /opt/local/var/squid/cache/squid"

comment:6 Changed 9 years ago by jmroot (Joshua Root)

Cc: dluke@… added
Resolution: fixed
Status: newclosed
Summary: squid @3.5.5 run fails with "cannot change current directory to /opt/local/var/squid/cache/squid"squid3 @3.5.5 run fails with "cannot change current directory to /opt/local/var/squid/cache/squid"

comment:7 Changed 9 years ago by jmroot (Joshua Root)

You may need to update the cache_dir setting in your squid.conf if it’s pointing to a nonexistent directory, BTW.

comment:8 in reply to:  7 Changed 9 years ago by TP75

Replying to jmr@…:

You may need to update the cache_dir setting in your squid.conf if it’s pointing to a nonexistent directory, BTW.

Thanks. However, you may have missed the point, that I have this issue in particular with a working dir setting since changing from 3.4.11 to 3.5.3 due to the MacPorts upgrade. A former 3.4.x adjusted profile should work with 3.5.x, I presume?

BTW Shouldn't the default profile just nicely build a default directory in a fresh environment or am I wrong?

comment:9 Changed 9 years ago by jmroot (Joshua Root)

Yes the default should work in a fresh environment, but the default was wrong. That’s what I fixed. Updating the port will not touch an existing squid.conf, so if you have a reference to /opt/local/var/squid/cache/squid in there (rather than /opt/local/var/squid/cache) you will need to either change it or create that directory. I can’t tell you what series of events led to the current state of your squid.conf, but your log output is very clear that it is referencing /opt/local/var/squid/cache/squid.

comment:10 in reply to:  9 Changed 9 years ago by TP75

Replying to jmr@…:

Yes the default should work in a fresh environment, but the default was wrong. That’s what I fixed. Updating the port will not touch an existing squid.conf, so if you have a reference to /opt/local/var/squid/cache/squid in there (rather than /opt/local/var/squid/cache) you will need to either change it or create that directory. I can’t tell you what series of events led to the current state of your squid.conf, but your log output is very clear that it is referencing /opt/local/var/squid/cache/squid.

Thank you very much. This helped. With the 3.5.5_1 patch I was able to upgrade the 3.4.11 squid environment without trouble on my second machine.

Your observations on the logs are correct. Unfortunately, I was missing the point by using a fresh startup and did not take the effort to dig for the original logs and squid.conf on the first machine.

Note: See TracTickets for help on using tickets.