這個異常是因爲如下幾個緣由形成。 linux
一、客戶端再發起請求後沒有等服務器端相應完,點擊了stop按鈕,致使服務器端接收到取消請求。 一般狀況下是不會有這麼無聊的用戶,出現這種狀況多是因爲用戶提交了請求,服務器端相應緩慢,好比業務邏輯有問題等緣由,致使頁面過了好久也沒有刷新出來,用戶就有可能取消或從新發起請求。web
二、Tomcat服務器在接受用戶請求的時候,有其自身的處理能力,線程、服務器等各個資源限制,超出Tomcat承載範圍的請求,就會被tomcat停掉,也可能產生該錯誤。 數據庫
三、linux的線程機制會產生JVM出錯的問題,特別是在鏈接高峯期間常常出現這樣的問題,tomcat在linux下也出現相似狀況。
Java代碼tomcat
- 1.sun的解釋:
- 2.--posted by: cooper
- 3.Below is a clipping from Sun on working around JVM crashes under high
- 4.thread counts in the JVM 1.3 for Linux
- 5.
- 6.On Linux, use a larger signal number for hotspot thread
- 7.suspension/resumption handler. The signal number being used is
- 8.specified by environment variable _JAVA_SR_SIGNUM. Setting it to a
- 9.number larger than SIGSEGV (11) will solve the problem. A good number
- 10.to use is 12, which is SIGUSR2. Using signal 16 to work around the
- 11.problem might have potential problems. So on tcsh, "setenv
- 12._JAVA_SR_SIGNUM 12" can solve the problem.
- sun的解釋:
- --posted by: cooper
- Below is a clipping from Sun on working around JVM crashes under high
- thread counts in the JVM 1.3 for Linux
- On Linux, use a larger signal number for hotspot thread
- suspension/resumption handler. The signal number being used is
- specified by environment variable _JAVA_SR_SIGNUM. Setting it to a
- number larger than SIGSEGV (11) will solve the problem. A good number
- to use is 12, which is SIGUSR2. Using signal 16 to work around the
- problem might have potential problems. So on tcsh, "setenv
- _JAVA_SR_SIGNUM 12" can solve the problem.
「_JAVA_SR_SIGNUM=12」等號兩邊必須沒有空格,等號是半角 服務器
資料:
Broken pipe產生的緣由一般是當管道讀端沒有在讀,而管道的寫端繼續有線程在寫,就會形成管道中斷。(因爲管道是單向通訊的) SIGSEGV(Segment fault)意味着指針所對應的地址是無效地址,沒有物理內存對應該地址。 如下是UNIX的信號解釋: 11 / SIGSEGV: Unerlaubter Zugriff auf Hauptspeicher (Adressfehler). 12 / SIGUSER2: User-defined Signal 2 (POSIX). 把_JAVA_SR_SIGNUM改爲12只是將信號至成user-defined,讓它不報出來而已,不能解決問題。 建議採起的方式:
1. 資源沒有徹底釋放,用完後要至NULL 值(JAVA的GC沒那麼完善)
2. 數據庫鏈接順序關閉!(RS,PS,CONN)
3. 優化JAVA虛擬機 加入相應的內存參數!
4. 不要在數據庫中獲取大段文本(即一個欄位的值不要太大)
5. JAVA 不推薦 用String 獲取大量信息。(容易形成內存泄露,建議用StringBuffer)
6. 頁面重複提交
7. 儘可能將METHOD移到JAVA中,在JSP中全部的方法都看作全局變量,編譯執行自己就有不少問題。
8. 若是是查詢功能,儘量的使用非XA(事務)。
9. 儘可能用較新較穩定版本的JDK,低版本的JVM自己也有不少BUG,好比1。5的垃圾回收比起1。2,1。3必定是很是明顯的進步。
10. LINUX系統自己沒有這麼穩定,有些問題沒法避免的~~:)oop