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
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
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
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
Hi Bronto,
http://lmgtfy.com/?q=apache+httpd+valgrind
Thank you for the tip :) You are funny!
Cheers,
Andrej
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,
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
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,
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
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:
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
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
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
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
Hi,
Register a cleanup on the pool passed to your child_init function.
Yes of course, thank you.
Cheers,
Andrej
Hi,
I guess you are hit by this:
https://issues.apache.org/bugzilla/show_bug.cgi?id=46467
Indeed so it was!
Cheers,
Andrej
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
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
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.
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
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
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
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
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
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
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
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,
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) {
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,
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
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
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
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
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
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
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
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
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
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
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
Hi Tom,
Thanks a lot for your help! Everything works as expected...
Cheers,
Andrej
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
, 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
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
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,
, 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
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
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
() 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
63 matches
Mail list logo