Re: Howto implement a new algorithm scheduler in mod_proxy_balancer

2008-10-22 Thread Jim Jagielski

Sounds like 2 questions there: (1) is there anyway to create
some sort of scheduler that does periodic functions and (2) how
to obtain external server info (like CPU, etc...).

Re #1: Under 2.2, there is a monitor hook, but it is pretty
limited. Best thing is to create an external process which
runs separately and adjusts shared memory data.

Re #2: It ain't trivial.

On Oct 22, 2008, at 2:38 PM, ricardo13 wrote:



hi,

I saw the link.
So one more question.

Can I development a scheduler that receive datas from cluster.
For example:

  If machine1 == overloaded CPU
 sent requisition to machine2

How to do scheduler (via programming) obtain information of CPU from  
others

machines ??

Thank You

Ricardo


Rainer Jung-3 wrote:


ricardo13 schrieb:

I don't find that examples. I find in the folder
httpd.2.2.9/modules/proxy/
.there isn't folder example
Where can I find ??? Is there any link ???


It's not yet in the stable branch 2.2, but you can find it in the  
trunk:


http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/ 
examples/


to watch it with a browser, or

http://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/proxy/examples/

as a URL to check it out via svn.

Regards,

Rainer


Jim Jagielski wrote:

Not sure what the question is... is it how to test your algo or
how to implement it?

There is a quick-and-dirty example submodule in trunk (under  
modules/

proxy/examples)
that give some basic overview.

On Oct 20, 2008, at 10:07 PM, ricardo13 wrote:


Hi,

I wanted implement a new algorithm scheduler to  
mod_proxy_balancer.

I built a new algorithm and want test in apache2.

Thank you

Ricardo
--





--
View this message in context: 
http://www.nabble.com/Howto-implement-a-new-algorithm-scheduler-in-mod_proxy_balancer-tp20082207p20117149.html
Sent from the Apache HTTP Server - Module Writers mailing list  
archive at Nabble.com.






Re: Howto implement a new algorithm scheduler in mod_proxy_balancer

2008-10-23 Thread Jim Jagielski

For number 2 you need the remote servers to "broadcast" various
load information (CPU usage, memory usage, load average, etc) and
somehow have the load balancer "listen" on that broadcast to obtain
that info.

On Oct 22, 2008, at 4:13 PM, Houser, Rick wrote:


part #2 sounds more like the kind of a task you would want to use at
least an external process, if not a separate physical machine for.
Basically, you are looking for an intelligent load balancer, correct?



Thanks,

Rick Houser
Auto-Owners Insurance
Systems Support
(517)703-2580

