Commit f9a8797d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Ohh, man...

So imagine an object during fetch, where we have allocated
the storage for the object structure, the persistent silo
gets synced, so the data ends up in the next segment, and
then we crash before that segment gets synched to silo.

On restart the object looks good, until we try to access
its storage... *bewm*

This is a stopgap, that catches such objects and neuters
them, using a set of paranoid sanitychecks we should
employ in any case.

There still is a relevant hole: As above, but after
the restart we manage to write a new segment before
the initial object is accessed, and it happens to
have a storage structure just the same place (not
unlikely at the beginning)

We do not crash in this case, but deliver wrong content.

Did I ever mention that -spersistent for all practical
purposes is a filesytem ?
parent 8edfa76c
# $Id$
test "test reload of object spanning incomplete segment"
server s1 {
rxreq
expect req.url == "/1"
send "HTTP/1.1 200 Ok\n"
send "Transfer-encoding: chunked\n"
send "\n"
chunkedlen 32
# Tell top-level that it can sync the stevedore
sema r1 sync 2
# Top-level tells us it has synched the stevedore
sema r1 sync 2
chunkedlen 32
chunkedlen 0
accept
rxreq
expect req.url == "/2"
txresp -bodylen 100
rxreq
expect req.url == "/1"
txresp -bodylen 48
} -start
varnish v1 -storage "-spersistent,${tmpdir}/_.per,10m" \
-vcl+backend {} -start
varnish v1 -cliok "debug.fragfetch 32"
client c1 {
txreq -url "/1"
rxresp
expect resp.bodylen == 64
} -start
# Wait for first chunk to have been sent
sema r1 sync 2
delay .2
# Sync the stevedore, so the next chunk ends up i segment 2
varnish v1 -cliok "debug.persistent s0 sync"
# Tell server to continue
sema r1 sync 2
# Get the result
client c1 -wait
varnish v1 -cliok "debug.persistent s0 dump"
# Panic worker so second segment does not get closed
varnish v1 -clierr 400 "debug.panic.worker"
# start again
varnish v1 -start
client c1 {
# Make sure there is not a valid "struct storage" in second seg.
txreq -url "/2"
rxresp
expect resp.bodylen == 100
# Fetch the vampire object and see how that goes...
txreq -url "/1"
rxresp
expect resp.bodylen == 48
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment