Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 3716 invoked from network); 26 Jun 2002 08:13:35 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by 209.66.108.5 with SMTP; 26 Jun 2002 08:13:35 -0000 Received: (qmail 16260 invoked by uid 97); 26 Jun 2002 08:13:32 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@jakarta.apache.org Received: (qmail 16216 invoked by uid 97); 26 Jun 2002 08:13:31 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 16204 invoked by uid 98); 26 Jun 2002 08:13:31 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_ajp13.c X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 Date: Wed, 26 Jun 2002 10:13:23 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_ajp13.c Thread-Index: AcIcuxwwlGkbhVFPTJqBXC4toO95NwALhrbw From: "GOMEZ Henri" To: "Tomcat Developers List" X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N X-Spam-Rating: 209.66.108.5 1.6.2 0/1000/N This part of code in jk 1.2/2.0 is really a spaghetti :[ I spent many times in it, and I think we should refactor it at least in jk2. Certainly after aplha release. - Henri Gomez ___[_]____ EMAIL : hgomez@slib.fr (. .) =20 PGP KEY : 697ECEDD ...oOOo..(_)..oOOo... PGP Fingerprint : 9DF8 1EA8 ED53 2F39 DC9B 904A 364F 80E6=20 >-----Original Message----- >From: costin@apache.org [mailto:costin@apache.org] >Sent: Wednesday, June 26, 2002 4:42 AM >To: jakarta-tomcat-connectors-cvs@apache.org >Subject: cvs commit: jakarta-tomcat-connectors/jk/native2/common >jk_worker_ajp13.c > > >costin 2002/06/25 19:41:39 > > Modified: jk/native2/common jk_worker_ajp13.c > Log: > Another attempt to fix the 'tomcat restart' problem. > =20 > send ( with either write or send() ) doesn't detect if=20 >tomcat is disconnected - > only the first receive does report the error. > =20 > What we do is use the 'recoverable' field to mark if tomcat=20 >has already > started to process the request ( i.e. we received at least=20 >one packet - > probably the HEAD, in which case the error can't be recovered ). > =20 > If this is just a tomcat restart, we'll save the post body (=20 >initial chunk ), > and resend it. The logic is a bit tricky - but I think I got=20 >it right this > time ( it affected the case that a POST is made just after restart ) > =20 > Revision Changes Path > 1.34 +17 -8 =20 >jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c > =20 > Index: jk_worker_ajp13.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file:=20 >/home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker >_ajp13.c,v > retrieving revision 1.33 > retrieving revision 1.34 > diff -u -r1.33 -r1.34 > --- jk_worker_ajp13.c 20 Jun 2002 18:45:01 -0000 1.33 > +++ jk_worker_ajp13.c 26 Jun 2002 02:41:39 -0000 1.34 > @@ -299,10 +299,12 @@ > { > int err=3DJK_OK; > int attempt; > + int has_post_body=3DJK_FALSE; > + jk_channel_t *channel=3D worker->channel; > =20 > e->recoverable =3D JK_TRUE; > s->is_recoverable_error =3D JK_TRUE; > - =20 > + > /* > * Try to send the request on a valid endpoint. If one endpoint > * fails, close the channel and try again ( maybe=20 >tomcat was restarted ) > @@ -311,7 +313,6 @@ > * a load-balancing configuration=20 > */ > for(attempt =3D 0 ; attempt < JK_RETRIES ;attempt++) { > - jk_channel_t *channel=3D worker->channel; > =20 > if( e->sd =3D=3D -1 ) { > err=3Djk2_worker_ajp13_connect(env, e); > @@ -322,6 +323,9 @@ > e->worker->in_error_state=3DJK_TRUE; > return err; > } > + if( worker->mbean->debug > 0 ) > + env->l->jkLog(env, env->l, JK_LOG_INFO, > + "ajp13.service() connecting=20 >to endpoint \n"); > } > =20 > err=3De->worker->channel->send( env, e->worker->channel, e, > @@ -332,7 +336,6 @@ > =20 > if (err!=3DJK_OK ) { > /* Can't send - bad endpoint, try again */ > - > env->l->jkLog(env, env->l, JK_LOG_ERROR, > "ajp13.service() error sending,=20 >reconnect %s %d %d %s\n", > e->worker->channelName, err,=20 >errno, strerror(errno)); > @@ -346,7 +349,7 @@ > request was sent ( we're receiving data from=20 >client, can be slow, no > need to delay - we can do that in paralel. ( not=20 >very sure this is > very usefull, and it brakes the protocol ) ! */ > - if (s->is_chunked || s->left_bytes_to_send > 0) { > + if (has_post_body || s->is_chunked ||=20 >s->left_bytes_to_send > 0) { > /* We never sent any POST data and we check it=20 >we have to send at > * least of block of data (max 8k). These data=20 >will be kept in reply > * for resend if the remote Tomcat is down, a=20 >fact we will learn only > @@ -354,6 +357,8 @@ > */ > if( attempt=3D=3D0 ) > err=3Djk2_serialize_postHead( env, e->post, s, e ); > + else > + err=3DJK_OK; /* We already have the initial=20 >body chunk */ > =20 > if( e->worker->mbean->debug > 10 ) > e->request->dump( env, e->request, "Post head" ); > @@ -363,17 +368,20 @@ > /* e->recoverable =3D JK_FALSE; */ > s->is_recoverable_error =3D JK_FALSE; > env->l->jkLog(env, env->l, JK_LOG_ERROR, > - "ajp13.service() Error=20 >receiving initial post \n"); > + "ajp13.service() Error=20 >receiving initial post %d %d %d\n", err, errno, attempt); > return JK_ERR; > } > + has_post_body=3DJK_TRUE; > err=3D e->worker->channel->send( env,=20 >e->worker->channel, e, > e->post ); > if( err !=3D JK_OK ) { > /* e->recoverable =3D JK_FALSE; */ > - s->is_recoverable_error =3D JK_FALSE; > + /* s->is_recoverable_error=20 >=3D JK_FALSE; */ > env->l->jkLog(env, env->l, JK_LOG_ERROR, > - "ajp13.service() Error=20 >receiving initial post \n"); > - return JK_ERR; > + "ajp13.service() Error=20 >sending initial post %d %d %d\n", err, errno, attempt); > + jk2_close_endpoint(env, e); > + continue; > + /* return JK_ERR; */ > } > } > =20 > @@ -399,6 +407,7 @@ > err); > jk2_close_endpoint(env, e );=20 > } > + > if( err=3D=3DJK_OK ) > return err; > } > =20 > =20 > =20 > >-- >To unsubscribe, e-mail: =20 For additional commands, e-mail: = -- To unsubscribe, e-mail: For additional commands, e-mail: