Bug #1279
ETags using mtime are different between 32 and 64 bit builds
| Status: | Fixed | Start: | ||
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | core | |||
| Target version: | 1.4.17 | |||
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
Associated revisions
make sure that hash-function always uses a 32bit int (fixes #1279)
merged [1908] from 1.4.x (fixes #1279)
History
Updated by yusufg about 1 year 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"
Updated by pdwalker about 1 year 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
Updated by pdwalker about 1 year ago
oh, and my httpd.conf
32BitServer# tail -2 httpd.conf FileETag MTime Size
64BitServer# tail -2 httpd.conf FileETag MTime Size
Updated by Anonymous about 1 year 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
Updated by Anonymous about 1 year 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.
Updated by moo about 1 year ago
never mind, i recycle previous msg from spamfilter while i didn't notice it was post successfully
Updated by jan about 1 year 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 ?
Updated by Anonymous about 1 year 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.
Updated by jan about 1 year ago
- Status changed from Assigned to Fixed
- Resolution set to fixed