[Varnish] #580: Esoteric path problem on Solaris 10 using SMF (unable to load compiled VCL file)

Varnish varnish-bugs at projects.linpro.no
Tue Nov 17 18:36:09 CET 2009


#580: Esoteric path problem on Solaris 10 using SMF (unable to load compiled VCL
file)
----------------------+-----------------------------------------------------
 Reporter:  whocares  |       Owner:  phk        
     Type:  defect    |      Status:  new        
 Priority:  normal    |   Milestone:             
Component:  varnishd  |     Version:  2.0        
 Severity:  normal    |    Keywords:  Solaris SMF
----------------------+-----------------------------------------------------
 First of all: Sorry, this is going to be looooong.

 '''The short question:'''
 Are there any differences between running Varnish from the command line
 compared to running Varnish from Solaris' Service Management Facility that
 immediately come to mind? Because I'm currently tearing my hair out
 because it won't work using SMF.

 '''The long expalanation:'''
 After applying the patch from r4349 I was able to compile Varnish using
 !SunStudio but now I'm running into another problem that maybe also
 affected my unsuccessful tries when using GCC 4.4.2. In short `varnishd`
 seems to be unable to find it's compiled VCL on startup. This only happens
 when I try to use Solaris' Service Management Facility (SMF) to run
 Varnish. Starting from the command line works fine.

 Ok, here's what I tried until now:

 Compile settings:

 {{{
 cd varnish-2.0.5

 XTARGET="opteron -xarch=sse3"
 export CFLAGS="-fast -xtarget=${XTARGET} -m64 -mt -Kpic"
 export CPPFLAGS="-fast -xtarget=${XTARGET} -m64 -mt -Kpic"
 export LDFLAGS="-fast -xtarget=${XTARGET} -m64 -mt -Kpic -lumem"
 export VCC_CC="vcc %o %s"

 if [ -f config.log ]; then
     gmake distclean 2>&1 >> /dev/null
 fi

 ./configure   --prefix=/opt/soft \
               --sysconfdir=/opt/conf \

 }}}

 As you can see, this sets VCC_CC to an external script `vcc`, the contents
 of which is:

 {{{
 #
 env > /tmp/vcc.env
 pwd >> /tmp/vcc.env

 cc -fast -xtarget=opteron -xarch=sse3 -m64 -mt -Kpic -c -o $1 $2
 cp $1 /tmp/$1.sru
 cp $2 /tmp/$2.sru
 }}}

 This is just to capture some of the environment variables and to copy the
 files used to a safe location so that I can see that `varnishd` actually
 compiled something.

 Now, when I start varnish using this commandline:

 {{{
 /opt/soft/varnish/sbin/varnishd -F -a 192.168.27.33:80 -T
 192.168.27.33:6082 -t 1800 -w 50,1000,120 -s
 file,/data/varnish/varnish_store.bin,4G -p obj_workspace=16384 -f
 /opt/conf/varnish/www.vcl
 }}}

 I'll get this output from `varnishlog`:
 {{{
 #root at soldevamd:~# /opt/soft/varnish/bin/varnishlog
     0 WorkThread   - fffffd7ff97e0d80 start
     0 CLI          - Rd vcl.load boot ./vcl.ORk8t3RP.so
     0 CLI          - Wr 0 200 Loaded "./vcl.ORk8t3RP.so" as "boot"
     0 CLI          - Rd vcl.use boot
     0 Backend_health - lb01 Back healthy --------H 1 1 2 0.000000 0.000000
     0 CLI          - Wr 0 200
     0 CLI          - Rd start
     0 Debug        - "Acceptor is ports"
     0 CLI          - Wr 0 200
     0 Backend_health - lb01 Still healthy 4--X-S-RH 2 1 2 0.002183
 0.001091 HTTP/1.1 200 OK
     0 WorkThread   - fffffd7f78bfed80 start
     0 WorkThread   - fffffd7f589fed80 start
     0 WorkThread   - fffffd7f387fed80 start
     (... many more WorkThreads ...)
 }}}

 Also, I get some files in `/tmp` created by the `vcc` script:
 {{{
 #root at soldevamd:~# ls -al /tmp/vc*
 -rw-r--r--   1 root     root        1022 Nov 17 18:02 /tmp/vcc.env
 -rw-------   1 root     root       45322 Nov 17 18:02
 /tmp/vcl.ORk8t3RP.c.sru
 -rw-r--r--   1 root     root       37224 Nov 17 18:02
 /tmp/vcl.ORk8t3RP.so.sru
 #root at soldevamd:~#
 }}}

 And the `.so` will also be in the exptected location:

 {{{
 #root at soldevamd:~# ls -al /opt/soft/varnish/var/varnish/soldevamd/
 Gesamt 318
 -rw-r--r--   1 root     root     83952688 Nov 17 18:03 _.vsl
 drwxr-xr-x   2 root     root         512 Nov 17 18:02 .
 drwxr-xr-x   4 root     root         512 Nov 17 17:33 ..
 -rw-r--r--   1 root     root       37224 Nov 17 18:02 vcl.ORk8t3RP.so
 #root at soldevamd:~#
 }}}

 So far, so good. However, if using the SMF, the following will happen:
 Once I start Varnish using `svcadm enable varnish` the following will show
 up in the output from `varnishlog`:
 {{{
 #root at soldevamd:~# /opt/soft/varnish/bin/varnishlog
     0 WorkThread   - fffffd7ff97e0d80 start
     0 CLI          - Rd vcl.load boot ./vcl.ORk8t3RP.so
     0 CLI          - Wr 0 106 dlopen(./vcl.ORk8t3RP.so): ld.so.1:
 varnishd: Schwerer Fehler: ./vcl.ORk8t3RP.so: Öffnen fehlgeschlagen: Datei
 oder Verzeichnis nicht gefunden

     0 CLI          - EOF on CLI connection, worker stops
 }}}

 At first I thought this was due to an error while compiling the VCL. But
 as it turns out, according to the `vcc` script an `.so` file was actually
 generated and even the correct one:

 {{{
 #root at soldevamd:~# ls -al /tmp/vc*
 -rw-r--r--   1 root     root         679 Nov 17 18:06 /tmp/vcc.env
 -rw-------   1 root     root       45322 Nov 17 18:06
 /tmp/vcl.ORk8t3RP.c.sru
 -rw-r--r--   1 root     root       37224 Nov 17 18:06
 /tmp/vcl.ORk8t3RP.so.sru
 #root at soldevamd:~#
 }}}

 It just doesn't happen to make it to where `varnishd` tries looking for
 it:

 {{{
 #root at soldevamd:~# ls -al /opt/soft/varnish/var/varnish/soldevamd/
 Gesamt 244
 -rw-r--r--   1 root     root     83952688 Nov 17 18:03 _.vsl
 drwxr-xr-x   2 root     root         512 Nov 17 18:06 .
 drwxr-xr-x   4 root     root         512 Nov 17 17:33 ..
 #root at soldevamd:~#
 }}}

 The strangest thing is that when I telnet to `varnishd` and make it load
 the VCL manually, it will compile at least compile them:

 {{{
 #root at soldevamd:~# telnet 192.168.27.33 6082
 Trying 192.168.27.33...
 Connected to 192.168.27.33.
 Escape character is '^]'.
 vcl.list
 200 23
 active        N/A boot

 vcl.show boot
 300 138
 failed to load boot: ld.so.1: varnishd: Schwerer Fehler:
 ./vcl.ORk8t3RP.so: Öffnen fehlgeschlagen: Datei oder Verzeichnis nicht
 gefunden

 vcl.load test /opt/conf/varnish/www.vcl
 200 13
 VCL compiled.
 vcl.list
 200 46
 active        N/A boot
 available     N/A test

 vcl.use test
 200 0

 vcl.list
 200 46
 available     N/A boot
 active        N/A test

 vcl.show test
 200 2861
 backend lb01 {
   .host = "127.0.0.1";
   .port = "80";
   .probe = {
            .url = "/balance.html";
            .timeout = 100 ms;
            .interval = 5s;
            .window = 2;
            .threshold = 1;
            }
 }
 (... rest of VCL deleted ...)
 }}}

 The most notable thing about this is that although it will compile, it
 won't be usable as is already denoted by the `N/A` flag in the output of
 `vcl.list` - even if this time the `.so` _will_ get created:

 {{{
 #root at soldevamd:~# ls -al /opt/soft/varnish/var/varnish/soldevamd/
 Gesamt 350
 -rw-r--r--   1 root     root     83952688 Nov 17 18:23 _.vsl
 drwxr-xr-x   2 root     root         512 Nov 17 18:24 .
 drwxr-xr-x   4 root     root         512 Nov 17 17:33 ..
 -rw-r--r--   1 root     root       37224 Nov 17 18:24 vcl.hndxcCNb.so
 #root at soldevamd:~#
 }}}

 I'm at a loss at what to try next to make it work using SMF.

 Well, thanks for reading this far. If you've got any idea or if there's
 some additional info you need, just let me know.

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/580>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list