[Varnish] #1336: varnishlog fails to parse log records > 1016 bytes

Varnish varnish-bugs at varnish-cache.org
Thu Sep 5 01:01:38 CEST 2013


#1336: varnishlog fails to parse log records > 1016 bytes
---------------------+------------------------
 Reporter:  mkasick  |       Type:  defect
   Status:  new      |   Priority:  normal
Milestone:           |  Component:  varnishlog
  Version:  3.0.4    |   Severity:  normal
 Keywords:           |
---------------------+------------------------
 There is a bug present in the 3.0 branch, including HEAD (presently
 0a7e6caa0c6bd93003d4733e96f5ea054ac84cbc), whereby varnishlog fails to
 parse log records > 1016 bytes from a log file (as opposed to shared
 memory).

 Specifically, the bug is present in
 lib/libvarnishapi/vsl.c:162:vsl_nextlog where vsl->rbuf is reallocated to
 support log entries larger than 256 words.  Here, the new word-size of
 rbuf is calculated and assigned to "l", and after the buffer is
 reallocated, the log record is read with it's size specified using the
 same, now incorrect "l" value.

 Attached is a patch that addresses this issue by assigning the new buffer
 size to a new variable, "nl", leaving "l" untouched for the following read
 operation.

 Steps to trigger this bug:

 1. Start varnishd with `-p shm_reclen=1017` or larger; any reasonable VCL
 with a defined default backend will do.
 2. Start varnishlog writing to a file: `varnishlog -w /tmp/varnish.log`
 3. Make a large request: `ruby -r socket -e 'Socket.tcp("localhost", 80)
 {|s| s << "GET #{(0...2*1024).step(8).map {|n| ("%8d" % n).gsub(" ",
 ".")}.join} HTTP/1.0\r\n\r\n"}`
 4. Read the log entries from the file: `varnishlog -r /tmp/varnish.log`

 Expected output: The full client request including the ReqEnd record.
 Actual output: varnishlog stops abruptly after the large RxURL record.

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1336>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list