Issue record: “No thread for socket” about Memcach
文章系本人原创,转载请保持完整性并注明出自《四火的唠叨》 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
文章系本人原创,转载请保持完整性并注明出自《四火的唠叨》
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 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.
文章系本人原创,转载请保持完整性并注明出自《四火的唠叨》

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









Kernelsecuritycheckfailure (カーネルチェック失敗) は比較的一般的な停止コードですが、理由が何であれ、ブルースクリーンエラーは多くのユーザーを悩ませます、当サイトでは 17 種類のエラーをユーザーに丁寧に紹介します。 kernel_security_check_failure ブルー スクリーンに対する 17 の解決策 方法 1: すべての外部デバイスを削除する 使用している外部デバイスが Windows のバージョンと互換性がない場合、Kernelsecuritycheckfailure ブルー スクリーン エラーが発生することがあります。これを行うには、コンピュータを再起動する前に、すべての外部デバイスを取り外しておく必要があります。

この記事では、php+socket に関する関連知識を提供します。主に IO 多重化と php+socket が Web サーバーを実装する方法を紹介します。興味のある方は以下をご覧ください。皆様のお役に立てれば幸いです。

1. TCP プロトコルに基づくソケット プログラミング 1. ソケット ワークフローはサーバー側から始まります。サーバーはまずソケットを初期化し、次にポートにバインドし、ポートをリッスンし、accept を呼び出してブロックし、クライアントが接続するのを待ちます。このとき、クライアントがSocketを初期化してからサーバーに接続(connect)すると、接続に成功するとクライアントとサーバー間の接続が確立されます。クライアントがデータ リクエストを送信し、サーバーがリクエストを受信して処理し、次に応答データをクライアントに送信し、クライアントがデータを読み取り、最後に接続を閉じます。インタラクションは終了します。インタラクションを実装するには、次の Python コードを使用します。 :インポートソ

Win10 Skype はアンインストールできますか? 多くのユーザーは、このアプリケーションがコンピューターの既定のプログラムに含まれており、削除するとシステムの動作に影響するのではないかと心配しているため、これは多くのユーザーが知りたい質問です。この Web サイトはユーザーを支援します。Win10 で Skype for Business をアンインストールする方法を詳しく見てみましょう。 Win10 で Skype for Business をアンインストールする方法 1. コンピューターのデスクトップで Windows アイコンをクリックし、設定アイコンをクリックしてに入ります。 2. 「適用」をクリックします。 3. 検索ボックスに「Skype」と入力し、見つかった結果をクリックして選択します。 4. 「アンインストール」をクリックします。 5

SpringBoot 側の最初のステップは依存関係を導入することです。まず、WebSocket に必要な依存関係と、出力形式 com.alibabafastjson1.2.73org.springframework.bootspring-boot-starter-websocket を処理するための依存関係を導入する必要があります。 2 番目のステップは、WebSocket 構成クラス importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Config を作成することです。

php ソケットに接続できない問題の解決策: 1. php でソケット拡張機能が有効になっているかどうかを確認します; 2. php.ini ファイルを開いて、「php_sockets.dll」が読み込まれているかどうかを確認します; 3. 「php_sockets.dll」のコメントを解除します」。

Linux システムでは、構成ファイルとスクリプトを使用して、すべてのユーザーがログインするときに指定したプロンプト情報を表示できます。次に、一般的に使用される実装方法をいくつか紹介します。方法 1: /etc/issue ファイルを変更する ターミナルを開き、テキスト エディタ (vi または nano など) を使用して、root 権限で /etc/issue ファイルを編集します。 sudovi/etc/issue ファイルの最後に表示するプロンプト メッセージを追加します (例: Welcome to MyLinuxSystem! Please beaware that all activity are監視されています。ファイルを保存して閉じます)。ユーザーがログインすると、システムには / が表示されます。

インターネットの発展に伴い、ファイル転送は人々の日常の仕事や娯楽に不可欠な部分になりました。ただし、電子メールの添付ファイルやファイル共有 Web サイトなどの従来のファイル転送方法には一定の制限があり、リアルタイム性とセキュリティのニーズを満たすことができません。したがって、PHP と Socket テクノロジを使用してリアルタイムのファイル転送を実現することが新しいソリューションになりました。この記事では、PHP と Socket テクノロジを使用してリアルタイム ファイル転送を実現する技術原理、利点、アプリケーション シナリオを紹介し、具体的なケースを通じてこのテクノロジの実装方法を示します。テクノロジー
