Skip to content

Conversation

@nigoroll
Copy link
Member

Similar to how vmods can be loaded by their base name, we now support loading
extensions using, for example, -Estd:

If a path is specified (-E argument contains "/"), it is taken literally as
before. Otherwise, the -E argument is expanded to libvmod_%s.so and a search in
vmod_path is conducted..

The first commit is just a minor refactoring to move the VEXT code to mgt.

@nigoroll nigoroll force-pushed the vext_simplify branch 4 times, most recently from e867dd3 to 713e244 Compare December 2, 2025 18:02
@walid-git
Copy link
Member

The asan job is reporting a leak here:

*** v1 debug|=================================================================
*** v1 debug|==111424==ERROR: LeakSanitizer: detected memory leaks
*** v1 debug|
*** v1 debug|Indirect leak of 32 byte(s) in 1 object(s) allocated from:
*** v1 debug| #0 0x7f6fc6355340 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
*** v1 debug| #1 0x558811bd45d8 in VFIL_setpath /workspace/lib/libvarnish/vfil.c:307
*** v1 debug| #2 0x558811a60e0a in vext_argument mgt/mgt_vext.c:104
*** v1 debug| #3 0x558811a30cf3 in main mgt/mgt_main.c:808
*** v1 debug| #4 0x7f6fc55d01c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
*** v1 debug| #5 0x7f6fc55d028a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
*** v1 debug| #6 0x558811730ab4 in _start (/workspace/bin/varnishd/varnishd+0x85cab4) (BuildId: 9538b9af3300f39414978a5e327595cb917edf8c)
*** v1 debug|
*** v1 debug|Indirect leak of 32 byte(s) in 1 object(s) allocated from:
*** v1 debug| #0 0x7f6fc6355340 in calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:77
*** v1 debug| #1 0x558811bd52c1 in VFIL_setpath /workspace/lib/libvarnish/vfil.c:323
*** v1 debug| #2 0x558811a60e0a in vext_argument mgt/mgt_vext.c:104
*** v1 debug| #3 0x558811a30cf3 in main mgt/mgt_main.c:808
*** v1 debug| #4 0x7f6fc55d01c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
*** v1 debug| #5 0x7f6fc55d028a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
*** v1 debug| #6 0x558811730ab4 in _start (/workspace/bin/varnishd/varnishd+0x85cab4) (BuildId: 9538b9af3300f39414978a5e327595cb917edf8c)
*** v1 debug|
*** v1 debug|Indirect leak of 13 byte(s) in 1 object(s) allocated from:
*** v1 debug| #0 0x7f6fc634f4e8 in strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:578
*** v1 debug| #1 0x558811bd493e in VFIL_setpath /workspace/lib/libvarnish/vfil.c:312
*** v1 debug| #2 0x558811a60e0a in vext_argument mgt/mgt_vext.c:104
*** v1 debug| #3 0x558811a30cf3 in main mgt/mgt_main.c:808
*** v1 debug| #4 0x7f6fc55d01c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
*** v1 debug| #5 0x7f6fc55d028a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
*** v1 debug| #6 0x558811730ab4 in _start (/workspace/bin/varnishd/varnishd+0x85cab4) (BuildId: 9538b9af3300f39414978a5e327595cb917edf8c)
*** v1 debug|
*** v1 debug|-----------------------------------------------------
*** v1 debug|Suppressions used:
*** v1 debug| count bytes template
*** v1 debug| 2 136 HSH_config
*** v1 debug| 10 480 vsmw_newcluster
*** v1 debug|-----------------------------------------------------
*** v1 debug|
*** v1 debug|SUMMARY: AddressSanitizer: 77 byte(s) leaked in 3 allocation(s).

@nigoroll
Copy link
Member Author

nigoroll commented Dec 3, 2025

Yes, we usually leak in mgt.

VEXTs get loaded early after the worker process fork, but that code is owned by
mgt and, after that, the cache worker has no business in VEXTs.

The variable rename is to avoid shadowing
Similar to how vmods can be loaded by their base name, we now support loading
extensions using, for example, -Estd:

If a path is specified (-E argument contains "/"), it is taken literally as
before. Otherwise, the -E argument is expanded to libvmod_%s.so and a search in
vmod_path is conducted.
It was mentioned in usage, but not in the actual reference documentation.
@nigoroll nigoroll merged commit 7fb27fb into varnishcache:master Dec 8, 2025
1 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants