apache2 の扱えるファイルサイズには 2GB、4GB それぞれに壁があるという話を聞いたので、手元の apache2 2.0.52-3vd1 で確認してみる。2GB、4GB のファイルを作成。
% touch 2GB 4GB % perl -e 'truncate shift, shift' 2GB 2349991936 % perl -e 'truncate shift, shift' 4GB 4699983872
telnet で接続して確認してみる。
% telnet localhost 80 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. HEAD /2GB HTTP/1.0 HTTP/1.1 403 Forbidden Date: Tue, 11 Jan 2005 22:08:54 GMT Server: Apache Connection: close Content-Type: text/html; charset=iso-8859-1 Connection closed by foreign host.
error_log には
[Wed Jan 12 07:08:54 2005] [error] [client 127.0.0.1] (75)Value too large for defined data type: access to /2GB failed
と記録された。4GB でも同様の結果。
まず、話の中で出てきた Large file support (> 4GB) for platforms w/ 32-bit size_t and 64-bit off_t で示されている ap_splitlfs.diff を当ててみる。が、結果は変わらず。
さらに調べてみると、#241223 にて
LARGEFILE_SOURCE FILE_OFFSET_BITS=64
というコンパイルオプションが示されている。 また、/usr/share/doc/apache2-common/README.Debian を見てみると、
- Despite large file support being enabled, you won't actually be able to SERVE large files from apache2 unless you're using a kernel that supports the sendfile64 syscall. For i386, this is any recent 2.4.x or 2.6.x kernel, for most other architectures, this means an upgrade to 2.6.x.
[/usr/share/doc/apache2-common/README.Debianより引用]
となっているが、2.6.x に上げてしまっているので問題ない。
結果、ap_splitlfs.diff を当て、_LARGEFILE_SOURCE 及び _FILE_OFFSET_BITS=64 のコンパイルオプションを渡して apache2 を build したところ、2GB、4GB のファイルどちらも問題なく扱えるようになった。
ap_splitlfs.diff を当てた vd2 を作成。だが、うまく動作しなかった。
さらに、debian/rules でコメントアウトされている
AP2_CONFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
を有効にした vd3 を作成。こちらは問題なく動作した。
wget にも 2GB の壁があるようだ。2GB のファイルを転送しようとすると、取得サイズが負になっていて途中で切れてしまった。#240281 で示されている int64_t.patch を当てて vd1 作成。
って、http だけ対処か...。ftpd のチェックに wget を使ったら、最後の最後で core 吐いた。いろいろ探してみると、 Large file support for wget under Unix で patch を発見したのでこれを当てて vd2 作成。
ビルドはできたがミスってたので修正して vd3 作成。http/ftp どちらもきちんと動作した。
lukemftp にも 2GB の壁。コンパイルオプションに -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 を追加して対処。
前 | 2005年 1月 |
次 | ||||
日 | 月 | 火 | 水 | 木 | 金 | 土 |
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
[amd64 | audacious | comp | debian | gkrelluim | kip | misc | movie | research | rime | unicon | vdr | work | えふえふ]
書いてる人: dai
パッチ等(無保証)