Thread: 1024 limits??

1024 limits??

From
Mathieu Dube
Date:
Hi,    Im building a server that uses libpq to connect to a database and
authenticate the users that connect.    I do PQfinish for the conn and PQclear for the result so there cant be
a memory leak there.    If I remove the function where I authenticate my server can handle as
much clients as I want.If I authenticate every clients with connections to the database it
crashes on PQconnectdb at th 1024th client without returning an error(it just
segfaults).    My ulimit -n is more than 1024 btw.
    Did anybody encounter such problem?? I've been trying to fix this one
for a long time...
                                                Thanks                                                     -Mat

-- 
Mathieu Dube    
Mondo-Live            
www.flipr.com


Re: 1024 limits??

From
Mathieu Dube
Date:
I just do a select on a user table with the username and password

pretty upfront and normal query

you would like me to use PQtrace???
it doesnt say much

if I do bt on gdb it says: 0x4b3003d in ?? ()

On Mon, 05 Feb 2001, you wrote:
> Mathieu Dube <mathieu_dube@videotron.ca> writes:
> >      If I remove the function where I authenticate my server can handle as
> > much clients as I want.
> 
> Which authentication method do you use?
> 
> >     If I authenticate every clients with connections to the database it
> > crashes on PQconnectdb at th 1024th client without returning an error(it just
> > segfaults).
> 
> Please provide a backtrace from the segfault ...
> 
>             regards, tom lane
-- 
Mathieu Dube    
Mondo-Live            
www.flipr.com


Re: 1024 limits??

From
Tom Lane
Date:
Mathieu Dube <mathieu_dube@videotron.ca> writes:
>      If I remove the function where I authenticate my server can handle as
> much clients as I want.

Which authentication method do you use?

>     If I authenticate every clients with connections to the database it
> crashes on PQconnectdb at th 1024th client without returning an error(it just
> segfaults).

Please provide a backtrace from the segfault ...
        regards, tom lane


Re: 1024 limits??

From
Mathieu Dube
Date:
Im currently using rpms 
is there a way to just remove an rpm(the API one) and compile only that??

where can I find libpq sources?

my app is already compiled with -g

On Mon, 05 Feb 2001, you wrote:
> Mathieu Dube <mathieu_dube@videotron.ca> writes:
> > if I do bt on gdb it says: 0x4b3003d in ?? ()
> 
> You'll need to recompile libpq and your application with -g in CFLAGS
> to get a more useful backtrace from gdb.
> 
>             regards, tom lane
-- 
Mathieu Dube    
Mondo-Live            
www.flipr.com


Re: 1024 limits??

From
"Mitch Vincent"
Date:
You need to compile PostgreSQL from source with -g ..

ftp.postgresql.org is the main FTP, there are many mirrors. Look for the
source tarball there..

-Mitch

----- Original Message -----
From: "Mathieu Dube" <mathieu_dube@videotron.ca>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: <pgsql-hackers@postgresql.org>
Sent: Monday, February 05, 2001 11:31 AM
Subject: Re: 1024 limits??


> Im currently using rpms
> is there a way to just remove an rpm(the API one) and compile only that??
>
> where can I find libpq sources?
>
> my app is already compiled with -g
>
> On Mon, 05 Feb 2001, you wrote:
> > Mathieu Dube <mathieu_dube@videotron.ca> writes:
> > > if I do bt on gdb it says: 0x4b3003d in ?? ()
> >
> > You'll need to recompile libpq and your application with -g in CFLAGS
> > to get a more useful backtrace from gdb.
> >
> > regards, tom lane
> --
> Mathieu Dube
> Mondo-Live
> www.flipr.com
>



Re: 1024 limits??

From
Tom Lane
Date:
"Mitch Vincent" <mitch@venux.net> writes:
> You need to compile PostgreSQL from source with -g ..
> ftp.postgresql.org is the main FTP, there are many mirrors. Look for the
> source tarball there..

>> Im currently using rpms
>> is there a way to just remove an rpm(the API one) and compile only that??

If you don't want to mess with removing the RPMs, you don't have to.
Build the source with -g, but don't install it.  Instead, copy the
static libpq.a library (look in src/interfaces/libpq after building)
to your application directory, and force your app to link against it
instead of against the libpq.so that's in /usr/lib (or whereever the
RPMs installed it).
        regards, tom lane


