BEGIN strange behaviour
Hi All.
I've sperimented a strange behaviour using the command BEGIN and COMMIT in a
multi-threaded Linux environment.
In one of the two thread I use I've got the following message after
PQexec(myconn, "BEGIN;");
WARNING: there is already a transaction in progress
And after the command PQexec(myconn, "COMMIT;"); (always in the same
thread)
I've got the message
WARNING: there is no transaction in progress.
After these warnings the elaboration is freezing when the next PQexec is
encoutered.
I have the same behaviour even if the second thread is operating on a
different table than the first thread.
The same commands (inside the same code) runs fine in Windows and in MacOS
X.
Any Idea?
Thanks in advance.
Luca.
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Prova 1bitmore Newsletter il servizio per creare newsletter in modo
semplice e veloce, senza bisogno di conoscenze di grafica o di
programmazione.
Gratis per 30 giorni!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7243&d=20071122
On Thu, Nov 22, 2007 at 02:10:49PM +0100, luca.ciciriello@email.it wrote:
Hi All.
I've sperimented a strange behaviour using the command BEGIN and COMMIT in a
multi-threaded Linux environment.
In one of the two thread I use I've got the following message after
PQexec(myconn, "BEGIN;");
You do have different database connections for each thread, right?
Otherwise that's why it's not working...
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
Show quoted text
Those who make peaceful revolution impossible will make violent revolution inevitable.
-- John F Kennedy
On Thu, Nov 22, 2007 at 02:10:49PM +0100, luca.ciciriello@email.it wrote:
I've sperimented a strange behaviour using the command BEGIN and COMMIT in a
multi-threaded Linux environment.
In one of the two thread I use I've got the following message after
PQexec(myconn, "BEGIN;");
Uh, are your two threads using one connection? That's never safe.
The same commands (inside the same code) runs fine in Windows and in MacOS
X.
If you're using one connection and two threads, this is some accident of the
client, and nothing more.
A
--
Andrew Sullivan
Old sigs will return after re-constitution of blue smoke
Dear luca,
libpq is reentrant and thread-safe if the configure command-line option
--enable-thread-safety has been used when the PostgreSQL distribution was
built. In addition, you might need to use additional compiler command-line
options when you compile your application code. Refer to your system's
documentation for information about how to build thread-enabled
applications.
One restriction is that no two threads attempt to manipulate the same PGconn
object at the same time. In particular, you cannot issue concurrent commands
from different threads through the same connection object. (If you need to
run concurrent commands, start up multiple connections.)
Could you check these points?
BR,
Francesco
2007/11/22, luca.ciciriello@email.it <luca.ciciriello@email.it>:
Hi All.
I've sperimented a strange behaviour using the command BEGIN and COMMIT in
a
Show quoted text
multi-threaded Linux environment.
In one of the two thread I use I've got the following message after
PQexec(myconn, "BEGIN;");WARNING: there is already a transaction in progress
And after the command PQexec(myconn, "COMMIT;"); (always in the same
thread)I've got the message
WARNING: there is no transaction in progress.
After these warnings the elaboration is freezing when the next PQexec is
encoutered.I have the same behaviour even if the second thread is operating on a
different table than the first thread.The same commands (inside the same code) runs fine in Windows and in MacOS
X.Any Idea?
Thanks in advance.
Luca.
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/fSponsor:
Prova 1bitmore Newsletter il servizio per creare newsletter in modo
semplice e veloce, senza bisogno di conoscenze di grafica o di
programmazione.
Gratis per 30 giorni!Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7243&d=20071122
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
Yes, there is a different connection for each thread :-(
Luca.
--------- Original Message --------
Da: Martijn van Oosterhout <kleptog@svana.org>
To:
Cc: pgsql-general@postgresql.org,
alessandra.autunno@galileoavionica.it
Oggetto: Re: [GENERAL] BEGIN strange behaviour
Data: 22/11/07 15:25
On Thu, Nov 22, 2007 at 02:10:49PM +0100, luca.ciciriello@email.it wrote:
Hi All.
I've sperimented a strange behaviour using the command BEGIN and COMMIT
in a
multi-threaded Linux environment.
In one of the two thread I use I've got the following message after
PQexec(myconn, "BEGIN;");You do have different database connections for each thread, right?
Otherwise that's why it's not working...Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/Those who make peaceful revolution impossible will make violent
revolution inevitable.
-- John F Kennedy
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
In REGALO 'All the Good Thing' di NELLY FURTADO
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=6616&d=20071122
Import Notes
Resolved by subject fallback