-Original Message-
From: Jim Jagielski [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2008 3:58 PM
To: modules-dev@httpd.apache.org
Subject: Re: Howto implement a new algorithm scheduler in
mod_proxy_balancer

Sounds like 2 questions there: (1) is there anyway to create some sort
of scheduler that does periodic functions and (2) how to obtain  
external

server info (like CPU, etc...).

Re #1: Under 2.2, there is a monitor hook, but it is pretty limited.
Best thing is to create an external process which runs separately and
adjusts shared memory data.

Re #2: It ain't trivial.

On Oct 22, 2008, at 2:38 PM, ricardo13 wrote:



hi,

I saw the link.
So one more question.

Can I development a scheduler that receive datas from cluster.
For example:

 If machine1 == overloaded CPU
sent requisition to machine2

How to do scheduler (via programming) obtain information of CPU from
others machines ??

Thank You

Ricardo


Rainer Jung-3 wrote:


ricardo13 schrieb:

I don't find that examples. I find in the folder
httpd.2.2.9/modules/proxy/ .there isn't folder example Where  
can



I find ??? Is there any link ???


It's not yet in the stable branch 2.2, but you can find it in the
trunk:

http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/
examples/

to watch it with a browser, or

http://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/proxy/ 
examp

les/

as a URL to check it out via svn.

Regards,

Rainer


Jim Jagielski wrote:
Not sure what the question is... is it how to test your algo or  
how



to implement it?

There is a quick-and-dirty example submodule in trunk (under
modules/
proxy/examples)
that give some basic overview.

On Oct 20, 2008, at 10:07 PM, ricardo13 wrote:


Hi,

I wanted implement a new algorithm scheduler to
mod_proxy_balancer.
I built a new algorithm and want test in apache2.

Thank you

Ricardo
--





--
View this message in context:
http://www.nabble.com/Howto-implement-a-new-algorithm-scheduler-in- 
mod

_proxy_balancer-tp20082207p20117149.html
Sent from the Apache HTTP Server - Module Writers mailing list  
archive



at Nabble.com.









Re: Unit testing

2008-12-12 Thread Jim Jagielski

Look at the httpd-test/framework package:

http://svn.apache.org/viewvc/httpd/test/framework/trunk/

On Dec 12, 2008, at 8:54 AM, Kevac Marko wrote:


Hello.

What is the best way to write unit tests for C apache modules? Maybe
some frameworks?

--
С уважением, Кевац Марко
Sincerely yours, Kevac Marko




Re: maintaining sessions among multiple processes

2009-10-02 Thread Jim Jagielski


On Oct 2, 2009, at 7:52 AM, martin nylin wrote:


hi

i'm using apache 2.2 mpm-worker and have noticed that incoming
requests are dispatched to apache processes in a way that makes it
hard for me to maintain sessions in my module. i'm using the user
field of the request_rec as session key and would therefore like all
incoming request from a certain user to always be dispatched to the
same process. in other words: if we have recently received a request
from the same user, then dispatch the current request to the same
process as we used for the previous request.

i do realize that shared memory might be an alternative way to
implement sessions, but i think it would be very tricky in this case
since my session objects contains pointers to objects of unknown size



It sounds like you simply need to use an external session storage
mechanism, like memcached or db4 or something else... This is esp
true if you need to horizontally scale as well.


Re: Shared memory ?

2010-11-15 Thread Jim Jagielski
With 2.3/trunk you have mod_socache and/or mod_slotmem (with shared memory).

socache implements a shared memory based expiring cache and slotmem
is a scoreboard-like shared memory impl.

On Nov 15, 2010, at 11:12 AM, Rémy Sanchez wrote:

> 
> Hi,
> 
> I'm coding a module to somehow replace/complement mod_security (it's more a 
> proof of concept than a real project for now). The first thing that I'd like 
> to have is a DNSBL, so that detected intruders are instantly banned when 
> added to the blacklist. Because doing a DNS query for each HTTP request might 
> be a bit heavy, I'd like to keep the results in cache.
> 
> I guess that if I create something from the config pool, it will be 
> duplicated between processes. But another security I want is to check URL 
> against regexps commonly used by botnets/script kiddies. Then, if an IP is 
> blacklisted, I want its state to be changed instantly in all caches. Which, 
> if data is duplicated, is not possible. Would there be a simple way to 
> achieve this ? Or would it be more clever to move to another solution, like 
> using a common redis datastore for blacklist/whitelist/rules lookup ?
> 
> Thanks,
> Rémy
> 



Re: I don't understand apr_array_push

2011-01-26 Thread Jim Jagielski

On Jan 26, 2011, at 10:28 AM, Simone Caruso wrote:
> 
> Now i need to read the array (i read mod_alias.c):
>for(k = 0; k < reqc->aliases->nelts ; k++){
>alias = (alias_t *)&reqc->aliases->elts[k];
>isalias = alias_matches(r->uri, alias->src);
>if(isalias > 0)
>break;
>}
> 
> 

Do this:

alias = (alias_t *)reqc->aliases->elts;
for (k = 0; k < reqc->aliases->nelts ; k++, alias++){
isalias = alias_matches(r->uri, alias->src);
if(isalias > 0)
break;
}

