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 1FFC0180D2 for ; Mon, 28 Dec 2015 15:00:23 +0000 (UTC) Received: (qmail 56990 invoked by uid 500); 28 Dec 2015 15:00:22 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 56942 invoked by uid 500); 28 Dec 2015 15:00:22 -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 56930 invoked by uid 99); 28 Dec 2015 15:00:22 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Dec 2015 15:00:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 1A09C180186 for ; Mon, 28 Dec 2015 15:00:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.653 X-Spam-Level: X-Spam-Status: No, score=0.653 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_NEUTRAL=0.652, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=comcast.net Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 4AaPOgnA8Kam for ; Mon, 28 Dec 2015 15:00:09 +0000 (UTC) Received: from resqmta-ch2-11v.sys.comcast.net (resqmta-ch2-11v.sys.comcast.net [69.252.207.43]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 067692049E for ; Mon, 28 Dec 2015 15:00:08 +0000 (UTC) Received: from resomta-ch2-06v.sys.comcast.net ([69.252.207.102]) by resqmta-ch2-11v.sys.comcast.net with comcast id z2z91r0012D5gil01302i2; Mon, 28 Dec 2015 15:00:02 +0000 Received: from [192.168.199.10] ([69.251.84.114]) by resomta-ch2-06v.sys.comcast.net with comcast id z3011r0012U0RYt013018N; Mon, 28 Dec 2015 15:00:02 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: apr_shm_create succeeds then fails on Mac OS X From: Jim Jagielski In-Reply-To: Date: Mon, 28 Dec 2015 10:00:00 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <6A7343CD-81D8-40D9-9D13-9FE775B2A153@jaguNET.com> References: <567FEBDF.2020903@gmail.com> <5BA8A9B2-FA42-40F7-B101-71E0387DF0C2@jaguNET.com> <9895C63F-993B-4A05-8663-6C02BACF0AD7@gmail.com> To: modules-dev@httpd.apache.org X-Mailer: Apple Mail (2.3112) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1451314802; bh=8soGvDRe7BO07TVpgAbgIQwpYSnS4mr5ztwaQi2pGnA=; h=Received:Received:Content-Type:Mime-Version:Subject:From:Date: Message-Id:To; b=oX2Smb+yUlXSUpiB4IKzk7Op4ticWqKXnkbHJRTsLc4KT2N9a9yjxscke7c80XGZp aLfzWqZy3MWuP17cev+2YAHqWtNtMuJns0pUtOAmHtUx5+xn2CFlqOsmlB9kp25yoT PBWOAVPjwUECa+uF30FnUzUSFY5zUqoIJmc7jMPWoDFmXEW+3AjG3zh44/rukPDGLW ED+/iYU2aCJMjC/9c5mbvSjQfzuzfQtyhUSUAzKuzxn7QHtMh6r28taSRphpsMtgaI 5gI7MsCprRq5tpbSqZhSU9ljqcuLp+MyBi2cOzB1vKWoYWux0NPniGZ84g2gepnvwK VcxX42bomvysA== Registering it as a cleanup is likely better > On Dec 28, 2015, at 9:09 AM, Yann Ylavic wrote: >=20 > You could possible add a call to apr_shm_remove(shmfilename, pconf) > (resp. shmfilename_delaypool) in the module's post_config, before the > SHMs are created with apr_shm_create(). >=20 > Regards, > Yann. >=20 > On Mon, Dec 28, 2015 at 2:56 PM, Jim Jagielski = wrote: >> Looks like the module is not cleaning up and removing the shared = memory >> segment during a shutdown and/or restart. >>=20 >>> On Dec 28, 2015, at 8:43 AM, Tapple Gao wrote: >>>=20 >>> I found something that helped: I googled and discovered the ipcs = utility: >>>=20 >>> 68 08:24 tapple /Library/Server/Web/Config/apache2/sites $ ipcs -am >>> IPC status from as of Mon Dec 28 08:24:42 EST 2015 >>> T ID KEY MODE OWNER GROUP CREATOR CGROUP = NATTCH SEGSZ CPID LPID ATIME DTIME CTIME >>> Shared Memory: >>> m 65536 0x0052e2c1 --rw------- postgres postgres postgres postgres = 6 56 484 484 19:25:25 8:24:22 19:25:25 >>> m 1572865 0x0101d953 --rw------- root wheel root wheel = 0 2401448 78687 78687 17:32:23 17:32:58 17:32:23 >>> m 65541 0x00000000 --rw------- _devicemgr _devicemgr _devicemgr = _devicemgr 5 1 652 652 19:25:36 8:24:22 19:25:36 >>> m 2293766 0x0101d952 --rw------- root wheel root wheel = 0 904 78687 78687 17:32:23 17:32:58 17:32:23 >>>=20 >>> Hey. that size of 2401448 looks familiar. yup. that=E2=80=99s the = size listed of the failed allocation in the logs. Let=E2=80=99s try = removing it: >>>=20 >>> 171 08:26 tapple /Library/Server/Web/Config/apache2/sites $ sudo = ipcrm -m 1572865 >>> Password: >>> 172 08:26 tapple /Library/Server/Web/Config/apache2/sites $ ipcs -am >>> IPC status from as of Mon Dec 28 08:26:38 EST 2015 >>> T ID KEY MODE OWNER GROUP CREATOR CGROUP = NATTCH SEGSZ CPID LPID ATIME DTIME CTIME >>> Shared Memory: >>> m 65536 0x0052e2c1 --rw------- postgres postgres postgres postgres = 6 56 484 484 19:25:25 8:26:22 19:25:25 >>> m 65541 0x00000000 --rw------- _devicemgr _devicemgr _devicemgr = _devicemgr 5 1 652 652 19:25:36 8:26:22 19:25:36 >>> m 2293766 0x0101d952 --rw------- root wheel root wheel = 0 904 78687 78687 17:32:23 17:32:58 17:32:23 >>>=20 >>> Now my server starts. Hovever, as soon as I kill and restart the = server, the same problem returns. >>> I=E2=80=99m not familiar with ipc at all. Anybody know why any of = this happened? why the shared memory stuck around after apache quit? Why = it couldn=E2=80=99t allocate another block? why it worked after deleting = the leftover one? >>>=20 >>>> On Dec 28, 2015, at 7:49 AM, Tapple Gao wrote: >>>>=20 >>>> /tmp is not a special volume on my system, and has plenty of room = for a 2MB file: >>>> sh-3.2# df -h >>>> Filesystem Size Used Avail Capacity = iused ifree %iused Mounted on >>>> /dev/disk0s2 184Gi 170Gi 14Gi 93% = 44604554 3741719 92% / >>>> devfs 329Ki 329Ki 0Bi 100% = 1138 0 100% /dev >>>> map -hosts 0Bi 0Bi 0Bi 100% = 0 0 100% /net >>>> map auto_home 0Bi 0Bi 0Bi 100% = 0 0 100% /home >>>> map -fstab 0Bi 0Bi 0Bi 100% = 0 0 100% /Network/Servers >>>> /dev/disk0s5 442Gi 353Gi 89Gi 80% = 92513182 23266901 80% /Volumes/Shared >>>> localhost:/18XTcmWVPTgvjvav7dUs5F 184Gi 184Gi 0Bi 100% = 0 0 100% /Volumes/MobileBackups >>>>=20 >>>>=20 >>>>> On Dec 27, 2015, at 4:18 PM, Jim Jagielski = wrote: >>>>>=20 >>>>> Are you *sure* that /tmp really has enough space? >>>>>=20 >>>>>> On Dec 27, 2015, at 8:47 AM, Sorin Manolache = wrote: >>>>>>=20 >>>>>> On 2015-12-25 19:36, Tapple Gao wrote: >>>>>>> Hi. I=E2=80=99m trying to get mod_tile working on the builtin = apache in Mac OS X El Capitan. I am running into a problem with = apr_shm_create failing to allocate memory during ap_hook_post_config: >>>>>>> [Fri Dec 25 12:09:17.898197 2015] [tile:error] [pid 22431] = Successfully create shared memory segment size 888 on file = /tmp/httpd_shm.22431 >>>>>>> [Fri Dec 25 12:09:17.898285 2015] [tile:error] [pid 22431] = (12)Cannot allocate memory: Failed to create shared memory segment size = 2401448 on file /tmp/httpd_shm_delay.22431 >>>>>>>=20 >>>>>>> Is there something I need to configure to get this shared memory = working, or increase the limit? This module is most often run on Ubuntu = linux, where it=E2=80=99s been running for years to power = openstreetmap.org >>>>>>>=20 >>>>>>>=20 >>>>>>> /* >>>>>>> * Create a unique filename using our pid. This information is >>>>>>> * stashed in the global variable so the children inherit it. >>>>>>> * TODO get the location from the environment $TMPDIR or = somesuch. >>>>>>> */ >>>>>>> shmfilename =3D apr_psprintf(pconf, "/tmp/httpd_shm.%ld", (long = int)getpid()); >>>>>>> shmfilename_delaypool =3D apr_psprintf(pconf, = "/tmp/httpd_shm_delay.%ld", (long int)getpid()); >>>>>>=20 >>>>>>=20 >>>>>> I think that the location of the shmfile must be on a filesystem = of a special type, namely tmpfs, which maps in memory and not on disk. = Execute "mount" and check if you have such filesystems mounted. For = example on my Linux machine: >>>>>>=20 >>>>>> $ mount >>>>>> /dev/sda6 on / type ext4 = (rw,relatime,errors=3Dremount-ro,data=3Dordered) >>>>>> tmpfs on /run/shm type tmpfs = (rw,nosuid,nodev,noexec,relatime,size=3D398160k) >>>>>> /dev/sda9 on /tmp type ext4 (rw,relatime,data=3Dordered) >>>>>>=20 >>>>>> As you see, / and /tmp are of disk partitions while /run/shm has = a filesystem of type tmpfs. >>>>>>=20 >>>>>> I suggest to change the code and use a different location from = /tmp/... On Linux the shared memory is often created in /run/shm/*. I = have no experience with Mac OS X. >>>>>>=20 >>>>>> The cleanest way would be to implement what's written in the = commentary of the code above, namely the possibility to specify the path = by an evrionment variable or from a configuration directive. >>>>>>=20 >>>>>> Sorin >>>>>>=20 >>>>>=20 >>>>=20 >>>=20 >>=20