Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2F3D9200B17 for ; Tue, 21 Jun 2016 14:46:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 2C305160A4F; Tue, 21 Jun 2016 12:46:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7601F160A36 for ; Tue, 21 Jun 2016 14:46:48 +0200 (CEST) Received: (qmail 27362 invoked by uid 500); 21 Jun 2016 12:46:47 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 27351 invoked by uid 99); 21 Jun 2016 12:46:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jun 2016 12:46:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id D352BC301A for ; Tue, 21 Jun 2016 12:46:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.129 X-Spam-Level: ** X-Spam-Status: No, score=2.129 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 7sNhMWrb1oHn for ; Tue, 21 Jun 2016 12:46:46 +0000 (UTC) Received: from mail-yw0-f180.google.com (mail-yw0-f180.google.com [209.85.161.180]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id DA77D5F3F3 for ; Tue, 21 Jun 2016 12:46:44 +0000 (UTC) Received: by mail-yw0-f180.google.com with SMTP id b72so12462392ywa.3 for ; Tue, 21 Jun 2016 05:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=nMK+ZlRPyZcjmvu7oDDFV/haQOD6pikyPif1/IHMidw=; b=vfGQX4YCgQFoJCw/gdlq9NiScS9obhczn8XLhGH9dlXX4XInmS1c7yDxzmksnfgsB9 s/XkhNzl2nAL6ZqB0MW8WaL14t+rSi+TrrF7A5HBBRH4PjlJ6gbJ9YyGF6KThHTyJUUK rDQeMevWpStJTOvJi/n8ooCI+S8t5aDFKktJqcmE3uV3DFitPaiA06xpBjE0O33bIbz4 8XApdNyINsyJI/N4HugGdWsJbq44bbKzGQr/vCpIFLkPSR7VArjCkPhrHH7IVP1lLWei wdKlYQGXBxy9N2NnGApoi6inVTmrQfjBtC4IOB/iuJTVRURGfhbT1IPD3YblW2Tzm2Zt F96A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=nMK+ZlRPyZcjmvu7oDDFV/haQOD6pikyPif1/IHMidw=; b=HYk7GcSKsfSdmz3Jp7wINwlxpqeyRTZQfEBP8JkwNDlNJyrOroI3Zle5kE41YVR5bW eTyn4FIVFSGW0i+wTAda2/rmHUZosKbrfPzIRriDCd4celT0LTuiqf0M0ju54bKg+QGo ZlrSgnYOGjf7VzOggMakyoYAg7isD7oJwGep9iUV9BexMMCYvBaBtjQRe87J7OYO47BQ B0gBqxDzVQpSd3bcXDt9+kxYOxFB+yk8JYVtr+Q6ttxzNM88TskkhD8zooetYnu5YU8v mmRb7WNrbICMFXO8+nqUsXwz5f2lF/Zpyv6zDyGnPSfnEwYv0bGwF2oCUwIe9NasVTby 91Rg== X-Gm-Message-State: ALyK8tLYvzzhGjzjRyY3i0Z8nDUUliZzx7S1NKdvwEttZg0d5eunRu8UB/5FgawSGJxlhU0k+H2hhwIrIYH1IQ== X-Received: by 10.13.238.69 with SMTP id x66mr11585935ywe.15.1466513204012; Tue, 21 Jun 2016 05:46:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.214.9 with HTTP; Tue, 21 Jun 2016 05:46:43 -0700 (PDT) From: Afaf Zahkya Date: Tue, 21 Jun 2016 15:46:43 +0300 Message-ID: Subject: Memory problems caused by the messageBufferText CharBuffer in WSFrameBase.java To: dev@tomcat.apache.org Content-Type: multipart/alternative; boundary=94eb2c034ffc956cb40535c93659 archived-at: Tue, 21 Jun 2016 12:46:49 -0000 --94eb2c034ffc956cb40535c93659 Content-Type: text/plain; charset=UTF-8 Hello, I m using tomcat 8.0.21. I want to send *up* to 4 MB of text messages through a websocket connection to my tomcat server. I set the MaxTextMessageBufferSize to 4 MB.Now as a result, every time I open a websocket connection and I send a message , I can see that 4 MB are being allocated in memory for the CharBuffer messageBufferText regardless of the size of the message I send . 99 % of my messages would be way smaller.The 4 MB remain allocated in the messageBufferText CharBuffer even after the message is handled. The connection can stay open up to 30 minutes in my case, and each websocket connection is taking 4 MB of memory all of that time even if it's inactive which leads my server to eventually run out of memory even with inactive connections . Note that I m using a Whole Message Handler. Why not set the messageBufferText CharBuffer size to the payload length if it doesn't exceed the maxTextMessageBufferSize, and then clearing that buffer ( reducing its size) after the message is handled by the Handler, so that inactive connections don't take up memory. ( same for the binary) ? Any other / better suggestions on how to solve that problem ? Thanks. --94eb2c034ffc956cb40535c93659--