> I don't understand why, when k=2, alias structure is filled with wrong 
> addresses:
> 
> (gdb)
> 658 isalias = alias_matches(r->uri, alias->src);
> (gdb)
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x7fc350e6784f in alias_matches (uri=0x94f820 "/",
>alias_fakename=0xda0094ff  bounds>)
> 
> 
> I tried a for like this without success (like mod_alias.c):
> for(k = 0; k < reqc->aliases->nelts -1 ; ++k){
> 
> 
> Any idea?
> thanks!
> 
> 
> -- 
> Simone Caruso
> IT Consultant
> +39 349 65 90 805
> p.iva: 03045250838
> 



Re: Help with apr mutex

2011-02-28 Thread Jim Jagielski
Why not check the return status of the lock and unlock calls??

On Feb 28, 2011, at 12:26 PM, Simone Caruso wrote:

> Hi all,
> 
> I wrote a simple cache inside my module with apr_shm and apr_rmm, but I have 
> problems with apr mutex...
> 
> I have this peace of code:
> 
> static apr_global_mutex_t *mtx = NULL;
> static void module_translate_name(request_rec *r)
> {
>   if(apr_global_mutex_trylock(mtx) == APR_EBUSY)
>   ap_log_rerror(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, r, 
> "Memory Locked!! ");
>   apr_global_mutex_lock(mtx);
>   element = get_from_cache();
>   if(element == NULL){
>   element = insert_into_cache();
>   strcpy(element.name,"name\0");
>   }
>   apr_global_mutex_unlock(mtx);
> }
> 
> static void module_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t 
> *ptemp, server_rec *s)
> {
>   result = apr_global_mutex_create(&mtx, "cache_entries_lck", 
> APR_LOCK_DEFAULT, p);
> }
> 
> 
> static void mod_vhost_ldap_child_init(apr_pool_t * p, server_rec * s)
> {
>   apr_status_t ret;
>   ret = apr_global_mutex_child_init(&mtx, "cache_entries_lck", p);
> }
> 
> 
> 
> During my tests with 'ab -c 15 -n 3000' i NEVER get the "Memory Locked" error 
> in logs, plus i get duplicated entries in cache but I don't know why!
> 
> Does someone have an idea? (please consider i use apr_global_mutex_trylock() 
> only for test)
> Regards.
> 
> -- 
> Simone Caruso
> 



Re: creating reverse proxy workers dynamically

2011-07-08 Thread Jim Jagielski
Look at the new mod_proxy_express module in trunk...

On Jul 7, 2011, at 1:19 AM, Jodi Bosa wrote:

> Hi,
> 
> It seems I may need to create HTTPS reverse proxy workers DYNAMICALLY - what
> is best way to do this?
> 
> In other words, from manual I see config directive:
> 
>ProxyPass /example http://backend.example.com connectiontimeout=5
> timeout=30
> 
> However, I will have several origin servers that aren't necessarily known
> during config or startup.  How can I create such workers as needed?
> 
> The manual says "fixed configuration":
> 
>   *The proxy manages the configuration of origin servers and their
> communication parameters in objects called workers. There are two built-in
> workers, the default forward proxy worker and the default reverse proxy
> worker. Additional workers can be configured explicitly.*
> *   The two default workers have a fixed configuration and will be used if
> no other worker matches the request. *
> 
> 
> Thanks for any ideas.



Re: modules.a.o live on ASF hardware

2011-07-15 Thread Jim Jagielski
woot!
On Jul 15, 2011, at 4:18 AM, Mark Thomas wrote:

> The https://modules.apache.org service went live on ASF hardware yesterday.
> 
> Now notifications are going to a public mailing list, I need to tweak
> the mail output to since it currently includes full e-mail addresses.
> Until I get those tweaks completed, I'll be manually editing and
> forwarding e-mails.
> 
> Mark
> 
> 
> 



Re: lbmethod and TCP header

2013-01-09 Thread Jim Jagielski
httpd and APR don't provide that data... For httpd,
it's all at the protocol layer (HTTP).

On Jan 7, 2013, at 1:10 PM, Ruben Campos  wrote:

> Hello everybody,
> 
> I'm part of a project that involves creating a new loadbalancer method for
> the proxy module's balancer.
> Following the round robin example provided with the httpd source code I
> have registered a proxy_balancer_method that will select which worker is
> the best.
> 
> In this method, just like the other ones, I receive the following args:
> a proxy_balancer *balancer and a request_rec *r. For my method to work I
> need to access the information in the TCP header. Is it possible, in any
> way, to do that? If so, how can I access that information (for example,
> sequence and acknowledgement numbers)?
> 
> Thank you for your time,
> Best regards,
> 
> Ruben Campos.



Re: Apache Buckets and Brigade

