Return-Path: X-Original-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A3DFE10F64 for ; Wed, 25 Feb 2015 08:32:15 +0000 (UTC) Received: (qmail 87227 invoked by uid 500); 25 Feb 2015 08:32:02 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 87185 invoked by uid 500); 25 Feb 2015 08:32:02 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 87171 invoked by uid 99); 25 Feb 2015 08:32:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Feb 2015 08:32:02 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of alex@alex.org.uk designates 89.16.176.221 as permitted sender) Received: from [89.16.176.221] (HELO mail.avalus.com) (89.16.176.221) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Feb 2015 08:31:37 +0000 Received: by mail.avalus.com (Postfix) with ESMTPSA id 8A09FC561D2; Wed, 25 Feb 2015 08:31:14 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alex.org.uk; s=mail; t=1424853074; bh=BLjK92FHltQ3MMcNHXE0Bu/Sg9uYkI0kgCDztbjAJH4=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=3zmLe+z93lmS0kC8FxKu9b5XuFG+gtKOM9xRwkOgZmr/4Lm3fEVVTvO6vL++6NkT3 RP2TON6OwZxm5Bl2y1h9UOacm2AJaMNK4NnqVXEH3V4f1YVYZQ2gYQPUFAhxTGk4Rm a2wv3CzhbysLXMz+9IPkXYaenijE29zWEGhUGR9E= Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Debugging mod_websocket -- any others out there? From: Alex Bligh In-Reply-To: <54ED1473.1060604@ni.com> Date: Wed, 25 Feb 2015 08:31:13 +0000 Cc: Alex Bligh Content-Transfer-Encoding: 7bit Message-Id: References: <54ED1473.1060604@ni.com> To: modules-dev@httpd.apache.org X-Mailer: Apple Mail (2.1878.6) X-Virus-Checked: Checked by ClamAV on apache.org On 25 Feb 2015, at 00:16, Jacob Champion wrote: > I've been working with mod_websocket [1] for a few weeks now. Things > were going very well until we ran into crashes under heavy load. I > _think_ they are related to the threading model used by mod_websocket -- > it spins up a new thread and a new bucket brigade to write to the > connection, while the original thread and brigade block to read > messages. Unfortunately I don't know enough about the brigade system to > know whether that's kosher or even fixable. Yes. I've seen this. There were once some issues with the brigade allocators. You may want to look at my fork here: https://github.com/abligh/apache-websocket In there you'll find 'vncproxy' which is actually a generic tcp proxy. Despite my fixes, it still dies occasionally, normally because one of the bucket brigades becomes corrupt. I spent many many hours on this, ultimately unsuccessfully (I've moved to mod_proxy_wstunnel plus a libwebsockets C based thing). FWIW if I hadn't made the above move, my plan was to eliminate doing most of the work in the apache thread by using a bucket brigade thate ended in a socketpair (I can't remember the correct apache terminology here, but the point was to have apache do the read/write from one end of the socketpair), then set up two new threads to read and write from the other end of the socketpair, encoding/decoding as we go. This means that once the connection is live the module code itself wouldn't actually touch any apache memory-managed data. IE: Apache <==> Socket+Socket <===> Decode/Encode <===> Whatever I'm sure that's not particularly efficient, but it would work. I was idly thinking about swapping the encode/decode function for libwebsockets, but the "LGPL2+ static link exception" bit may create an issue. TBH I never had any issues with the actual encode/decode code. -- Alex Bligh