You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2006/11/10 14:55:48 UTC
svn commit: r473341 - in /tomcat/connectors/trunk/jni/native: include/tcn.h
src/network.c
Author: mturk
Date: Fri Nov 10 05:55:47 2006
New Revision: 473341
URL: http://svn.apache.org/viewvc?view=rev&rev=473341
Log:
Fix coredump when the client socket is inside read/write
operation (not closed), and the Tomcat is shutdown.
The pool was destroyed twice in that case.
Modified:
tomcat/connectors/trunk/jni/native/include/tcn.h
tomcat/connectors/trunk/jni/native/src/network.c
Modified: tomcat/connectors/trunk/jni/native/include/tcn.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/include/tcn.h?view=diff&rev=473341&r1=473340&r2=473341
==============================================================================
--- tomcat/connectors/trunk/jni/native/include/tcn.h (original)
+++ tomcat/connectors/trunk/jni/native/include/tcn.h Fri Nov 10 05:55:47 2006
@@ -145,6 +145,7 @@
typedef struct {
apr_pool_t *pool;
+ apr_pool_t *child;
apr_socket_t *sock;
void *opaque;
char *jsbbuff;
Modified: tomcat/connectors/trunk/jni/native/src/network.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/network.c?view=diff&rev=473341&r1=473340&r2=473341
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/network.c (original)
+++ tomcat/connectors/trunk/jni/native/src/network.c Fri Nov 10 05:55:47 2006
@@ -202,8 +202,11 @@
if (family >= 0)
a->net = &apr_socket_layer;
a->opaque = s;
-cleanup:
+ apr_pool_create(&a->child, a->pool);
+
return P2J(a);
+cleanup:
+ return 0;
}
@@ -213,6 +216,7 @@
UNREFERENCED_STDARGS;
TCN_ASSERT(sock != 0);
+ apr_pool_cleanup_kill(s->pool, s, sp_socket_cleanup);
if (s->net && s->net->cleanup) {
(*s->net->cleanup)(s->opaque);
s->net = NULL;
@@ -278,6 +282,10 @@
UNREFERENCED_STDARGS;
TCN_ASSERT(sock != 0);
+ apr_pool_cleanup_kill(s->pool, s, sp_socket_cleanup);
+ if (s->child) {
+ apr_pool_clear(s->child);
+ }
#ifdef TCN_DO_STATISTICS
apr_atomic_inc32(&sp_closed);
#endif
@@ -373,7 +381,7 @@
a = (tcn_socket_t *)apr_pcalloc(p, sizeof(tcn_socket_t));
TCN_CHECK_ALLOCATED(a);
a->pool = p;
- apr_pool_cleanup_register(p, (const void *)a,
+ apr_pool_cleanup_register(s->child, (const void *)a,
sp_socket_cleanup,
apr_pool_cleanup_null);
@@ -1219,7 +1227,7 @@
void *rv = NULL;
UNREFERENCED(o);
- TCN_ASSERT(sock != 0);
+ TCN_ASSERT(socket != 0);
if (apr_socket_data_get(&rv, J2S(key), s->sock) != APR_SUCCESS) {
rv = NULL;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org