2013-05-01 Thread Jim Jagielski
How is that different from mod_substitute and/or mod_sed?

On May 1, 2013, at 9:22 AM, Joshua Marantz  wrote:

> I have a crazy idea for you.  Maybe this is overkill but this sounds like
> it'd be natural to add to mod_pagespeed  as a new
> filter.
> 
> Here's some code you might use as a template
> 
> https://code.google.com/p/modpagespeed/source/browse/trunk/src/net/instaweb/rewriter/collapse_whitespace_filter.cc
> 
> one thing we've thought of doing is providing a generic text-substitution
> filter that would take strings in character-blocks and do arbitrary
> substitutions in them, that could be specified in the .conf file:
>  ModPagespeedSubstitute "oldString" "newString"
> 
> You are right that text-blocks in Apache output filters can be split
> arbitrarily across buckets, but mod_pagespeed takes care of that in an
> HTML-centric way, breaking up blocks on html tokens. A block of free-format
> text would be treated as a single atomic token independent of the structure
> of the incoming bucket brigade.
> 
> Let me know if you'd like to discuss this further.
> 
> -Josh
> 
> 
> On Wed, May 1, 2013 at 8:54 AM, Sindhi Sindhi  wrote:
> 
>> Hello,
>> 
>> Thanks a lot for providing answers to my earlier emails with subject
>> "Apache C++ equivalent of javax.servlet.Filter". I really appreciate your
>> help.
>> 
>> I had another question. My requirement is something like this -
>> 
>> I have a huge html file that I have copied into the Apache htdocs folder.
>> In my C++ Apache module, I want to get this html file contents and
>> remove/replace some strings.
>> 
>> Say I have a HTML file that has the string "oldString" appearing 3 times in
>> the file. My requirement is to replace "oldString" with the new string
>> "newString". I have already written a C++ function that has a signature
>> like this -
>> 
>> char* processHTML(char* inHTMLString) {
>> //
>> char* newHTMLWithNewString = > "oldString" with "newString">
>> return newHTMLWithNewString;
>> }
>> 
>> The above function does a lot more than just string replace, it has lot of
>> business logic implemented and finally returns the new HTML string.
>> 
>> I want to call processHTML() inside my C++ Apache module. As I know Apache
>> maintains an internal data structure called Buckets and Brigades which
>> actually contain the HTML file data. My question is, is the entire HTML
>> file content (in my case the html file is huge) residing in a single
>> bucket? Means, when I fetch one bucket at a time from a brigade, can I be
>> sure that the entire HTML file data from  to  can be found in
>> a single bucket? For ex. if my html file looks like this -
>> 
>> ..
>> ..
>> oldString
>> ... oldString...oldString..
>> ..
>> 
>> 
>> When I iterate through all buckets of a brigade, will I find my entire HTML
>> file content in a single bucket OR the HTML file content can be present in
>> multiple buckets, say like this -
>> 
>> case1:
>> bucket-1 contents =
>> "
>> ..
>> ..
>> oldString
>> ... oldString...oldString..
>> ..
>> "
>> 
>> case2:
>> bucket-1 contents =
>> "
>> ..
>> ..
>> oldStr"
>> 
>> bucket-2 contents =
>> "ing
>> ... oldString...oldString..
>> ..
>> "
>> 
>> If its case2, then the the function processHTML() I have written will not
>> work because it searches for the entire string "oldString" and in case2
>> "oldString" is found only partially.
>> 
>> Thanks a lot.
>> 



Re: tcp/ip sockets in apache module

2014-06-09 Thread Jim Jagielski
It seems that the connect and websocket mod_proxy sub-modules
in 2.4.x would form a baseline for your module.
On May 23, 2014, at 1:27 PM, Jeremy Thompson  wrote:

> I'm trying to write a module for apache.  I've successfully compile in a
> test module that doesn't do a whole lot yet.  I would like to be able to use
> tcp/ip sockets in the module to talk to another server.  I added in some
> test code that should connect to my listening server and say hello whenever
> a request is made.  I'm not getting any errors upon compiling the module
> with the sockets stuff added but its not actually doing anything.  Basically
> its ignoring my connect and send code.  Does anyone have a small working
> example of this or am I just way off base in using TCP/IP for external
> communication to a module.  Thanks.
> 
> ~Jeremy
> 
> 
> 



