https://bz.apache.org/bugzilla/show_bug.cgi?id=65159

--- Comment #20 from Eric Covener <[email protected]> ---
>  I still don't know the relationship between r->connection->id and the 
> current apr_thread_t.

Under the WINNT MPM, the worker threads are created in a simple loop and passed
their own index as an argument:

 997         for (i = 0; i < ap_threads_per_child; i++) {
 998             int *score_idx;
 999             int status = ap_scoreboard_image->servers[0][i].status;
1000             if (status != SERVER_GRACEFUL && status != SERVER_DEAD) {
1001                 continue;
1002             }
1003             ap_update_child_status_from_indexes(0, i, SERVER_STARTING,
NULL);
1004
1005             child_handles[i] = CreateThread(NULL, ap_thread_stacksize,
1006                                             worker_main, (void *) i,
1007                                             stack_res_flag, &tid);

This index becomes c->id. The c->id integer/offset is passed down as
"thread_num" when the connection is created:

Related: The c->current_thd is an apr_thread_t which is a wrapper around an OS
thread.


 819         c = ap_run_create_connection(context->ptrans, ap_server_conf,
 820                                      context->sock, thread_num, sbh,

Which ends up in:
5195 static conn_rec *core_create_conn(apr_pool_t *ptrans, server_rec *server,
5196                                   apr_socket_t *csd, long id, void *sbh,
5197                                   apr_bucket_alloc_t *alloc)
...
5250     c->id = id;

Note: the tid logged by mod_log_config is related to the OS thread wrapped in
the apr thread, not the simple index / c->id.

c->id would be used in the layout of the scoreboard and the order of the
mod_status output.


> BTW, the movement of threads in the table is not stress-related. I also saw 
> it happen in during mostly idle times when the server was only seeing some 
> lightweight status check requests once every few seconds.


AFAICT you should never see a different pair of c->id and c->current_thread on
Windows unless you restart.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to