1024 limits??

Started by Mathieu Dubealmost 25 years ago10 messages
#1Mathieu Dube
mathieu_dube@videotron.ca

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mathieu Dube (#1)
Re: 1024 limits??

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

#3Mathieu Dube
mathieu_dube@videotron.ca
In reply to: Tom Lane (#2)
Re: 1024 limits??

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

#4Mathieu Dube
mathieu_dube@videotron.ca
In reply to: Mathieu Dube (#1)
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

#5Mitch Vincent
mitch@venux.net
In reply to: Mathieu Dube (#1)
Re: 1024 limits??

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??

Show quoted text

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

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mitch Vincent (#5)
Re: 1024 limits??

"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

#7Mathieu Dube
mathieu_dube@videotron.ca
In reply to: Tom Lane (#6)
Re: Re: 1024 limits??

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

#8Alfred Perlstein
bright@wintelcom.net
In reply to: Mathieu Dube (#7)
Re: Re: 1024 limits??

* 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

#9Mathieu Dube
mathieu_dube@videotron.ca
In reply to: Mitch Vincent (#5)
Re: Re: 1024 limits??

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

#10Mathieu Dube
mathieu_dube@videotron.ca
In reply to: Tom Lane (#6)
Re: Re: 1024 limits??

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