important message

2015-10-21 Thread Jim Jagielski
Hello!

 

New message, please read <http://buydomainsforcheap.com/share.php?2lqb7>

 

Jim Jagielski



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-28 Thread Jim Jagielski
Looks like the module is not cleaning up and removing the shared memory
segment during a shutdown and/or restart.

> On Dec 28, 2015, at 8:43 AM, Tapple Gao  wrote:
> 
> I found something that helped: I googled and discovered the ipcs utility:
> 
> 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 KEYMODE   OWNERGROUP  CREATOR   CGROUP NATTCH  
> SEGSZ  CPID  LPID   ATIMEDTIMECTIME
> Shared Memory:
> m  65536 0x0052e2c1 --rw--- postgres postgres postgres postgres  6
>  56484484 19:25:25  8:24:22 19:25:25
> m 1572865 0x0101d953 --rw--- rootwheel rootwheel  0 
> 2401448  78687  78687 17:32:23 17:32:58 17:32:23
> m  65541 0x --rw--- _devicemgr _devicemgr _devicemgr _devicemgr   
>5  1652652 19:25:36  8:24:22 19:25:36
> m 2293766 0x0101d952 --rw--- rootwheel rootwheel  0   
>  904  78687  78687 17:32:23 17:32:58 17:32:23
> 
> Hey. that size of 2401448 looks familiar. yup. that’s the size listed of the 
> failed allocation in the logs. Let’s try removing it:
> 
> 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 KEYMODE   OWNERGROUP  CREATOR   CGROUP NATTCH  
> SEGSZ  CPID  LPID   ATIMEDTIMECTIME
> Shared Memory:
> m  65536 0x0052e2c1 --rw--- postgres postgres postgres postgres  6
>  56484484 19:25:25  8:26:22 19:25:25
> m  65541 0x --rw--- _devicemgr _devicemgr _devicemgr _devicemgr   
>5  1652652 19:25:36  8:26:22 19:25:36
> m 2293766 0x0101d952 --rw--- rootwheel rootwheel  0   
>  904  78687  78687 17:32:23 17:32:58 17:32:23
> 
> Now my server starts. Hovever, as soon as I kill and restart the server, the 
> same problem returns.
> I’m 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’t allocate 
> another block? why it worked after deleting the leftover one?
> 
>> On Dec 28, 2015, at 7:49 AM, Tapple Gao  wrote:
>> 
>> /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   14Gi93% 44604554  
>> 3741719   92%   /
>> devfs  329Ki  329Ki0Bi   100% 1138   
>>  0  100%   /dev
>> map -hosts   0Bi0Bi0Bi   100%0   
>>  0  100%   /net
>> map auto_home0Bi0Bi0Bi   100%0   
>>  0  100%   /home
>> map -fstab   0Bi0Bi0Bi   100%0   
>>  0  100%   /Network/Servers
>> /dev/disk0s5   442Gi  353Gi   89Gi80% 92513182 
>> 23266901   80%   /Volumes/Shared
>> localhost:/18XTcmWVPTgvjvav7dUs5F  184Gi  184Gi0Bi   100%0   
>>  0  100%   /Volumes/MobileBackups
>> 
>> 
>>> On Dec 27, 2015, at 4:18 PM, Jim Jagielski  wrote:
>>> 
>>> 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
>>>>>  

Re: apr_shm_create succeeds then fails on Mac OS X

