Re: Strange error (Socket command option unknown)

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Carlos Moreno <moreno(at)mochima(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Strange error (Socket command option unknown)
Date: 2003-02-23 15:15:47
Message-ID: m3adgnvxi4.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Carlos Moreno <moreno(at)mochima(dot)com> writes:

> I wonder if the fact that my app. is multi-threaded
> (logging to database is something that has kind of
> low-priority, and I don't want it to interfere with the
> "main loop" of my app. -- the main loop is basically
> the communications loop, which is critical for the
> responsiveness of my server to the multiple clients).
>
> So, I wonder if I (or postgres??) is doing something
> wrong with the multiple requests?? There are only
> two threads that make any use of the database:
> one that logs to db (i.e., exclusively insert, update,
> and delete commands), and one to process the
> login authentications (users' names and passwords
> are stored in the database, along with related
> information that has to be retrieved at login-time).

If you're using the database from two threads, you should either be
using one DB connection per thread, or protecting the single DB
connection with a mutex lock for the duration of each query. One
connection per thread is probably simplest.

> So, is it possible that these two threads are "stepping
> on each other's tails"?

Quite possible, unless you're taking steps to prevent it. Sharing a
single connection between independent threads with no locking is
probably not going to work.

-Doug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-02-23 15:16:57 Re: troubles with postgresql
Previous Message Dennis Gearon 2003-02-23 14:59:43 Re: troubles with postgresql