在redhat5.4/5.5/5.6中默認的rsync出現的bug

測試環境爲:

Client(192.168.1.3)--------------------àdaemon(192.168.1.2)

 

-----------------------配置過的先略過,直接看測試過程----------------

服務端配置:

/etc/rsyncd/Rsyncd.conf配置

# Minimal configuration file for rsync daemon

# See rsync(1) and rsyncd.conf(5) man pages for help

 

# This line is required by the /etc/init.d/rsyncd script

pid file = /var/run/rsyncd.pid

port = 873

address = 192.168.1.2

uid = test

gid = test

auth users = test

secrets file = /etc/rsyncd/rsyncd.secrets

#incoming chmod = u+rwx,g+rwx,o+rx

use chroot = yes

read only = no

 

#limit access to private LANs

hosts allow=192.168.1.3/255.255.255.255

hosts deny=*

max connections = 500

 

#This will give you a separate log file

log file = /var/log/rsync.log

 

#This will log every file transferred - up to 85,000+ per user, per sync

#transfer logging = yes

 

log format = %t %a %m %f %b

syslog facility = local3

timeout = 300

 

[app]

path = /app/test(目標目錄)

list=yes

#ignore errors

 

/etc/rsyncd/rsyncd.secrets 配置

test:123456(密碼)

 

啓動服務端/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf

 

客戶端配置

客戶端:

/etc/rsync_client.pass

123456(密碼)

rsync -av --password-file=/etc/rsync_client.pass /boot [email protected]::app

 

-------------------------------------------------------------配置完成-------------------------------------------------

 

測試過程:

rsync -av --password-file=/etc/rsync_client.pass /boot [email protected]::app

結果正確,沒有出現問題

再進行

rsync -av --password-file=/etc/rsync_client.pass /home [email protected]::app

結果也正確,沒有出現問題

再進行

rsync -av --password-file=/etc/rsync_client.pass /etc [email protected]::app

這回報錯了

出現如下錯誤:

unexpected tag 3 [sender]

rsync error: error in rsync protocol data stream (code 12) at io.c(828)

[sender=2.6.8]

 

而此時服務端的錯誤日誌如下:

 

2008/11/12 00:25:42 [12657] rsync: read error: Connection reset by peer (104)

2008/11/12 00:25:42 [12657] rsync error: error in rsync protocol data stream

(code 12) at io.c(614) [receiver=2.6.8]

2008/11/12 00:25:42 [12657] rsync: connection unexpectedly closed (486 bytes

received so far) [generator]

2008/11/12 00:25:42 [12657] rsync error: error in rsync protocol data stream

(code 12) at io.c(463) [generator=2.6.8]

再同步一次就成功。

 

把服務端下已經同步的文件刪除,再不嘗試一次

rsync -av --password-file=/etc/rsync_client.pass /etc [email protected]::app

還是報錯。文件只同步了部分文件,發現在同步的源文件中如果文件數太多,或者子目錄太多,就經常會出現這一種情況。

 

根據多次查找發現在2.6.8上會出現這一個問題,在2.6.9上已經解決,經查看在redhat5.4,5.5和5.6的發行版中都是使用rsync-2.6.8的版本。

 

http://rsync.samba.org/ftp/rsync/src/rsync-2.6.9-NEWS在官方上看到了更新日誌

 

- Fixed a bug where a deferred info/error/log message could get sent directly to the sender instead of being handled by rwrite() in the generator. This fixes an "unexpected tag 3" fatal error, and should also fix a potential problem where a deferred info/error message from the receiver might bypass the log file and get sent only to the client process. (These problems could only affect an rsync daemon that was receiving files.)

 

Redhat上的bug報告文件如下:

https://bugzilla.redhat.com/show_bug.cgi?id=471182

 

 

解決方法:

升級rsync到2.6.9以上,只需要升級服務器端就可以了!因爲這一個bug只會影響服務端的接收。

在redhat5.7中已經默認修復了這一個問題。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章