2015-12-28 Thread Jim Jagielski
Registering it as a cleanup is likely better
> On Dec 28, 2015, at 9:09 AM, Yann Ylavic  wrote:
> 
> 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().
> 
> Regards,
> Yann.
> 
> 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.
>> 
>>> On Dec 28, 2015, at 8:43 AM, Tapple Gao  wrote:
>>> 
>>> I found something that helped: I googled and discovered the ipcs utility:
>>> 
>>> 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 KEYMODE   OWNERGROUP  CREATOR   CGROUP NATTCH  
>>> SEGSZ  CPID  LPID   ATIMEDTIMECTIME
>>> Shared Memory:
>>> m  65536 0x0052e2c1 --rw--- postgres postgres postgres postgres  6  
>>>56484484 19:25:25  8:24:22 19:25:25
>>> m 1572865 0x0101d953 --rw--- rootwheel rootwheel  0 
>>> 2401448  78687  78687 17:32:23 17:32:58 17:32:23
>>> m  65541 0x --rw--- _devicemgr _devicemgr _devicemgr _devicemgr 
>>>  5  1652652 19:25:36  8:24:22 19:25:36
>>> m 2293766 0x0101d952 --rw--- rootwheel rootwheel  0 
>>>904  78687  78687 17:32:23 17:32:58 17:32:23
>>> 
>>> Hey. that size of 2401448 looks familiar. yup. that’s the size listed of 
>>> the failed allocation in the logs. Let’s try removing it:
>>> 
>>> 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 KEYMODE   OWNERGROUP  CREATOR   CGROUP NATTCH  
>>> SEGSZ  CPID  LPID   ATIMEDTIMECTIME
>>> Shared Memory:
>>> m  65536 0x0052e2c1 --rw--- postgres postgres postgres postgres  6  
>>>56484484 19:25:25  8:26:22 19:25:25
>>> m  65541 0x --rw--- _devicemgr _devicemgr _devicemgr _devicemgr 
>>>  5  1652652 19:25:36  8:26:22 19:25:36
>>> m 2293766 0x0101d952 --rw--- rootwheel rootwheel  0 
>>>904  78687  78687 17:32:23 17:32:58 17:32:23
>>> 
>>> Now my server starts. Hovever, as soon as I kill and restart the server, 
>>> the same problem returns.
>>> I’m 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’t 
>>> allocate another block? why it worked after deleting the leftover one?
>>> 
>>>> On Dec 28, 2015, at 7:49 AM, Tapple Gao  wrote:
>>>> 
>>>> /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   14Gi93% 44604554  
>>>> 3741719   92%   /
>>>> devfs  329Ki  329Ki0Bi   100% 1138 
>>>>0  100%   /dev
>>>> map -hosts       0Bi    0Bi0Bi   100%0 
>>>>0  100%   /net
>>>> map auto_home0Bi0Bi0Bi   100%0 
>>>>0  100%   /home
>>>> map -fstab   0Bi0Bi0Bi   100%0 
>>>>0  100%   /Network/Servers
>>>> /dev/disk0s5   442Gi  353Gi   89Gi80% 92513182 
>>>> 23266901   80%   /Volumes/Shared
>>>> localhost:/18XTcmWVPTgvjvav7dUs5F  184Gi  184Gi0Bi   100%0 
>>>>0  100%   /Volumes/MobileBackups
>>>> 
>>>> 
>>>>> On Dec 27, 2015, at 4:18 PM, Jim Jagielski  wrote:
>>>>> 
>>>>> 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 

Re: Debugging a module that works in homebrew's httpd24 but not OSX's preinstalled one

2016-01-11 Thread Jim Jagielski
If the module is not using the exact same APR lib (ie, 1.4.x
instead of 1.5.x) then you could easily get this to happen.

> On Jan 11, 2016, at 2:38 PM, Andy Li  wrote:
> 
> Hi,
> 
> I'm developing (updating) mod_neko , a
> module that let users to use the Neko VM  to serve web
> requests.
> The module already works on Windows and Linux, but I have a problem on Mac.
> In fact, the module works on the apache httpd 2.4 installed with
> homebrew-apache , but not the
> OSX preinstalled httpd (which is also 2.4).
> When activating mod_neko on the OSX preinstalled httpd, I can see the log
> message from the ap_hook_post_config function, but it will seg fault and
> never print the log in ap_hook_child_init. The ap_hook_post_config function
> seem to successfully return, since my log statement is merely above its
> return statement.
> The outputs of apachectl -V/-l/-M of the homebrew httpd and the OSX httpd
> can be found at https://gist.github.com/andyli/2e8da482dea18306ff6f
> Do you have any idea why this happens? Can this be caused by the OSX httpd
> being compiled with an old apr library? Is there a way to know the exact
> point of when the process seg fault (a stack trace or something)?
> 
> Best regards,
> Andy