varnish / varnish-modules

Collection of Varnish Cache modules (vmods) by Varnish Software
Other
185 stars 86 forks source link

`varnish-modules` needs to be compiled against the exact Varnish version as it is running #70

Closed joshuaspence closed 7 years ago

joshuaspence commented 7 years ago

Currently it seems that it is necessary to compile varnish-modules using the exact same version of varnish that it is going to be running with. This limitation seems overly permissive and I would expect it to only require the same API version.

joshuaspence commented 7 years ago

This is the error message that I am seeing at the moment, although I also see this error message if I compile from a slightly different commit that is after 6ece695.

Message from VCC-compiler:
Incompatible VMOD cookie
 File name: /usr/lib/varnish/vmods/libvmod_cookie.so
 ABI mismatch, expected <Varnish 5.1.2 6ece695>, got <Varnish 5.1.1 e1e7e764b>
dridi commented 7 years ago

FYI this one is tricky for several reasons:

dridi commented 7 years ago

So I finally did some digging and found that this is probably happening because 5.1.2 was released from the master branch:

http://varnish.org/docs/trunk/phk/somethinghappened.html#f3

I think we should get a VCC directive to choose between strict and version-based ABI checks, I will submit a patch for that. Packaging-wise, it wouldn't be a good idea to rely on loose dependencies because there are modules like xkey and soon bodyaccess (possibly others) that need strict ABI checks.

dridi commented 7 years ago

I submitted varnishcache/varnish-cache#2330 to fix that in the future, but for your case I'd like to know how you proceed when you pick a different varnish commit.

joshuaspence commented 7 years ago

I don't quite follow your question. The reason that I decided to build Varnish from master rather than using a tagged release (I think that this is what you are asking?) was that the previous Varnish 5.x releases were unusable for us due to frequent panics (see #2281).

dridi commented 7 years ago

OK, then you can do this:

When compiling master make sure to git checkout -b <name> a new temporary branch. This way you shouldn't be bothered by the strict ABI check.

I understand why you would prefer to build from git instead of a release, it's just that I finally found the root cause and varnish needs to be built from a differently-named branch if you want to allow loose ABI checks based on VRT major/minor.

joshuaspence commented 7 years ago

OK, makes sense. Does it matter what the branch is called? FWIW, I find it quite strange that the output from a build is dependent on the git branch from which it was built.

dridi commented 7 years ago

As of 5.1.2:

https://github.com/varnishcache/varnish-cache/blob/varnish-5.1.2/lib/libvcc/vcc_vmod.c#L158-L165

I disagree too, that's why I submitted a patch to do strict/loose ABI compliance differently.

joshuaspence commented 7 years ago

Looking forward to it!

dridi commented 7 years ago

FYI, fixed in varnishcache/varnish-cache#2330, part of Varnish 5.2, but needs some work here too.