Apache 2.4 bugfix 重複 listen 相同 port

2018-10-07 Apache

前陣子同事報案,在某一台設備上遇到 set header 出現在 Client 端偶爾會有,偶爾又沒有的狀況 … OKAY 又要來 debug。

 

這個事件發生在 Stage 環境,只有單台 Server,所以並沒有多台設備的設定檔同步問題 …

 

中間 debug 過程就不多說了,發現在這台設備有兩個 listen *:80 !!! 在一般狀況下是不可以允許 listen 相同 port,除非你是不同 IP or IPv4 / IPv6 的情況,但是該狀況是 *:80 非常異常 !!

 

實測執行 apache2 後再跑 service apache2 start 就可以呼叫出兩個 listen *:80

$ apache2
$ service apache2 start

 

由於 2018 年是本人 29 歲非常之帶賽,所以遇到疑難雜症一定要趕快查 release notes … 果不其然找到一個很像的

*) core: Disallow multiple Listen on the same IP:port when listener buckets
are configured (ListenCoresBucketsRatio > 0), consistently with the single
bucket case (default), thus avoiding the leak of the corresponding socket
descriptors on graceful restart. [Yann Ylavic]

 

這個 bug 解在 2.4.28 版本,而預設的 Ubuntu 16.04 停在 2.4.18 就剛好踩到這個 bug …

 

要解這個問題很簡單,直接加 ppa:ondrej/apache2,可以直接升到最新版,後來實測裝到 2.4.28 果真就解決這個 bug,

$ sudo add-apt-repository ppa:ondrej/apache2
$ sudo apt-get update
$ sudo apt-get install apache2

 

用 bug 來除去 29 歲的劫難也是不錯啦 …

給 Mr. 沙先生一點建議

彙整

分類

展開全部 | 收合全部

License

訂閱 Mr. 沙先生 的文章

輸入你的 email 用於訂閱