Project

General

Profile

Actions

Bug #1279

closed

ETags using mtime are different between 32 and 64 bit builds

Added by pdwalker over 16 years ago. Updated about 16 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

1/ compile and install lighttpd 1.4.16 under Centos 32 bit on intel 32 bit machine

2/ compile and install lighttpd 1.4.16 under Centos 64 bit on AMD 64 bit machine

3/ add the following to the lighttpd.conf


etag.use-inode = "disable" 

4/ have both servers serve the same content that has been syncronized with rsync and verify


32bitMachine# stat index.html
# stat index.html 
  File: `index.html'
  Size: 14              Blocks: 8          IO Block: 4096   regular file
Device: 904h/2308d      Inode: 7260537     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1001/   mdrop)   Gid: ( 1001/   mdrop)
Access: 2007-07-31 09:15:08.000000000 +0000
Modify: 2007-07-31 07:22:09.000000000 +0000
Change: 2007-07-31 07:24:06.000000000 +0000

64bitMachine# stat index.html
# stat index.html
  File: `index.html'
  Size: 14              Blocks: 8          IO Block: 4096   regular file
Device: 904h/2308d      Inode: 14157066    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1001/   mdrop)   Gid: ( 1001/   mdrop)
Access: 2007-07-31 09:13:55.000000000 +0000
Modify: 2007-07-31 07:22:09.000000000 +0000
Change: 2007-07-31 07:24:14.000000000 +0000

5/ examine the request headers and verify the value of ETag between the architectures


# curl -I http://32bitMachine/index.html
HTTP/1.1 200 OK
Expires: Tue, 07 Aug 2007 09:22:39 GMT
Cache-Control: max-age=604800
Content-Type: text/html
Accept-Ranges: bytes
ETag: "959993575" 
Last-Modified: Tue, 31 Jul 2007 07:22:09 GMT
Content-Length: 14
Date: Tue, 31 Jul 2007 09:22:39 GMT
Server: lighttpd/1.4.16

# curl -I http://64bitMachine/index.html
HTTP/1.1 200 OK
Expires: Tue, 07 Aug 2007 09:22:47 GMT
Cache-Control: max-age=604800
Content-Type: text/html
Accept-Ranges: bytes
ETag: "6215558779006244678" 
Last-Modified: Tue, 31 Jul 2007 07:22:09 GMT
Content-Length: 14
Date: Tue, 31 Jul 2007 09:22:47 GMT
Server: lighttpd/1.4.16
Actions #1

Updated by yusufg over 16 years ago

Hi, Thanks for the bug report. This seems to be tricky to solve since the sizeof(long) which is the datatype of time_t differs between 32 and 64bit.

BTW, I also tested this with Apache on 32/64 bit with the following config line
FileETag MTime Size

and it gives different value too for 32 and 64bit systems

I'd recommend that if you have such a setup you could use either

a) etag.use-mtime = "disable"
b) static-file.etags = "disable"

Actions #2

Updated by pdwalker over 16 years ago

I am unable to confirm that problem with apache 1.3.37.


32BitServer# stat index.html

  File: `index.html'
  Size: 139             Blocks: 8          IO Block: 4096   regular file
Device: 904h/2308d      Inode: 4408777     Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/   mdrop)   Gid: ( 1001/   mdrop)
Access: 2007-08-03 07:16:21.000000000 +0000
Modify: 2006-06-30 04:16:11.000000000 +0000
Change: 2006-06-30 04:16:11.000000000 +0000

32BitServer# ./httpd -v

Server version: Apache/1.3.37 (Unix)
Server built:   Aug  3 2007 07:13:58

32BitServer#  curl -I http://32BitServer/

HTTP/1.1 200 OK
Date: Fri, 03 Aug 2007 07:16:31 GMT
Server: Apache/1.3.37
Cache-Control: max-age=86400
Expires: Sat, 04 Aug 2007 07:16:31 GMT
Last-Modified: Fri, 30 Jun 2006 04:16:11 GMT
ETag: "8b-44a4a58b" 
Accept-Ranges: bytes
Content-Length: 139
Content-Type: text/html

64BitServer# stat index.html 

  File: `index.html'
  Size: 139             Blocks: 8          IO Block: 4096   regular file
Device: 904h/2308d      Inode: 11650858    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/   mdrop)   Gid: ( 1001/   mdrop)
Access: 2007-07-31 08:06:26.000000000 +0000
Modify: 2006-06-30 04:16:11.000000000 +0000
Change: 2007-07-31 07:31:28.000000000 +0000

64BitServer# ./httpd -v

Server version: Apache/1.3.37 (Unix)
Server built:   Aug  3 2007 07:03:58

64BitServer# curl -I http://64BitServer/
HTTP/1.1 200 OK
Date: Fri, 03 Aug 2007 07:26:37 GMT
Server: Apache/1.3.37
Cache-Control: max-age=86400
Expires: Sat, 04 Aug 2007 07:26:37 GMT
Last-Modified: Fri, 30 Jun 2006 04:16:11 GMT
ETag: "8b-44a4a58b" 
Accept-Ranges: bytes
Content-Length: 139
Content-Type: text/html
Actions #3

Updated by pdwalker over 16 years ago

oh, and my httpd.conf


32BitServer# tail -2 httpd.conf
FileETag MTime Size


64BitServer# tail -2 httpd.conf
FileETag MTime Size

Actions #4

Updated by Anonymous over 16 years ago

Hi, Thanks for the bug report. This seems to be tricky to solve since the sizeof(long) which is the datatype of time_t differs between 32 and 64bit.

BTW, I also tested this with Apache on 32/64 bit with the following config line
FileETag MTime Size

and it gives different value too for 32 and 64bit systems

