Re: Apache log modules

2010-11-28 Thread Andrej van der Zee
Hi Sorin, Thanks for your reply. request_rec-connection-id is a long int that is unique. It is built from the process_id and thread_id of the apache thread that serves the request. Will this be unique for MPM worker across control processes / worker threads? However, a client may open

Apache log modules

2010-11-25 Thread Andrej van der Zee
Hi, I am looking for a way to deduct the concept of a transaction from the Apache log. What I mean is that I want to group HTTP requests that are sent by one particular client, for example when a user clicks a link in the browser. Then I want to be able to group all the HTTP requests that are the

Re: Apache log modules

2010-11-25 Thread Andrej van der Zee
Hi Ted, This is much better done at the application level. I am aware of that, but that is not an option unfortunately. Cheers, Andrej

Re: Apache log modules

2010-11-25 Thread Andrej van der Zee
Hi, My condolences.  I have felt your pain. Thanks ;) I just read the documentation of mod_log_config 2.3 and some logging-options have been added, to my pleasant surprise! I was thinking I could use: %a = client's IP address %{remote}p = client's port Would this pair uniquely identify one

Re: *** glibc detected *** double free or corruption (!prev) in cleanup function

2010-04-22 Thread Andrej van der Zee
Hi Bronto, http://lmgtfy.com/?q=apache+httpd+valgrind Thank you for the tip :) You are funny! Cheers, Andrej

*** glibc detected *** double free or corruption (!prev) in cleanup function

2010-04-21 Thread Andrej van der Zee
Hi, I have a question about apr_pool_cleanup_register for a child's pool. I register a cleanup function that is called when the pool is destroyed. In the cleanup function, I join a background thread that first writes some log to a database: static void mbrace_child_init(apr_pool_t *pool,

mod_proxy_balancer and HTTP response header

2010-04-11 Thread Andrej van der Zee
Hi, I am looking for way to examine the HTTP response generated by BalanceMember in my module that runs on the load balancer. I would like to read a custom HTTP response header that is added by the application, but I would like to read it on the load-balancer. I tried to read it in the

Re: LD_PRELOAD for modules

2010-03-27 Thread Andrej van der Zee
Hi William, LoadFile Saving on ink aren't you ;) Thanks for the advise, I will give it a go soon. Just one question you might be able to answer. From the documentation it looks like LoadFile is used to add additional code. In my case, I need to override existing functionality. For example,

Re: LD_PRELOAD for modules

2010-03-27 Thread Andrej van der Zee
Hi, When mod_php is loaded into httpd, it's mysql dependencies/symbols will get resolved against the mysql client you have already LoadFile'd into httpd. Thanks that is could news, so the libraries in LoadFile directives are loaded first. Thanks, Andrej

Re: LD_PRELOAD for modules

2010-03-27 Thread Andrej van der Zee
Hi, Maybe a bit off-topic for this mailing list, but I need to do the same preload-trick for CGI applications written in C++. I was thinking about a wrapper bash-script that usese LD_PRELOAD in addition to a rewrite rule in Apache directive. I have some problems with the wrapper script:

Re: LD_PRELOAD for modules

2010-03-27 Thread Andrej van der Zee
Hi Sorin, In the Debian package of apache there's /etc/apache2/envvars. I'm not sure if this file appears in an out-of-the-box compilation of apache2. Anyway, /usr/sbin/apache2ctl looks for it and loads it before launching the server. The server in launched in the environment that is set

LD_PRELOAD for modules

2010-03-26 Thread Andrej van der Zee
Hi, I want to override a library that is linked with an Apache module, i.e. I want to use my modified version of the MySQL client library for example for mod_php. I would like to do this without relinking or even modifying the mod_php lib. I was hoping that I could use something like LD_PRELOAD

detect disconnect in CGI

2009-10-23 Thread Andrej van der Zee
Hi, I am using mod_cgi using Cgicc with C++ on Linux. I need a way to detect disconnects from the client. I think I have a way to do this, but I wanted to make sure if there is no easier way. I am writing a space back to the client every second as part if a custom HTTP response header. When the

ap_hook_child_init

