Mailing List Archive

[mod_backhand-users] mod_python with mod_backhand ???
Hi All !

first of all, after some troubles related to mod_python, mod_backhand and the
AddModule order if managed it to build up a working serverfarm, and nevertheless,
mod_backhand _is_ GREAT ! - thanks to theo for his work :)

well, now for the questions:

has anyone here experience with mod_python (2.4.1) and mod_backhand ????

obviously mod_backhand can only load and execute byHostname.so when both
mod_backhand and mod_python are compiled into apache.

the problem is that *servers in the line

int byHostname(request_rec *r, ServerSlot *servers, int *n, char *arg)

isn't initialised correctly (its a null pointer) - feeding this into the regex engine
causes a segfault :)

if i put it into builtins it all works fine
if i remove mod_python it all works fine

anyone some hints ???

thanx a lot,
marcus.

--
________________________________________________________________________
ICAN Internet Services GmbH - www.ican.at Marcus Priesch
Loquaiplatz 12/1, A-1060 Vienna mpriesch@ican.at
Tel: +43(1) 595 41 24/26 Fax: +43(1) 595 41 24/99 ICQ: 56430787
[mod_backhand-users] mod_python with mod_backhand ??? [ In reply to ]
Marcus,

Are you sure it is "servers" that is a null pointer and not serverstats? If
it is "servers", there will be a whole world of problems. I cannot see how
"servers" could feasibly be NULL. The calling function (of byHostname)
declares:

ServerSlot candidates[MAXSERVERS];

In the candidacy function it is passed in as

candidacyfunction(request, candidates, &ncand, closure);

I am passing reference to a stack allocated array. The compiler must be
broken if "candidates" is NULL when the byHostname gets it (named "servers").

I have heard of problems where "serverstats" is NULL. This will also surely
cause a segfault. I am working on it, but so far I have been unable to track
down the problem -- it doesn't behave this way on my systems. It has
something to do with the way "serverstats" is exported to DSO's. When you go
to the /backhand/ page, it is there, so obviously "serverstats" is not NULL in
that Apache child, but as soon as a DSO tries to touch that variable, it just
isn't there. I *think* it may be as simple as changing some compile/link
flags, but that is just a hunch.

One solution, though obviously not the *right* way of doing it, is to modify
the mod_backhand code to make byHostname one of the "builtins", so it doesn't
need to dynamically load it. I know that few people who run Solaris have done
that to work around separate DSO loading problem.

The only files you need to edit are builtins.h and builtins.c. Add the
prototype of byHostname in builtins.h and increment the #define _BuiltinCount
at the bottom by one. Then slap the code in byHostname.c intot he builtins.c
file and you should be good to go. If you know C, this should be pretty
straight forward.

Marcus Priesch wrote:
> the problem is that *servers in the line
>
> int byHostname(request_rec *r, ServerSlot *servers, int *n, char *arg)
>
> isn't initialised correctly (its a null pointer) - feeding this into the regex
> engine causes a segfault :)



Theo Schlossnagle
1024D/A8EBCF8F/13BD 8C08 6BE2 629A 527E 2DC2 72C2 AD05 A8EB CF8F
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
[mod_backhand-users] mod_python with mod_backhand ??? [ In reply to ]
"Theo E. Schlossnagle" wrote:
>
> Marcus,
>
> Are you sure it is "servers" that is a null pointer and not serverstats? If
> it is "servers", there will be a whole world of problems. I cannot see how
> "servers" could feasibly be NULL. The calling function (of byHostname)
> declares:

Hi Theo,

ok, that was my mistake, of course its serverstats that is NULL, mea culpa :)

well, the serverstats page has all the values and 'builtins' _is_ a way, i've
tried it and it definitely works, but for me its no difference if i have to
modify the backhand code or recompile the whole apache each time a new version
of backhand arrives ...

well, it works if you compile mod_backhand and mod_python in.

if you want to reproduce this on your machine, i can give you some hints !
another possibility that i can offer is to give you some debugging outputs if you
give me some hints on whats interesting ... i've never done anything with gdb :)

anyway the other question is much more interesting (deny access to local scripts
if they could not get backhanded ....)


thanks for your suppotr,
marcus.

--
________________________________________________________________________
ICAN Internet Services GmbH - www.ican.at Marcus Priesch
Loquaiplatz 12/1, A-1060 Vienna mpriesch@ican.at
Tel: +43(1) 595 41 24/26 Fax: +43(1) 595 41 24/99 ICQ: 56430787