I'd recommend that if you have such a setup you could use either

a) etag.use-mtime = "disable"
b) static-file.etags = "disable"

-- yusufg

Actions #5

Updated by Anonymous over 16 years ago

Hi Yusuf,

As I said, Apache 1.37 gives the same values under 32 and 64 bit systems, so it would appear that there is a solution.

Actions #6

Updated by moo over 16 years ago

never mind, i recycle previous msg from spamfilter while i didn't notice it was post successfully

Actions #7

Updated by jan over 16 years ago

  • Status changed from New to Assigned

Can you try a small patch:


Index: src/etag.c
===================================================================
--- src/etag.c  (revision 1881)
+++ src/etag.c  (working copy)
@@ -37,7 +37,11 @@

        buffer_reset(mut);
        buffer_copy_string_len(mut, CONST_STR_LEN("\""));
+#if 0
        buffer_append_long(mut, h);
+#else
+       buffer_append_string_buffer(mut, etag);
+#endif
        buffer_append_string_len(mut, CONST_STR_LEN("\""));

        return 0;

and compare the etags ?

Actions #8

Updated by Anonymous over 16 years ago

Looks like we have a winner with the patched etag.c

  • check the build versions to make sure I do have the latest compiled version running

32BitServer# lighttpd -version
lighttpd-1.4.16 - a light and fast webserver
Build-Date: Aug 13 2007 14:23:22

64BitServer# lighttpd -version
lighttpd-1.4.16 - a light and fast webserver
Build-Date: Aug 13 2007 14:23:12
  • check the file to make sure the mtime and size are the same

32BitServer# stat index.html 
  File: `index.html'
  Size: 14              Blocks: 8          IO Block: 4096   regular file
Device: 902h/2306d      Inode: 7701956     Links: 1
Access: (0664/-rw-rw-r--)  Uid: (   99/  nobody)   Gid: ( 1001/   mdrop)
Access: 2007-08-13 14:40:05.000000000 +0000
Modify: 2007-07-31 07:22:09.000000000 +0000
Change: 2007-08-10 19:06:48.000000000 +0000

64BitServer# stat index.html 
  File: `index.html'
  Size: 14              Blocks: 8          IO Block: 4096   regular file
Device: 904h/2308d      Inode: 10913010    Links: 1
Access: (0664/-rw-rw-r--)  Uid: (   99/  nobody)   Gid: ( 1001/   mdrop)
Access: 2007-08-13 14:04:38.000000000 +0000
Modify: 2007-07-31 07:22:09.000000000 +0000
Change: 2007-08-10 19:06:50.000000000 +0000
  • disable both inode and mtime in the lighttpd.conf

32BitServer# tail -2 lighttpd.conf
etag.use-inode = "disable" 
etag.use-mtime = "disable" 

64BitServer# tail -2 lighttpd.conf
etag.use-inode = "disable" 
etag.use-mtime = "disable" 
  • verify the results returned after restarting lighttpd and verify the etags are the same

32BitServer# curl -I http://32BitServer/index.html
HTTP/1.1 200 OK
Expires: Mon, 20 Aug 2007 14:09:27 GMT
Cache-Control: max-age=604800
Content-Type: text/html
Accept-Ranges: bytes
ETag: "1594784" 
Last-Modified: Tue, 31 Jul 2007 07:22:09 GMT
Content-Length: 14
Date: Mon, 13 Aug 2007 14:09:27 GMT
Server: lighttpd/1.4.16

$ curl -I http://64BitServer/index.html
HTTP/1.1 200 OK
Expires: Mon, 20 Aug 2007 14:09:36 GMT
Cache-Control: max-age=604800
Content-Type: text/html
Accept-Ranges: bytes
ETag: "1594784" 
Last-Modified: Tue, 31 Jul 2007 07:22:09 GMT
Content-Length: 14
Date: Mon, 13 Aug 2007 14:09:36 GMT
Server: lighttpd/1.4.16
  • now enable mtime etags

32BitServer# tail -2 lighttpd.conf
etag.use-inode = "disable" 
etag.use-mtime = "enable" 

64BitServer# tail -2 lighttpd.conf
etag.use-inode = "disable" 
etag.use-mtime = "enable" 
  • restart lighttpd and verify the etag

32BitServer# curl -I http://32BitServer/index.html
HTTP/1.1 200 OK
Expires: Mon, 20 Aug 2007 14:38:17 GMT
Cache-Control: max-age=604800
Content-Type: text/html
Accept-Ranges: bytes
ETag: "14-1185866529" 
Last-Modified: Tue, 31 Jul 2007 07:22:09 GMT
Content-Length: 14
Date: Mon, 13 Aug 2007 14:38:17 GMT
Server: lighttpd/1.4.16

64BitServer# curl -I http://64BitServer/index.html
HTTP/1.1 200 OK
Expires: Mon, 20 Aug 2007 14:38:15 GMT
Cache-Control: max-age=604800
Content-Type: text/html
Accept-Ranges: bytes
ETag: "14-1185866529" 
Last-Modified: Tue, 31 Jul 2007 07:22:09 GMT
Content-Length: 14
Date: Mon, 13 Aug 2007 14:38:15 GMT
Server: lighttpd/1.4.16
  • The OS is Centos 4.5 32 bit on an Intel Xeon for 32BitMachine
  • The OS is Centos 4.5 64 bit on an AMD 248 cpu for 64BitMachine

Hope that helps.

Actions #9

Updated by pdwalker over 16 years ago

(oh, that last post was by me, sorry, forgot to login)

Actions #10

Updated by jan over 16 years ago

  • Status changed from Assigned to Fixed
  • Resolution set to fixed

fixed in r1908 for 1.4.x and r1909 for 1.5.0

Actions

Also available in: Atom