2009-07-26 Thread Andrej van der Zee
Hi, I have an Apache module for mpm-prefork that runs a background thread. The thread is initialized in ap_hook_child_init() which works just fine. But, I have to finish the thread neatly when the process exits. How can I force this? I could not find any hook-method that is called before the

Re: ap_hook_child_init

2009-07-26 Thread Andrej van der Zee
Hi, Register a cleanup on the pool passed to your child_init function. Yes of course, thank you. Cheers, Andrej

Re: segmentation fault in worker.c

2009-07-08 Thread Andrej van der Zee
Hi, I guess you are hit by this: https://issues.apache.org/bugzilla/show_bug.cgi?id=46467 Indeed so it was! Cheers, Andrej

segmentation fault in worker.c

2009-07-07 Thread Andrej van der Zee
Hi, I compiled httpd-2.2.11 with ./configure --with-included-apr --enable-ssl --disable-cgi --disable-cgid --with-mpm=prefork --enable-status. HTTP requests seem to be processed fine from a users point of view, but I get many segfaults in my apache log when I seriously increase the workload. Here

load mod_php.so for each child separately

2009-03-26 Thread Andrej van der Zee
Hi, If I am correct, on Linux all childs in MPM prefork share the same mod_php.so which is loaded in the parent process. Is there a way to load mod_php.so separately for each forked child? Can I force such a thing in httpd.conf or maybe in the child_init() hook in a module? Cheers, Andrej

Re: child_init for threads?

2009-03-19 Thread Andrej van der Zee
Hi, Note that there is a difference between the apr_thread_data_*() methods and the apr_threadkey_private_*() methods. The apr_thread_data_*() methods actually associate your data with the thread-pool. Since each new apr thread has it's own private thread-pool everything should work fine.

Re: child_init for threads?

2009-03-19 Thread Andrej van der Zee
Hi, apr_os_thread_t os_thd = apr_os_thread_current (); apr_thread_t *apr_thd; apr_status_t apr_os_thread_put(apr_thd, os_thd, r-pool); Okay, this clearly doesn't work. I misunderstood the documentation, but the sources don't lie. Anyway, how can I get the apr_thread_t for the current

MaxRequestsPerChild for MPM worker threads?

2009-03-19 Thread Andrej van der Zee
Hi, Is there a way to let a MPM worker thread exit after serving X requests? I need to do some tests that requires checking if my custom hook ap_hook_thread_exit() is called properly. I found a directive to have one thread per child that gets me in the right direction (ThreadsPerChild 1). Now I

Re: child_init for threads?

2009-03-18 Thread Andrej van der Zee
Hi, Thanks. Yes. create_connection() is the first hook run as part of request processing, a delay in create_connection() will result in a delay in HTTP processing. That's too bad. I guess I have to hack this into the MPM then. One more question, what would be the way to store

Re: child_init for threads?

