Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit032235c

Browse files
committed
Apply ljb's patch to prevent both memory leak and core dump during
connection shutdown. This is a grotty workaround for a Tcl bug, butsaid bug has been there long enough that I'm not holding my breathfor a real fix. Per discussions and testing from ljb and g.hintermayer.
1 parentf51c7ca commit032235c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

‎src/interfaces/libpgtcl/pgtclId.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
1515
* IDENTIFICATION
16-
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.38 2002/12/30 22:10:54 tgl Exp $
16+
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.39 2003/02/01 00:07:03 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -295,17 +295,19 @@ PgDelConnectionId(DRIVER_DEL_PROTO)
295295
* the socket itself!
296296
*
297297
* XXX Unfortunately, while this works fine if we are closing due to
298-
* explicit pg_disconnect, Tcl versions through 8.3.3 dump core if we
299-
* try to do it during interpreter shutdown. Not clear why, or if
300-
* there is a workaround. For now, accept leakage of the (fairly
301-
* small) amount of memory taken for the channel state representation.
302-
* Note we are not leaking a socket, since libpq closed that already.
298+
* explicit pg_disconnect, all Tcl versions through 8.4.1 dump core
299+
* if we try to do it during interpreter shutdown. Not clear why.
300+
* For now, we kill the channel during pg_disconnect, but during interp
301+
* shutdown we just accept leakage of the (fairly small) amount of memory
302+
* taken for the channel state representation.
303+
* (Note we are not leaking a socket, since libpq closed that already.)
304+
* We tell the difference between pg_disconnect and interpreter shutdown
305+
* by testing for interp != NULL, which is an undocumented but apparently
306+
* safe way to tell.
303307
*/
304-
#ifdefNOT_USED
305308
#ifTCL_MAJOR_VERSION >=8
306-
if (connid->notifier_channel!=NULL)
309+
if (connid->notifier_channel!=NULL&&interp!=NULL)
307310
Tcl_UnregisterChannel(NULL,connid->notifier_channel);
308-
#endif
309311
#endif
310312

311313
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp