首頁 資料庫 mysql教程 Issue record: “No thread for socket” about Memcach

Issue record: “No thread for socket” about Memcach

Jun 07, 2016 pm 04:31 PM
for issue record socket thread

文章系本人原创,转载请保持完整性并注明出自《四火的唠叨》 We own a service supplying not-real-time data to the downstream clients. In order to reduce the average latency and the pressure on database, Memcached was imported as the cluster ce

文章系本人原创,转载请保持完整性并注明出自《四火的唠叨》

Issue record: No thread for socket about MemcachedWe own a service supplying not-real-time data to the downstream clients. In order to reduce the average latency and the pressure on database, Memcached was imported as the cluster center cache, and our service consumed it. I encountered an issue when Memcached was firstly deployed on production environment:

[WARN] (Acceptor ServerSocket[addr=/0.0.0.0,port=0,localport=3961]) amazon.platform.servertoolkit.http.jetty.JettyServerManager: No thread for Socket[addr=/10.0.77.98,port=10545,localport=3961] : [Acceptor ServerSocket[addr=/0.0.0.0,port=0,localport=3961]]org.mortbay.util.ThreadPool.run(ThreadPool.java:350)
登入後複製

The server totally gave no response. So I checked the connection number:

netstat -an | grep ESTABLISHED | wc –l
54
登入後複製

And process number:

ps -ef|wc -l
564
登入後複製

The both seemed normal. One teammate remaindered me I should have a look at the threads of Jetty:

ps uH p 31636 | wc -l
登入後複製

I couldn’t find anything abnormal. I knew I might increase the thread up limit but that would not have any help to resolve the issue, at most it might only delay the issue’s happening.

Actually, this issue was a little more complex than we thought indeed.

The threads were running out from this morning, and client could not connect to our service. I took a snapshot (jstack -F -l 31636) for the stacks in JVM, finding that almost all the threads were hung reading from cache server:

Thread 19795: (state = IN_NATIVE)
 - sun.nio.ch.FileDispatcher.read0(java.io.FileDescriptor, long, int) @bci=0 (Compiled frame; information may be imprecise)
 - sun.nio.ch.SocketDispatcher.read(java.io.FileDescriptor, long, int) @bci=4, line=21 (Compiled frame)
 - sun.nio.ch.IOUtil.readIntoNativeBuffer(java.io.FileDescriptor, java.nio.ByteBuffer, long, sun.nio.ch.NativeDispatcher, java.lang.Object) @bci=116, line=198 (Compiled frame)
 - sun.nio.ch.IOUtil.read(java.io.FileDescriptor, java.nio.ByteBuffer, long, sun.nio.ch.NativeDispatcher, java.lang.Object) @bci=31, line=166 (Compiled frame)
 - sun.nio.ch.SocketChannelImpl.read(java.nio.ByteBuffer) @bci=101, line=245 (Compiled frame)
 - com.schooner.MemCached.SockInputStream.readFromChannel() @bci=25 (Interpreted frame)
 - com.schooner.MemCached.SockInputStream.read() @bci=31 (Compiled frame)
 - com.schooner.MemCached.SockInputStream.getLine() @bci=9 (Compiled frame)
 - com.schooner.MemCached.AscIIClient.get(java.lang.String, java.lang.String, java.lang.Integer, boolean) @bci=583 (Compiled frame)
 - com.schooner.MemCached.AscIIClient.get(java.lang.String, java.lang.Integer) @bci=6 (Compiled frame)
 - com.schooner.MemCached.AscIIClient.get(java.lang.String) @bci=3 (Compiled frame)
 - com.danga.MemCached.MemCachedClient.get(java.lang.String) @bci=5 (Compiled frame)
 - amazon.forecast.util.cache.memcached.BSFMemcachedClient.get(java.lang.String, java.lang.String) @bci=14, line=80 (Compiled frame)
 - amazon.forecast.distribution.Forecaster.getForecastDistributions(amazon.forecast.distribution.IForecastDistributionProvider, amazon.forecast.distribution.ForecastRequest)
 ...
登入後複製

On my understanding there should be some error on the connection from the client to cache server, then I checked the cache server but found it’s correctly and stably running, and of course, the network was good. We invoked?Memcached service manually several times thru telnet, it did work normally.?I took several snapshots in series again and got the same result — it seemed all the threads were being hung on the “read0″ method.

However, after restarting the client the issue disappeared. By then nothing could explain why all the threads were being hung reading from cache server. One of my teammate told me if the tcp connection was dropped and the client was trying to read, it would not fail until the retransmission time out. The retransmission would happen in a back-off manner, and it would take long time for “read” to fail. Besides,?It didn’t matter whether or not we were able to connect to the cache server. The exact tcp connection was broken on client, and it didn’t detect and was still using the broken socket to read.

Finally, we were still unclear about the root cause, but found a loop discussing about this issue:?

https://github.com/gwhalin/Memcached-Java-Client/issues/20

A working solution is to set socket timeout to release the connection in time if unforeseen issue happens.

