我們使用Hibernate和c3p0連接池庫。到目前爲止,直到最近,當我們決定將maxPoolSize增加到1000並對我們的應用程序進行大量的壓力測試時,這種組合效果很好。我們的應用程序的峯值負載導致數據庫響應非常緩慢,因此c3p0的死鎖檢測器一次又一次地吐出APPARENT DEADLOCK警告。c3p0死鎖檢測 - 線程運行太頻繁
基於c3p0文檔,假設死鎖檢測每30分鐘發生一次(代碼表示死鎖檢測頻率是maxAdministrativeTaskTime的三倍),我們將maxAdministrativeTaskTime更改爲10分鐘。
但是,在分析c3p0日誌時,死鎖檢測線程運行頻率超過30分鐘。日誌的相關部分已附加。令人驚訝的是頻率不統一。
Line 573745: [Timer-2] 2013-06-26 04:47:52,492 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 573746: [Timer-2] 2013-06-26 04:47:52,512 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 574292: [Timer-2] 2013-06-26 04:49:12,493 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 574293: [Timer-2] 2013-06-26 04:49:12,513 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 575004: [Timer-2] 2013-06-26 04:50:32,494 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 575005: [Timer-2] 2013-06-26 04:50:32,511 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 576062: [Timer-2] 2013-06-26 04:51:52,495 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 576063: [Timer-2] 2013-06-26 04:51:52,536 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 576720: [Timer-2] 2013-06-26 04:53:12,496 WARN [null] com.mchange.v2.async.ThreadPoolAsynchrono[email protected] -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 576721: [Timer-2] 2013-06-26 04:53:12,516 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 594087: [Timer-2] 2013-06-26 04:55:52,550 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 594088: [Timer-2] 2013-06-26 04:55:52,569 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 594753: [Timer-2] 2013-06-26 04:57:12,550 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 594754: [Timer-2] 2013-06-26 04:57:12,572 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 595624: [Timer-2] 2013-06-26 04:58:32,552 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 595625: [Timer-2] 2013-06-26 04:58:32,570 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 596416: [Timer-2] 2013-06-26 04:59:52,552 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 596417: [Timer-2] 2013-06-26 04:59:52,572 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
Line 611011: [Timer-2] 2013-06-26 05:02:22,556 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!
Line 611012: [Timer-2] 2013-06-26 05:02:22,577 WARN [null] com[email protected]662cee3b -- APPARENT DEADLOCK!!! Complete Status:
有人可以解釋這個異常嗎?
好的。所以對於我下面的初步答案感到抱歉,這並不好。我糾正了錯誤的部分。現在看起來更仔細,有很多這是怪異的。您不僅經常意外地看到死鎖,而且您看到的死鎖根本不應該是死鎖,「完整狀態:」是空的。應該有線程池中任務的轉儲和它們的堆棧跟蹤。沒有。 (你的記錄器截斷多行日誌項目?) –