Discussion:
unexpected EOF on client connection
d***@public.gmane.org
2004-11-05 08:51:00 UTC
Permalink
Hi list,

I am using psycopg (1.1.15) with Python 2.3.3 and Postgresql 7.4 in a fairly
big application. In that application I am (also) manipulating the database.
(Alter table etc.) The coding is working properly, but sometimes the
connection to the database breaks and the application hangs. I have
experienced this on several machines. The weird thing is that after a break
in my application pgAdmin3 is hanging also. This would indicate a problem in
Postgresql, but I don't know. When I look in Postgresql.log I get the
following message:

LOG: unexpected EOF on client connection

but it doesn't specify a time and date, so I THINK this indicates my problem,
but I am not sure. (I do not see any other errors in the log)

Does this indicate an error in psycopg? Or is there something else going on?
How can I find out what is happening? (client crash, server problem?)
--
Cheers

Dick Kniep
Lindix BV
Dick Kniep
2004-11-15 13:00:36 UTC
Permalink
Hi List,

Included is some extra logging from postgresql which specifies what kind of
error occurs:

LOCATION: pg_parse_query, postgres.c:464
DEBUG: 00000: forked new backend, pid=24603 socket=8
LOCATION: BackendStartup, postmaster.c:2235
LOG: 00000: connection received: host=192.168.100.10 port=32988
LOCATION: BackendFork, postmaster.c:2395
LOG: 00000: connection authorized: user=postgres database=clienten2
LOCATION: BackendFork, postmaster.c:2457
LOG: 00000: statement: SET DATESTYLE TO 'ISO'
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: INSERT INTO "public"."velden" ("tab_naam",
"tab_naam_kort", "ingangsdatum", "vervaldatum", "mutmed", "mutdat",
"vld_validatie_type", "vld_veldnaam", "vld_type", "vld_len", "vld_dec",
"vld_leegakkoord", "vld_soortinvoer", "default_waarde", "vld_classnaam")
VALUES ('Verwacht plaatsingspercentage', 'Plpct', '2000-01-01
00:00:00', NULL, 1695, '2004-11-15 13:52:49', NULL, 'con_plaatsingspct',
'int2', 0, 0, 'f', 0, '', NULL)
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: SELECT last_value FROM "public"."tabellen_tab_id_seq"
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: INSERT INTO "public"."schermen" ("scr_id", "tab_id",
"scr_order_display", "scr_langkort", "vervaldatum", "mutmed", "mutdat",
"kolom", "rij", "tabelnaam", "scr_verplicht")
VALUES ('contracten', 825, NULL, 't', NULL, 1695, '2004-11-15
13:52:49', NULL, NULL, NULL, 'f')
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: ALTER TABLE contracten ADD COLUMN con_plaatsingspct
int2
LOCATION: pg_parse_query, postgres.c:464
LOG: 08P01: unexpected EOF on client connection
LOCATION: SocketBackend, postgres.c:281
LOG: 08P01: unexpected EOF on client connection
LOCATION: SocketBackend, postgres.c:281
LOG: 08P01: unexpected EOF on client connection
LOCATION: SocketBackend, postgres.c:281
LOG: 08P01: unexpected EOF on client connection
LOCATION: SocketBackend, postgres.c:281
LOG: 08P01: unexpected EOF on client connection
LOCATION: SocketBackend, postgres.c:281

I hope someone can help me in debugging this problem. Because we are supposed
to go live in the coming weeks, so I am getting desperate!

As you can see, the last query it receives is the 'ALTER TABLE' query, after
that, it stops responding.
Post by d***@public.gmane.org
Hi list,
I am using psycopg (1.1.15) with Python 2.3.3 and Postgresql 7.4 in a
fairly big application. In that application I am (also) manipulating the
database. (Alter table etc.) The coding is working properly, but sometimes
the connection to the database breaks and the application hangs. I have
experienced this on several machines. The weird thing is that after a break
in my application pgAdmin3 is hanging also. This would indicate a problem
in Postgresql, but I don't know. When I look in Postgresql.log I get the
LOG: unexpected EOF on client connection
but it doesn't specify a time and date, so I THINK this indicates my
problem, but I am not sure. (I do not see any other errors in the log)
Does this indicate an error in psycopg? Or is there something else going
on? How can I find out what is happening? (client crash, server problem?)
Marco Bizzarri
2004-11-15 13:26:17 UTC
Permalink
Post by Dick Kniep
Hi List,
Included is some extra logging from postgresql which specifies what kind of
LOCATION: pg_parse_query, postgres.c:464
DEBUG: 00000: forked new backend, pid=24603 socket=8
LOCATION: BackendStartup, postmaster.c:2235
LOG: 00000: connection received: host=192.168.100.10 port=32988
LOCATION: BackendFork, postmaster.c:2395
LOG: 00000: connection authorized: user=postgres database=clienten2
LOCATION: BackendFork, postmaster.c:2457
LOG: 00000: statement: SET DATESTYLE TO 'ISO'
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: INSERT INTO "public"."velden" ("tab_naam",
"tab_naam_kort", "ingangsdatum", "vervaldatum", "mutmed", "mutdat",
"vld_validatie_type", "vld_veldnaam", "vld_type", "vld_len", "vld_dec",
"vld_leegakkoord", "vld_soortinvoer", "default_waarde", "vld_classnaam")
VALUES ('Verwacht plaatsingspercentage', 'Plpct', '2000-01-01
00:00:00', NULL, 1695, '2004-11-15 13:52:49', NULL, 'con_plaatsingspct',
'int2', 0, 0, 'f', 0, '', NULL)
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: SELECT last_value FROM "public"."tabellen_tab_id_seq"
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: INSERT INTO "public"."schermen" ("scr_id", "tab_id",
"scr_order_display", "scr_langkort", "vervaldatum", "mutmed", "mutdat",
"kolom", "rij", "tabelnaam", "scr_verplicht")
VALUES ('contracten', 825, NULL, 't', NULL, 1695, '2004-11-15
13:52:49', NULL, NULL, NULL, 'f')
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
LOCATION: pg_parse_query, postgres.c:464
LOG: 00000: statement: ALTER TABLE contracten ADD COLUMN con_plaatsingspct
int2
I think this is the cause of the hanging of other applications: you've a
transaction started, which is altering the db. This causes a lock on the
db, since you're altering the schema. Probably the client then time-out
and closes its side of the connection, but, for some reason, it does not
closes.

I suspect you should be able to see the transaction still open:

ps axf | grep transaction

should provide something like

'....: idle in transaction'.

The reasons of this are a complete different matter...

Just a question (please forgive me... I'm not that much expert of
psycopg)... it looks like the first statement of your postgres are
'outside' any transaction, i.e. they are all auto-committed... can this
be the problem?

Regards
Marco
Marco Bizzarri
2004-11-15 13:38:40 UTC
Permalink
I failed to mention that I've seen something like this in the past, when
we tried psycopg 1.1.15 with Zope 2.7.x... The problem occurred just
with ALTER TABLE (we had a script which reset the DB, and, sometimes, it
hunged inside some ALTER TABLE).

Regards
Marco
Marco Bizzarri
2004-11-15 13:52:18 UTC
Permalink
Last post on this: I can see you are using python 2.3.3... since there
are some known bugs (see http://www.python.org/2.3.4/NEWS.html), you
could try to update... I'm not sure the bugs will affect you.

Regards
Marco
d***@public.gmane.org
2004-11-15 19:28:08 UTC
Permalink
Hi Marco,
Post by Marco Bizzarri
Last post on this: I can see you are using python 2.3.3... since there
are some known bugs (see http://www.python.org/2.3.4/NEWS.html), you
could try to update... I'm not sure the bugs will affect you.
Thanks for the feedback. I will take a look, and hope to get a fix. I don't
think it has something to do with the version of Python.

Cheers,
Dick

Loading...