2009-03-18 Thread Andrej van der Zee
Hi, Thanks, that helps! Since I am developing my modules in C++, I think I should be using this one: apr_status_t apr_thread_data_set( void * data, const char *key, apr_status_t(*)(void *) cleanup, apr_thread_t

child_init for threads?

2009-03-17 Thread Andrej van der Zee
Hi, I was wondering if there is an analogue hook like child_init() for threads that I can use for doing some time-consuming thread-initialisation that should not slow down an HTTP request handler. More specific, I want to initialise some per-thread variables that come from a database. Does the

start httpd with one child for debugging

2009-03-17 Thread Andrej van der Zee
Hi, I believe I read some while ago that it is possible to start httpd with only one child (a special for debugging httpd). I am not able to find this option anymore. Does such an option really exist? Thank you, Andrej

Re: hook before receiving HTTP request

2009-03-16 Thread Andrej van der Zee
Hi, http://httpd.apache.org/docs/2.2/developer/modules.html ap_hook_pre_connection    do any setup required just before processing, but after accepting ap_hook_create_request    ?? (Assuming) ap_hook_create_request will be called when creating a request_rec * for each request on a

hook before receiving HTTP request

2009-03-16 Thread Andrej van der Zee
Hi, I am looking for a hook function that I can call to initialize some structures before it accepts a connections. Similar like ap_log_transaction() is called after the HTTP reply is sent to the client, I need a hook that is called before a HTTP request is received. Is it there? Thank you,

post_config on reload

2009-03-13 Thread Andrej van der Zee
Hi, I found this piece of code for dealing with the post_config issue (it is called twice, while I need to initialise my stuff only once): void *data; const char *userdata_key = post_config_only_once_key; apr_pool_userdata_get(data, userdata_key, s-process-pool); if (!data) {

Re: custom background thread and module sharing a data structure

2009-03-13 Thread Andrej van der Zee
Hi Saju, For the worker mpm, both cross thread and cross process protection will be needed. apr_proc_mutex.h family supplies cross-process protection, apr_thread_mutex.h provides cross thread protection. You locking method would be a wrapper method that first obtains a process level lock,

Re: post_config on reload

2009-03-13 Thread Andrej van der Zee
Hi, Do not do this - a restart should be a restart, not a half of a restart. You should be reinitializing whatever you do on a restart as well as a start. That's the whole point. I have one phrase that should illustrate why : memory leak. For example, if your extension creates another

Re: custom background thread and module sharing a data structure

2009-03-13 Thread Andrej van der Zee
Hi, Thanks for your comments. See below... Worker mpm is a multithreaded, multiprocess mpm. Multiple child processes host multiple worker threads that run your module code. If your module services 2 concurrent requests in 2 different threads in the same process and both the threads need to

Re: custom background thread and module sharing a data structure

2009-03-13 Thread Andrej van der Zee
Hi, My point is that within a single process, multiple threads can service requests that can end up firing your module code. If you only do process locking you can still have more than 1 thread executing your module code at the same time. Just a process level lock will *not* guarantee

Re: custom background thread and module sharing a data structure

2009-03-12 Thread Andrej van der Zee
Hi, Thanks for the info. For the worker mpm, both cross thread and cross process protection will be needed. apr_proc_mutex.h family supplies cross-process protection, apr_thread_mutex.h provides cross thread protection. You locking method would be a wrapper method that first obtains a

Re: custom background thread and module sharing a data structure

2009-03-11 Thread Andrej van der Zee
Hi, Yes, I did this. I will send you a commented source file sometimes today or early tomorrow (Central European Time), I don't really have time now. Great, I will be waiting for that! Thanks, Andrej

custom background thread and module sharing a data structure

2009-03-10 Thread Andrej van der Zee
Hi, I need to modify Apache and run one custom background thread. In addition, my custom modules have to be able to share a data structure with this background thread. Did anybody do this before? Is there an example I can use as a starting point? Thank you, Andrej -- Andrej van der Zee 2-40

process initialisation in prefork-MPM

2008-12-22 Thread Andrej van der Zee
by the process. How should I do this? Thank you, Andrej -- Andrej van der Zee 2-40-19 Koenji-minami Suginami-ku, Tokyo 166-0003 JAPAN Mobile: +81-(0)80-65251092 Phone/Fax: +81-(0)3-3318-3155

Re: process initialisation in prefork-MPM

2008-12-22 Thread Andrej van der Zee
You hook child_init (ap_hook_child_init) and store your data in global variables that are accessed by post_read_request and log_transaction. Easy enough. Thanks, Andrej

Re: process initialisation in prefork-MPM

2008-12-22 Thread Andrej van der Zee
Hi, You hook child_init (ap_hook_child_init) and store your data in global variables that are accessed by post_read_request and log_transaction. BTW, in a worker-MPM, is child_init executed for every created worker-thread? Or is it per process? Thank you, Andrej

connection speed / data transfer time

2008-11-25 Thread Andrej van der Zee
Hi, I was wondering if it is possible to get the connection speed in an Apache module. Actually, I can get to the actual bytes transferred to/from the client, so the transfer time would also do. Thank you, Andrej

Re: connection speed / data transfer time

2008-11-25 Thread Andrej van der Zee
Hi Ray, Thanks for your reply. see mog_logio for the actual bytes transferred and mod_status or others for examples of the time required. I need the duration of network transfer per HTTP request and response, but I cannot find this information in mod_status. Are there any specific points in

Re: mod_dbd and prepared statements (httpd-2.2.9)

2008-10-19 Thread Andrej van der Zee
Hi Tom, Thanks a lot for your help! Everything works as expected... Cheers, Andrej

Re: mod_dbd and prepared statements (httpd-2.2.9)

2008-10-18 Thread Andrej van der Zee
Hi, I did not find a solution, I just stopped using prepared statements altogether. But I tried to isolate the problem just now, and found somehow that I cannot use FLOAT in prepared statement somehow (when I tried INT columns it even segfaults). Below the source code of a mini-module to

mpm worker and mod_cgi

2008-10-16 Thread Andrej van der Zee
Hi, I am compiling mod_cgi with apxs outside the httpd-2.2.9 source tree. When I choose --with-mpm=prefork this works fine, but when I use --with-mpm=worker it seems not to use the implementation in the module at all (the cgi_handler hook method is never called, but CGI applications seem to work

APR_DECLARE_OPTIONAL_FN and APR_RETRIEVE_OPTIONAL_FN

2008-10-09 Thread Andrej van der Zee
Hi, I was wondering what the purpose is of the macros APR_DECLARE_OPTIONAL_FN and APR_RETRIEVE_OPTIONAL_FN. For example, in mod_authn_dbd APR_RETRIEVE_OPTIONAL_FN is used to get a hold on the functions ap_dbd_acquire and ap_dbd_prepare declared in in mod_dbd with APR_DECLARE_OPTIONAL_FN. I could

Re: APR_DECLARE_OPTIONAL_FN and APR_RETRIEVE_OPTIONAL_FN

2008-10-09 Thread Andrej van der Zee
Hi, Without them, it became impossible to build plugable frameworks without linking one module to another. Yes of course, that would be necessary if you compile your module outside the httpd source tree with apxs I guess. Thanks a lot, Andrej

Re: number of bytes/packets sent/received

2008-10-09 Thread Andrej van der Zee
Thanks for your reply! Giving it a second thought, the problem looks complicated. Such filter-based counters would count the traffic of _one_ apache process. When you increment the counter, you have to protect it from concurrent access by other threads running in the same apache child

Re: number of bytes/packets sent/received

2008-10-09 Thread Andrej van der Zee
Hi Dave, Would mod_logio be at all helpful? http://httpd.apache.org/docs/2.2/mod/mod_logio.html I haven't looked into it, but the source might give you some ideas. You may even have a direct solution if you use a module that logs directly to a database. I must admit that I don't know

Re: number of bytes/packets sent/received

2008-10-09 Thread Andrej van der Zee
Hi, No, the Content-Length doesn't include the size of the headers. Yes of course, but you could add the length of all r-headers_in. I just wondered if the content-type reflects the actual size, for example if the request is compressed. While I was typing the message, Dave Ingram's message

Re: number of bytes/packets sent/received

2008-10-09 Thread Andrej van der Zee
Hi, A quick search reveals that there are some modules out there that do log to databases, but I don't know how well-maintained they are (mod_log_sql only mentions Apache 2.0, for example) or how much work they would be to use (an O'Reilly page

mod_dbd/apr_dbd and Commands out of sync

2008-10-03 Thread Andrej van der Zee
Hi, I am using mod_dbd for the first time and get into trouble when I execute the following in sequence: 1) do an INSERT 2) do a SELECT 3) do another INSERT On 3) I get the error Commands out of sync; you can't run this command now. This is what MySQL sais: If you get Commands out of sync; you