Re: Re: 1024 limits??

From
Mathieu Dube
Date:
cc -o therver therver.c -g -lflipr -lpq -L. -lpthread -D_REENTRANT
./libpq.a(fe-auth.o): In function `pg_password_sendauth':
/usr/local/postgresql-7.0.3/src/interfaces/libpq/fe-auth.c:465: undefined reference to `crypt'
collect2: ld returned 1 exit status
make: *** [therver] Error 1

this is what I get 
should I copy other files?

On Mon, 05 Feb 2001, you wrote:
> "Mitch Vincent" <mitch@venux.net> writes:
> > You need to compile PostgreSQL from source with -g ..
> > ftp.postgresql.org is the main FTP, there are many mirrors. Look for the
> > source tarball there..
> 
> >> Im currently using rpms
> >> is there a way to just remove an rpm(the API one) and compile only that??
> 
> If you don't want to mess with removing the RPMs, you don't have to.
> Build the source with -g, but don't install it.  Instead, copy the
> static libpq.a library (look in src/interfaces/libpq after building)
> to your application directory, and force your app to link against it
> instead of against the libpq.so that's in /usr/lib (or whereever the
> RPMs installed it).
> 
>             regards, tom lane
-- 
Mathieu Dube    
Mondo-Live            
www.flipr.com


Re: Re: 1024 limits??

From
Alfred Perlstein
Date:
* Mathieu Dube <mathieu_dube@videotron.ca> [010205 09:32] wrote:
> cc -o therver therver.c -g -lflipr -lpq -L. -lpthread -D_REENTRANT
> ./libpq.a(fe-auth.o): In function `pg_password_sendauth':
> /usr/local/postgresql-7.0.3/src/interfaces/libpq/fe-auth.c:465: undefined reference to `crypt'
> collect2: ld returned 1 exit status
> make: *** [therver] Error 1
> 
> this is what I get 
> should I copy other files?

no, just add -lcrypt to your LDFLAGS



Re: Re: 1024 limits??

From
Mathieu Dube
Date:
Which file should I read the symbol from??

On Mon, 05 Feb 2001, Mitch Vincent wrote:
> You need to compile PostgreSQL from source with -g ..
> 
> ftp.postgresql.org is the main FTP, there are many mirrors. Look for the
> source tarball there..
> 
> -Mitch
> 
> ----- Original Message -----
> From: "Mathieu Dube" <mathieu_dube@videotron.ca>
> To: "Tom Lane" <tgl@sss.pgh.pa.us>
> Cc: <pgsql-hackers@postgresql.org>
> Sent: Monday, February 05, 2001 11:31 AM
> Subject: Re: 1024 limits??
> 
> 
> > Im currently using rpms
> > is there a way to just remove an rpm(the API one) and compile only that??
> >
> > where can I find libpq sources?
> >
> > my app is already compiled with -g
> >
> > On Mon, 05 Feb 2001, you wrote:
> > > Mathieu Dube <mathieu_dube@videotron.ca> writes:
> > > > if I do bt on gdb it says: 0x4b3003d in ?? ()
> > >
> > > You'll need to recompile libpq and your application with -g in CFLAGS
> > > to get a more useful backtrace from gdb.
> > >
> > > regards, tom lane
> > --
> > Mathieu Dube
> > Mondo-Live
> > www.flipr.com
> >
-- 
Mathieu Dube    
Mondo-Live            
www.flipr.com


Re: Re: 1024 limits??

From
Mathieu Dube
Date:
From which file should I load the symbol for gdb??
                Thanks                -Mat
On Mon, 05 Feb 2001, you wrote:
> "Mitch Vincent" <mitch@venux.net> writes:
> > You need to compile PostgreSQL from source with -g ..
> > ftp.postgresql.org is the main FTP, there are many mirrors. Look for the
> > source tarball there..
> 
> >> Im currently using rpms
> >> is there a way to just remove an rpm(the API one) and compile only that??
> 
> If you don't want to mess with removing the RPMs, you don't have to.
> Build the source with -g, but don't install it.  Instead, copy the
> static libpq.a library (look in src/interfaces/libpq after building)
> to your application directory, and force your app to link against it
> instead of against the libpq.so that's in /usr/lib (or whereever the
> RPMs installed it).
> 
>             regards, tom lane
-- 
Mathieu Dube    
Mondo-Live            
www.flipr.com