Re: [Sqlrelay-discussion] listener hang with open database port
Brought to you by:
mused
|
From: Cal H. <ca...@fb...> - 2010-05-27 17:28:58
|
Well I think I like the last suggestion the best, since it's the easiest to
implement. ;-)
void scaler::incConnections()
{
if ( ! use_fork )
semset->wait(8);
if (use_fork) {
fprintf(stderr, "incConnections(): DO incr\n"); fflush(stderr);
this->currentconnections++;
}
}
This seems to work just the same, however I've noticed that the scalers
"Sessions" count doesn't decrease. Each failed connection causes the count
to increase by one.
I was playing around with something like:
if (! semset->waitWithUndo(8, 10, 0) )
{
// decrement session counter, I'm not sure if this should happen
here
shmdata *ptr=(shmdata *)idmemory->getPointer();
ptr->connectionsinuse--;
return;
}
Which seemed to work fine, but I'm not sure that's the correct place to
decrement that counter.
Any ideas on that?
Thanks Renat!
--Cal
On Thu, May 27, 2010 at 12:13 PM, Renat Sabitov <sr...@st...> wrote:
> 27.05.2010 20:04, Cal Heldenbrand пишет:
>
> #3 0x000000000040486c in scaler::incConnections (this=0x5061f0) at
> scaler.C:502
> 502 if (! semset->wait(8) )
>
> Ok, now I see. Scaler waits for new connection to report that it started.
> So if connection hangs (or exit) somewhere before calling signal(8), scaler
> will never stop waiting.
>
>
> void scaler::incConnections()
> {
> /* wait for the connection count to increase. Time out at 10 seconds.
> * Since the login timeout is 5 seconds, this gives a bit of buffer
> time
> */
> if (! semset->waitWithUndo(8, 10, 0) )
> return;
>
> I think that the best way is to move incrementing connection counter
> somewhere before interacting with db, just after conenction process starts.
> May be in init. Or even get rid of semaphore #8 at all in case of -fork,
> because scaler already knows if connection starts or not (it got PID).
>
> --
> Renat
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
>
|