Re: mod_dbd/apr_dbd and Commands out of sync

2008-10-03 Thread Andrej van der Zee
Hi, When I execute two SELECT statements after each other I do not get the Comamnd out of sync error anymore if I iterate through all the rows in the apr_dbd_results_t, but I do get all emty values and column names for the 2nd SELECT. Can you please post your code ? Below the code. The

Re: mod_dbd/apr_dbd and Commands out of sync

2008-10-03 Thread Andrej van der Zee
Hi Jerome, Thanks for your answer. I just went through the sources of apr_dbd and saw that I have to loop through all the rows in a apr_dbd_results_t before mysql_free_result() is called through apr_pool_cleanup_run(). In my code I am sure the result is exactly one, but unfortunately I have to

Re: mod_dbd/apr_dbd and Commands out of sync

2008-10-03 Thread Andrej van der Zee
Hi, I still have another open issue with mod_dbd I was hoping you could help me with. When I execute the query SELECT LAST_INSERT_ID() I always get an empty string as a result. I do receive one row, but nothing in it. Is this a mod_dbd issue you think, or a mysql issue? Cheers, Andrej

writing to database in Apache module

2008-10-02 Thread Andrej van der Zee
Hi, I wrote my first Apache module that gathers performance data of each request. Currently, I write the information to a log file in the log_transaction hook function. I would like to write this to a MySQL database instead. What is the recommended way to do this? Cheers, Andrej -- Andrej van