文章系本人原创,转载请保持完整性并注明出自《四火的唠叨》

你可能也喜欢:

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

解決kernel_security_check_failure藍色畫面的17種方法 解決kernel_security_check_failure藍色畫面的17種方法 Feb 12, 2024 pm 08:51 PM

Kernelsecuritycheckfailure(內核檢查失敗)就是一個比較常見的停止代碼類型,可藍屏錯誤出現不管是什麼原因都讓很多的有用戶們十分的苦惱,下面就讓本站來為用戶們來仔細的介紹一下17種解決方法吧。 kernel_security_check_failure藍色畫面的17種解決方法方法1:移除全部外部裝置當您使用的任何外部裝置與您的Windows版本不相容時,則可能會發生Kernelsecuritycheckfailure藍色畫面錯誤。為此,您需要在嘗試重新啟動電腦之前拔下全部外部裝置。

PHP+Socket系列之IO多路復用及實作web伺服器 PHP+Socket系列之IO多路復用及實作web伺服器 Feb 02, 2023 pm 01:43 PM

這篇文章為大家帶來了關於php+socket的相關知識,其中主要介紹了IO多路復用,以及php+socket如何實作web伺服器?有興趣的朋友下面一起來看一下,希望對大家有幫助。

Python的socket與socketserver怎麼使用 Python的socket與socketserver怎麼使用 May 28, 2023 pm 08:10 PM

一、基於TCP協定的socket套接字程式設計1、套接字工作流程先從伺服器端說起。伺服器端先初始化Socket,然後與連接埠綁定(bind),對連接埠進行監聽(listen),呼叫accept阻塞,等待客戶端連線。在這時如果有個客戶端初始化一個Socket,然後連接伺服器(connect),如果連線成功,這時客戶端與伺服器端的連線就建立了。客戶端發送資料請求,伺服器端接收請求並處理請求,然後把回應資料傳送給客戶端,客戶端讀取數據,最後關閉連接,一次互動結束,使用以下Python程式碼實作:importso

怎麼使用Spring Boot+Vue實現Socket通知推播 怎麼使用Spring Boot+Vue實現Socket通知推播 May 27, 2023 am 08:47 AM

SpringBoot端第一步,引入依賴首先我們需要引入WebSocket所需的依賴,以及處理輸出格式的依賴com.alibabafastjson1.2.73org.springframework.bootspring-boot-starter-websocket第二步,創建WebSocket配置類importorg. springframework.context.annotation.Bean;importorg.springframework.context.annotation.Config

Linux中如何讓所有使用者登入時列印指定提示訊息 Linux中如何讓所有使用者登入時列印指定提示訊息 Feb 19, 2024 pm 05:12 PM

在Linux系統中,透過設定檔和腳本,可以實現讓所有使用者登入時顯示指定的提示資訊。接下來,我們將介紹幾種常用的實作方法。方法一:修改/etc/issue檔案開啟終端,使用文字編輯器(如vi或nano)以root權限編輯/etc/issue檔案。 sudovi/etc/issue在文件末尾添加你想要顯示的提示訊息,例如:WelcometoMyLinuxSystem!Pleasebeawarethatallactivitiesaremonitored.儲存並關閉檔案。現在,當使用者登入時,系統將顯示/

C#常見的網路通訊與安全性問題及解決方法 C#常見的網路通訊與安全性問題及解決方法 Oct 09, 2023 pm 09:21 PM

C#中常見的網路通訊和安全性問題及解決方法在當今互聯網時代,網路通訊已成為了軟體開發中必不可少的一部分。在C#中,我們通常會遇到一些網路通訊的問題,例如資料傳輸的安全性、網路連線的穩定性等。本文將針對C#中常見的網路通訊和安全性問題進行詳細討論,並提供相應的解決方法和程式碼範例。一、網路通訊問題網路連線中斷:網路通訊過程中,可能會出現網路連線的中斷,這會導致

Win10如何解除安裝Skype for Business?電腦上的skype怎麼徹底卸載方法 Win10如何解除安裝Skype for Business?電腦上的skype怎麼徹底卸載方法 Feb 13, 2024 pm 12:30 PM

Win10skype可以卸載嗎是許多用戶都想知道的問題,因為很多的用戶發現自己電腦上的預設程式上有這個應用,擔心刪除後會影響到系統的運行,下面就讓本站來為用戶們來仔細的介紹一下Win10如何卸載SkypeforBusiness吧。 Win10如何解除安裝SkypeforBusiness1、在電腦桌面點選Windows圖標,再點選設定圖示進入。 2、點選“應用”。 3、在搜尋框中輸入“Skype”,點選選取找到的結果。 4、點選「卸載」。 5

php socket無法連線怎麼辦 php socket無法連線怎麼辦 Nov 09, 2022 am 10:34 AM

php socket無法連線的解決方法:1、檢查php是否開啟socket擴充;2、開啟php.ini文件,檢查「php_sockets.dll」是否已載入;3、取消「php_sockets.dll」的註解狀態即可。

See all articles