Re: apr_shm_create succeeds then fails on Mac OS X

2015-12-27 Thread Helmut K. C. Tessarek
On 27.12.15 8:47 , Sorin Manolache wrote:
> 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:

In that case the module wouldn't work on Linux either, since the '/tmp/...' 
path is hard-coded and /tmp is usually not a tmpfs.
Just my 2 cents.

Cheers,
  K. C.

-- 
regards Helmut K. C. Tessarek
lookup http://sks.pkqs.net for KeyID 0xC11F128D

/*
   Thou shalt not follow the NULL pointer for chaos and madness 
   await thee at its end.
*/


Re: apr_shm_create succeeds then fails on Mac OS X

2015-12-27 Thread Jim Jagielski
Are you *sure* that /tmp really has enough space?

> On Dec 27, 2015, at 8:47 AM, Sorin Manolache  wrote:
> 
> On 2015-12-25 19:36, Tapple Gao wrote:
>> Hi. I’m 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
>> 
>> 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’s been running for years to power openstreetmap.org
>> 
>> 
>> /*
>>  * 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 = apr_psprintf(pconf, "/tmp/httpd_shm.%ld", (long 
>> int)getpid());
>> shmfilename_delaypool = apr_psprintf(pconf, "/tmp/httpd_shm_delay.%ld", 
>> (long int)getpid());
> 
> 
> 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:
> 
> $ mount
> /dev/sda6 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
> tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=398160k)
> /dev/sda9 on /tmp type ext4 (rw,relatime,data=ordered)
> 
> As you see, / and /tmp are of disk partitions while /run/shm has a filesystem 
> of type tmpfs.
> 
> 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.
> 
> 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.
> 
> Sorin
> 



Re: apr_shm_create succeeds then fails on Mac OS X

2015-12-27 Thread Sorin Manolache

On 2015-12-25 19:36, Tapple Gao wrote:

Hi. I’m 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

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’s 
been running for years to power openstreetmap.org


 /*
  * 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 = apr_psprintf(pconf, "/tmp/httpd_shm.%ld", (long 
int)getpid());
 shmfilename_delaypool = apr_psprintf(pconf, "/tmp/httpd_shm_delay.%ld", 
(long int)getpid());



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:


$ mount
/dev/sda6 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=398160k)
/dev/sda9 on /tmp type ext4 (rw,relatime,data=ordered)

As you see, / and /tmp are of disk partitions while /run/shm has a 
filesystem of type tmpfs.


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.


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.


Sorin