Access configuration variable in other modules

2008-09-13 Thread Andrej van der Zee
Hi, I am writing my first Apache module for monitoring resource usage of embedded interpreters and CGI applications on Linux (I am also adapting mod_cgi and the apr-library). The problem is that my own module has some server-level configuration options that I can initialize and use in my own

Access configuration variable in other modules

2008-09-13 Thread Andrej van der Zee
Hi, I am writing my first Apache module for monitoring resource usage of embedded interpreters and CGI applications on Linux (I am also adapting mod_cgi and the apr-library). The problem is that my own module has some server-level configuration options that I can initialize and use in my own

Re: Access configuration variable in other modules

2008-09-13 Thread Andrej van der Zee
, Kevac Marko -- Andrej van der Zee 2-40-19 Koenji-minami Suginami-ku, Tokyo 166-0003 JAPAN Mobile: 0031-(0)80-65251092 Phone/Fax: 0031-(0)3-3318-3155

Re: Apache modification questions

2008-09-10 Thread Andrej van der Zee
Hi, A post doesn't normally have anything in the QUERY_STRING. Rather a POSTed form has the stuff being sent in the request body, which is read from STDIN by a script. QUERY_STRING is still available for use. Consider this form: form method=post action=myscript.cgi input

apr_open_file and apr_write_file in post_read_request and log_transaction

2008-09-09 Thread Andrej van der Zee
Hi, I am new to Apache modules and I am trying to open a file in the hook post_read_request and write to the file in log_transaction. The file is supposed to be only valid for the duration of the request and is named with a unique identifier (created by mod_unique_id). The apr_file_t is carried,

Re: Apache modification questions

2008-09-05 Thread Andrej van der Zee
, but the link for Autogenerated Apache 2 code documentation is not working. Thank you, Andrej -- Andrej van der Zee 2-40-19 Koenji-minami Suginami-ku, Tokyo 166-0003 JAPAN Mobile: 0031-(0)80-65251092 Phone/Fax: 0031-(0)3-3318-3155

Re: Apache modification questions

2008-09-05 Thread Andrej van der Zee
you implement the two callbacks and that's it. That's clear. Cheers, Andrej -- Andrej van der Zee 2-40-19 Koenji-minami Suginami-ku, Tokyo 166-0003 JAPAN Mobile: 0031-(0)80-65251092 Phone/Fax: 0031-(0)3-3318-3155

Re: Apache modification questions

2008-09-05 Thread Andrej van der Zee
of such modules usually spawning a new thread/process? My guess is that at least for compiled CGI application written in C/C++ a new process is forked in the hook function. Cheers, Andrej -- Andrej van der Zee 2-40-19 Koenji-minami Suginami-ku, Tokyo 166-0003 JAPAN Mobile: 0031-(0)80-65251092 Phone/Fax: 0031

Apache modification questions

2008-09-04 Thread Andrej van der Zee
() function but no similar exit()-function. Moreover, I need to access the request identifier and log to a file. Can all this be done in an Apache module? Hope you can help! Cheers, Andrej -- Andrej van der Zee 2-40-19 Koenji-minami Suginami-ku, Tokyo 166-0003 JAPAN Mobile: 0031-(0)80-65251092 Phone/Fax