Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

varnish tracking tkt #1194

Open
eyberg opened this issue Jun 4, 2020 · 1 comment
Open

varnish tracking tkt #1194

eyberg opened this issue Jun 4, 2020 · 1 comment

Comments

@eyberg
Copy link
Contributor

eyberg commented Jun 4, 2020

when ran in foreground mode varnish still wants to fork - not sure what it actually is doing as I haven't looked

 ops run -d -c config.json -p 8080 varnishd
cat config.json
{
  "Dirs": ["usr"],
  "Args": ["./varnishd", "-F", "-b", ":8080"]
}
1 clone: flags 1200011, child_stack 0x0000000000000000, ptid 0x0000000000000000, ctid 0x000000019679b450, newtls 0
1 attempted to fork by passing null child stack, aborting.
1 direct return: -38, rsp 0x7ff3ba60

also - I've noticed some behavior I saw in clickchouse where tens of thousands of fds seem to be opened and closed

fchown needs to be stubbed

#1193

@francescolavra
Copy link
Member

It looks like there is no way to prevent varnishd from trying to fork: it forks (regardless of the -F option) whenever it wants to run the VCL compiler, by calling the mgt_vcl_startup() function. The value of the -b command line option that identifies the backend server is translated into a VCL statement, which then needs to be compiled, and that's where it fails.
Regarding the tens of thousands of file descriptors, it actually doesn't open them, it just tries to close them: at https://github.com/varnishcache/varnish-cache/blob/master/bin/varnishd/mgt/mgt_main.c there is this comment: "Start out by closing all unwanted file descriptors we might have inherited from sloppy process control daemons", and since VSUB_closefrom() at https://github.com/varnishcache/varnish-cache/blob/master/lib/libvarnish/vsub.c tries to get all open file descriptors from the /proc/self/fd directory (which we don't have) and failing that falls back to getting the maximum file descriptor number via sysconf(_SC_OPEN_MAX) (which in Nanos returns 65536), the application ends up calling close() on all file descriptors from 65536 to 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants