simpleweb-support Mailing List for Simple (Page 10)
Brought to you by:
niallg
You can subscribe to this list here.
2004 |
Jan
(1) |
Feb
(4) |
Mar
(2) |
Apr
(14) |
May
(22) |
Jun
(15) |
Jul
(9) |
Aug
(2) |
Sep
(7) |
Oct
(4) |
Nov
(2) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(7) |
Feb
(16) |
Mar
(17) |
Apr
|
May
(12) |
Jun
(4) |
Jul
(22) |
Aug
(50) |
Sep
(8) |
Oct
(23) |
Nov
(9) |
Dec
(50) |
2006 |
Jan
(6) |
Feb
(7) |
Mar
(8) |
Apr
(3) |
May
(13) |
Jun
(4) |
Jul
(2) |
Aug
|
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(7) |
2007 |
Jan
(11) |
Feb
(3) |
Mar
(17) |
Apr
(21) |
May
(9) |
Jun
(4) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(14) |
Dec
(3) |
2008 |
Jan
(3) |
Feb
|
Mar
|
Apr
(5) |
May
|
Jun
|
Jul
(4) |
Aug
(4) |
Sep
(15) |
Oct
(9) |
Nov
(6) |
Dec
(2) |
2009 |
Jan
(29) |
Feb
(2) |
Mar
(8) |
Apr
(14) |
May
(4) |
Jun
(13) |
Jul
(5) |
Aug
|
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(7) |
2010 |
Jan
|
Feb
(2) |
Mar
(61) |
Apr
(9) |
May
(10) |
Jun
(9) |
Jul
(10) |
Aug
(7) |
Sep
(15) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(11) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
(4) |
Oct
|
Nov
(6) |
Dec
(9) |
2012 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
(3) |
May
(2) |
Jun
|
Jul
(17) |
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
(5) |
2013 |
Jan
(2) |
Feb
(4) |
Mar
|
Apr
(12) |
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(1) |
2014 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
|
May
|
Jun
(20) |
Jul
(12) |
Aug
(4) |
Sep
(3) |
Oct
(5) |
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Niall G. <gal...@ya...> - 2010-04-05 19:45:22
|
Hi, There is no reason why you could not use something like filters. However, you would have to write it your self. Currently there is no implementation packaged with Simple. Niall --- On Mon, 4/5/10, Björn Raupach <bj...@ra...> wrote: > From: Björn Raupach <bj...@ra...> > Subject: [Simpleweb-Support] Are filters supported? > To: sim...@li... > Date: Monday, April 5, 2010, 11:49 AM > Hi, > > does simple support containers that act like filters in the > Java Servlet specification? > > I implemented parts of digest access authentication and > webDAV. However it all ended up in one big container. It > works, but it looks rather chunky. I would like to > modularize the code, e.g. digest access authentication is > probably nice in some other projects. Any ideas? > > with kind regards, > Björn > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, > find bugs > proactively, and fine-tune applications for parallel > performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > |
From: Björn R. <bj...@ra...> - 2010-04-05 19:18:09
|
Hi, does simple support containers that act like filters in the Java Servlet specification? I implemented parts of digest access authentication and webDAV. However it all ended up in one big container. It works, but it looks rather chunky. I would like to modularize the code, e.g. digest access authentication is probably nice in some other projects. Any ideas? with kind regards, Björn |
From: <nia...@rb...> - 2010-03-30 16:37:17
|
Well size can be negative and 0 - (-1) is 1 and so count keeps increasing. Niall Gallagher RBS Global Banking & Markets Office: +44 2070851454 -----Original Message----- From: car...@gm... [mailto:car...@gm...] On Behalf Of Carfield Yim Sent: 30 March 2010 17:32 To: GALLAGHER, Niall, GBM Cc: Simple support and user issues Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Deployed few day, haven't yet encounter the problem again, look like it solved, thanks Have take a look of the change, so the problem is for somehow "size" can be positive forever? On Fri, Mar 26, 2010 at 1:38 AM, <nia...@rb...> wrote: > It should be downloadable and available on Maven by the weekend as 4.1.20. > > Regards, > Niall > > > -----Original Message----- > From: car...@gm... [mailto:car...@gm...] On Behalf Of > Carfield Yim > Sent: 25 March 2010 17:37 > To: Simple support and user issues > Cc: GALLAGHER, Niall, GBM > Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > Thanks a lot, actually I don't have chance to check out the code and > apply the patch and build > > On Fri, Mar 26, 2010 at 1:34 AM, <nia...@rb...> wrote: >> Hi, >> >> I have noticed a slight issue in the SocketWriter, and although I have never experienced this problem myself it is still possible to cause the loop you mention. Here are the return codes for the FileChannelImpl. >> >> 35 static final int EOF = -1; // End of file >> 36 static final int UNAVAILABLE = -2; // Nothing >> available (non-blocking) >> 37 static final int INTERRUPTED = -3; // System call >> interrupted >> 38 static final int UNSUPPORTED = -4; // Operation not >> supported >> 39 static final int THROWN = -5; // Exception >> thrown in JNI code >> 40 static final int UNSUPPORTED_CASE = -6; // This case not >> supported >> >> So here I say >> >> if(size == 0) { >> break; >> } >> >> Then add to count, and check if count > 0. However as you can see if -1 to -6 is returned a loop will occur. I have attached the SocketWriter that will fix this. I will release a new version with this fix shortly. >> >> Thanks, >> Niall >> >> -----Original Message----- >> From: GALLAGHER, Niall, GBM >> Sent: 24 March 2010 18:55 >> To: 'Simple support and user issues' >> Subject: RE: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? >> >> Ok, thanks, I will investigate this further. Looks like the bug could be in the SegmentBuilder. >> >> Thanks, >> Niall >> >> >> Niall Gallagher >> RBS Global Banking & Markets >> Office: +44 2070851454 >> >> -----Original Message----- >> From: Christophe Roudet [mailto:cr...@ac...] >> Sent: 24 March 2010 18:20 >> To: sim...@li... >> Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? >> >> I had the same problem happening sometimes to times, stuck in >> SocketWriter.flush() where segment was null. >> >> Christophe >> >> --------------------------------------------------------------------- >> - >> -------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> ********************************************************************* >> * >> ************* The Royal Bank of Scotland plc. Registered in Scotland >> No 90312. >> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> Authorised and regulated by the Financial Services Authority. The >> Royal Bank of Scotland N.V. is authorised and regulated by the De >> Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, >> and is registered in the Commercial Register under number 33002587. >> Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. >> The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc >> are authorised to act as agent for each other in certain jurisdictions. >> >> This e-mail message is confidential and for use by the addressee only. >> If the message is received by anyone other than the addressee, please >> return the message to the sender by replying to it and then delete >> the message from your computer. Internet e-mails are not necessarily >> secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland >> N.V. including its affiliates ("RBS group") does not accept >> responsibility for changes made to this message after it was sent. >> >> Whilst all reasonable care has been taken to avoid the transmission >> of viruses, it is the responsibility of the recipient to ensure that >> the onward transmission, opening or use of this message and any >> attachments will not adversely affect its systems or data. No >> responsibility is accepted by the RBS group in this regard and the >> recipient should carry out such virus and other checks as it considers appropriate. >> >> Visit our website at www.rbs.com >> >> ********************************************************************* >> * >> ************* >> >> --------------------------------------------------------------------- >> - >> -------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> > |
From: Carfield Y. <car...@ca...> - 2010-03-30 16:32:10
|
Deployed few day, haven't yet encounter the problem again, look like it solved, thanks Have take a look of the change, so the problem is for somehow "size" can be positive forever? On Fri, Mar 26, 2010 at 1:38 AM, <nia...@rb...> wrote: > It should be downloadable and available on Maven by the weekend as 4.1.20. > > Regards, > Niall > > > -----Original Message----- > From: car...@gm... [mailto:car...@gm...] On Behalf Of Carfield Yim > Sent: 25 March 2010 17:37 > To: Simple support and user issues > Cc: GALLAGHER, Niall, GBM > Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > Thanks a lot, actually I don't have chance to check out the code and apply the patch and build > > On Fri, Mar 26, 2010 at 1:34 AM, <nia...@rb...> wrote: >> Hi, >> >> I have noticed a slight issue in the SocketWriter, and although I have never experienced this problem myself it is still possible to cause the loop you mention. Here are the return codes for the FileChannelImpl. >> >> 35 static final int EOF = -1; // End of file >> 36 static final int UNAVAILABLE = -2; // Nothing >> available (non-blocking) >> 37 static final int INTERRUPTED = -3; // System call >> interrupted >> 38 static final int UNSUPPORTED = -4; // Operation not >> supported >> 39 static final int THROWN = -5; // Exception thrown >> in JNI code >> 40 static final int UNSUPPORTED_CASE = -6; // This case not >> supported >> >> So here I say >> >> if(size == 0) { >> break; >> } >> >> Then add to count, and check if count > 0. However as you can see if -1 to -6 is returned a loop will occur. I have attached the SocketWriter that will fix this. I will release a new version with this fix shortly. >> >> Thanks, >> Niall >> >> -----Original Message----- >> From: GALLAGHER, Niall, GBM >> Sent: 24 March 2010 18:55 >> To: 'Simple support and user issues' >> Subject: RE: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? >> >> Ok, thanks, I will investigate this further. Looks like the bug could be in the SegmentBuilder. >> >> Thanks, >> Niall >> >> >> Niall Gallagher >> RBS Global Banking & Markets >> Office: +44 2070851454 >> >> -----Original Message----- >> From: Christophe Roudet [mailto:cr...@ac...] >> Sent: 24 March 2010 18:20 >> To: sim...@li... >> Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? >> >> I had the same problem happening sometimes to times, stuck in >> SocketWriter.flush() where segment was null. >> >> Christophe >> >> ---------------------------------------------------------------------- >> -------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> ********************************************************************** >> ************* The Royal Bank of Scotland plc. Registered in Scotland >> No 90312. >> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> Authorised and regulated by the Financial Services Authority. The >> Royal Bank of Scotland N.V. is authorised and regulated by the De >> Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and >> is registered in the Commercial Register under number 33002587. >> Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. >> The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are >> authorised to act as agent for each other in certain jurisdictions. >> >> This e-mail message is confidential and for use by the addressee only. >> If the message is received by anyone other than the addressee, please >> return the message to the sender by replying to it and then delete the >> message from your computer. Internet e-mails are not necessarily >> secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland >> N.V. including its affiliates ("RBS group") does not accept >> responsibility for changes made to this message after it was sent. >> >> Whilst all reasonable care has been taken to avoid the transmission of >> viruses, it is the responsibility of the recipient to ensure that the >> onward transmission, opening or use of this message and any >> attachments will not adversely affect its systems or data. No >> responsibility is accepted by the RBS group in this regard and the >> recipient should carry out such virus and other checks as it considers appropriate. >> >> Visit our website at www.rbs.com >> >> ********************************************************************** >> ************* >> >> ---------------------------------------------------------------------- >> -------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> > |
From: Niall G. <gal...@ya...> - 2010-03-27 17:27:26
|
Hi, I have released 4.1.20 for download, it fixes the SSL handshake issue and also changes the socket writer to be more robust in the event of a negative return from the SocketChannel. It should be available on Maven shortly. Thanks for everyones feedback on these issues. Niall |
From: Niall G. <gal...@ya...> - 2010-03-27 17:25:45
|
Hi, The SSLEngine is available from the connected org.simpleframework.transport.Socket object. You could set it there. Although, the handshake is likely to change the settings. So, yes, I think an enum here could be useful. I may add some configuration settings to the Socket object to allow the user to configure the connection. Thanks again, Niall --- On Fri, 3/26/10, Bruno Harbulot <Bru...@ma...> wrote: > From: Bruno Harbulot <Bru...@ma...> > Subject: Re: [Simpleweb-Support] SSL handshake issue > To: nia...@rb... > Cc: sim...@li... > Date: Friday, March 26, 2010, 10:13 AM > Happy to help. Thanks for integrating > the fix. > > On a similar topic, have you considered adding something to > the API to > be able to configure the client authentication, something > like "none", > "want", "need" (or an enum.) that would configure > setWantClientAuthentication and setNeedClientAuthentication > accordingly? > > (I tend to use setWantClientAuthentication anyway, so it's > not really a > problem for my use cases at the moment.) > > > Best wishes, > > Bruno. > > On 26/03/2010 14:49, nia...@rb... > wrote: > > Thanks, really appreciate the feedback, especially > considering you went to the trouble of finding a solution. > Ill ensure to add this to the next release (4.1.20) also. > > > > Cheers, > > Niall > > > > -----Original Message----- > > From: Bruno Harbulot [mailto:Bru...@ma...] > > Sent: 26 March 2010 14:40 > > To: Simple support and user issues > > Cc: GALLAGHER, Niall, GBM > > Subject: Re: [Simpleweb-Support] SSL handshake issue > > > > Hi, > > > > Changing the write method is sufficient. > > > > Best wishes, > > > > Bruno. > > > > > > On 26/03/2010 14:33, nia...@rb... > wrote: > >> Hi, > >> > >> So does the change to the write method alone solve > the problem (where you add a count). Or did you have to > increase the output buffer as well as change the write > method? > >> > >> Thanks, > >> Niall > >> > >> -----Original Message----- > >> From: Bruno Harbulot [mailto:Bru...@ma...] > >> Sent: 26 March 2010 14:09 > >> To: sim...@li... > >> Subject: [Simpleweb-Support] SSL handshake issue > >> > >> Hello, > >> > >> I've been debugging an issue we've just had in > Restlet with the Simple connector, following the change of > configuration of SSL, and tracked it down to the Simple > library (this doesn't happen with the Grizzly or Jetty > connectors, even in NIO mode). > >> > >> I've been able to reproduce this problem with > SimpleWeb directly (without Restlet). I'm pasting the test > application (taken from the Simple tutorial and adapted to > have an SSLContext) at the end. > >> > >> The problem is that the TrustManagerFactory needs > to be initialised with a store that trusts the certificate > of the server itself. This is normally not required: the > trust manager is for checking remote certificates, not local > ones. > >> > >> What happens is that the connection hangs and the > server's CPU usage increases. This is reproducible on OSX > 10.6 (and I think the other user who's experiencing the > problem is under Linux). > >> > >> > >> If I turn on SSL debugging with > -Djavax.net.debug=ssl,handshake, I can see this message: > >> *** ServerHelloDone > >> However, when analysing the packets with > Wireshark, the handshake > >> stops right after ClientHello (no ServerHello, no > Certificate, no > >> ServerHelloDone) are visible. > >> > >> > >> I haven't looked in details into the SimpleWeb > code, but if I comment this out in > org.simpleframework.transport.Handshake, it works: > >> > // engine.setWantClientAuth(true); > >> > >> > >> By debugging it a bit more closely, it seems to be > stuck calling > >> Handshake.execute() (not stuck in the loop within > this, buy within the > >> loop within write(), reiterating with status > NEED_WRAP). > >> > >> > >> If I change this in the constructor (double the > size of the output > >> buffer), it also fixes the problem: > >> public Handshake(Transport transport, Negotiator > negotiator, int size) { > >> this.output = > ByteBuffer.allocate(size*2); > >> this.input = > ByteBuffer.allocate(size); > >> > >> > >> Considering that: > >> - doubling the output buffer size makes it work, > >> - disabling client auth send the > CertificateRequest message to the > >> client, which would include a list of accepted > CAs, > >> > >> my guess is that this has > nothing to do with the trust store. > >> Rather, it has to do with the output buffer being > too short. What > >> happens with the default trust store would just be > a side-effect of > >> the CertificateRequest message being longer (since > the default trust > >> store comes with a number of CAs to put in the DN > list). > >> > >> > >> > >> Unlike read(), write() doesn't seem to have a > "count" to write more. > >> The following change seems to solve the problem: > >> > >> private Status write() throws > IOException { > >> return > write(5); > >> } > >> > >> private Status write(int count) > throws IOException { > >> while > (count> 0) { > >> > SSLEngineResult result = > engine.wrap(empty, output); > >> > HandshakeStatus status = > result.getHandshakeStatus(); > >> > >> > switch (status) { > >> > case NOT_HANDSHAKING: > >> > case FINISHED: > >> > case NEED_UNWRAP: > >> > return SERVER; > >> > case NEED_WRAP: > >> > return write(count - > 1); > >> > case NEED_TASK: > >> > execute(); > >> > } > >> } > >> return > SERVER; > >> } > >> > >> > >> > >> > >> Best wishes, > >> > >> Bruno. > >> > >> > >> > >> > >> > >> import org.simpleframework.http.core.Container; > >> import > org.simpleframework.transport.connect.Connection; > >> import > org.simpleframework.transport.connect.SocketConnection; > >> import org.simpleframework.http.Response; > >> import org.simpleframework.http.Request; import > >> java.net.InetSocketAddress; import > java.net.SocketAddress; import > >> java.security.KeyStore; import > java.io.FileInputStream; import > >> java.io.IOException; import java.io.PrintStream; > >> > >> import javax.net.ssl.KeyManagerFactory; import > >> javax.net.ssl.SSLContext; import > javax.net.ssl.TrustManagerFactory; > >> > >> public class HelloWorld implements Container { > >> public void > handle(Request request, Response response) { > >> try { > >> > PrintStream body = response.getPrintStream(); > >> > long time = System.currentTimeMillis(); > >> > >> > response.set("Content-Type", "text/plain"); > >> > response.set("Server", "HelloWorld/1.0 (Simple > 4.0)"); > >> > response.setDate("Date", time); > >> > response.setDate("Last-Modified", time); > >> > >> > body.println("Hello World"); > >> > body.close(); > >> } catch > (IOException e) { > >> > // TODO Auto-generated catch block > >> > e.printStackTrace(); > >> } > >> } > >> > >> public static void > main(String[] list) throws Exception { > >> Container > container = new HelloWorld(); > >> > Connection connection = new SocketConnection(container); > >> > SocketAddress address = new InetSocketAddress(8443); > >> > >> > KeyManagerFactory kmf = null; > >> KeyStore > keyStore = KeyStore.getInstance("PKCS12"); > >> > FileInputStream keyStoreInputStream = null; > >> try { > >> > keyStoreInputStream = new FileInputStream( > >> > > "/.../path/to/localhost.p12"); > >> > keyStore.load(keyStoreInputStream, > "testtest".toCharArray()); > >> } finally > { > >> > if (keyStoreInputStream != null) { > >> > keyStoreInputStream.close(); > >> > } > >> } > >> > >> kmf = > KeyManagerFactory.getInstance("SunX509"); > >> > kmf.init(keyStore, "testtest".toCharArray()); > >> > >> > TrustManagerFactory tmf = null; > >> // > Uncommenting this makes it work, but it shouldn't be > needed. > >> // tmf = > TrustManagerFactory.getInstance("PKIX"); > >> // > tmf.init(keyStore); > >> > >> > SSLContext sslContext = SSLContext.getInstance("TLS"); > >> > sslContext.init(kmf != null ? kmf.getKeyManagers() : null, > >> > tmf != null ? tmf.getTrustManagers() : > null, null); > >> > >> > connection.connect(address, sslContext); > >> } > >> } > >> > >> > ---------------------------------------------------------------------- > >> -------- Download Intel® Parallel Studio Eval > Try the new > >> software tools for yourself. Speed compiling, find > bugs proactively, > >> and fine-tune applications for parallel > performance. > >> See why Intel Parallel Studio got high marks > during beta. > >> http://p.sf.net/sfu/intel-sw-dev > >> _______________________________________________ > >> Simpleweb-Support mailing list > >> Sim...@li... > >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support > >> > >> > ********************************************************************** > >> ************* The Royal Bank of Scotland plc. > Registered in Scotland > >> No 90312. > >> Registered Office: 36 St Andrew Square, Edinburgh > EH2 2YB. > >> Authorised and regulated by the Financial Services > Authority. The > >> Royal Bank of Scotland N.V. is authorised and > regulated by the De > >> Nederlandsche Bank and has its seat at Amsterdam, > the Netherlands, and > >> is registered in the Commercial Register under > number 33002587. > >> Registered Office: Gustav Mahlerlaan 10, > Amsterdam, The Netherlands. > >> The Royal Bank of Scotland N.V. and The Royal Bank > of Scotland plc are > >> authorised to act as agent for each other in > certain jurisdictions. > >> > >> This e-mail message is confidential and for use by > the addressee only. > >> If the message is received by anyone other than > the addressee, please > >> return the message to the sender by replying to it > and then delete the > >> message from your computer. Internet e-mails are > not necessarily > >> secure. The Royal Bank of Scotland plc and The > Royal Bank of Scotland > >> N.V. including its affiliates ("RBS group") does > not accept > >> responsibility for changes made to this message > after it was sent. > >> > >> Whilst all reasonable care has been taken to avoid > the transmission of > >> viruses, it is the responsibility of the recipient > to ensure that the > >> onward transmission, opening or use of this > message and any > >> attachments will not adversely affect its systems > or data. No > >> responsibility is accepted by the RBS group in > this regard and the > >> recipient should carry out such virus and other > checks as it considers appropriate. > >> > >> Visit our website at www.rbs.com > >> > >> > ********************************************************************** > >> ************* > >> > >> > >> > ---------------------------------------------------------------------- > >> -------- Download Intel® Parallel Studio Eval > Try the new > >> software tools for yourself. Speed compiling, find > bugs proactively, > >> and fine-tune applications for parallel > performance. > >> See why Intel Parallel Studio got high marks > during beta. > >> http://p.sf.net/sfu/intel-sw-dev > >> _______________________________________________ > >> Simpleweb-Support mailing list > >> Sim...@li... > >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, > find bugs > proactively, and fine-tune applications for parallel > performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > |
From: Bruno H. <Bru...@ma...> - 2010-03-26 17:13:28
|
Happy to help. Thanks for integrating the fix. On a similar topic, have you considered adding something to the API to be able to configure the client authentication, something like "none", "want", "need" (or an enum.) that would configure setWantClientAuthentication and setNeedClientAuthentication accordingly? (I tend to use setWantClientAuthentication anyway, so it's not really a problem for my use cases at the moment.) Best wishes, Bruno. On 26/03/2010 14:49, nia...@rb... wrote: > Thanks, really appreciate the feedback, especially considering you went to the trouble of finding a solution. Ill ensure to add this to the next release (4.1.20) also. > > Cheers, > Niall > > -----Original Message----- > From: Bruno Harbulot [mailto:Bru...@ma...] > Sent: 26 March 2010 14:40 > To: Simple support and user issues > Cc: GALLAGHER, Niall, GBM > Subject: Re: [Simpleweb-Support] SSL handshake issue > > Hi, > > Changing the write method is sufficient. > > Best wishes, > > Bruno. > > > On 26/03/2010 14:33, nia...@rb... wrote: >> Hi, >> >> So does the change to the write method alone solve the problem (where you add a count). Or did you have to increase the output buffer as well as change the write method? >> >> Thanks, >> Niall >> >> -----Original Message----- >> From: Bruno Harbulot [mailto:Bru...@ma...] >> Sent: 26 March 2010 14:09 >> To: sim...@li... >> Subject: [Simpleweb-Support] SSL handshake issue >> >> Hello, >> >> I've been debugging an issue we've just had in Restlet with the Simple connector, following the change of configuration of SSL, and tracked it down to the Simple library (this doesn't happen with the Grizzly or Jetty connectors, even in NIO mode). >> >> I've been able to reproduce this problem with SimpleWeb directly (without Restlet). I'm pasting the test application (taken from the Simple tutorial and adapted to have an SSLContext) at the end. >> >> The problem is that the TrustManagerFactory needs to be initialised with a store that trusts the certificate of the server itself. This is normally not required: the trust manager is for checking remote certificates, not local ones. >> >> What happens is that the connection hangs and the server's CPU usage increases. This is reproducible on OSX 10.6 (and I think the other user who's experiencing the problem is under Linux). >> >> >> If I turn on SSL debugging with -Djavax.net.debug=ssl,handshake, I can see this message: >> *** ServerHelloDone >> However, when analysing the packets with Wireshark, the handshake >> stops right after ClientHello (no ServerHello, no Certificate, no >> ServerHelloDone) are visible. >> >> >> I haven't looked in details into the SimpleWeb code, but if I comment this out in org.simpleframework.transport.Handshake, it works: >> // engine.setWantClientAuth(true); >> >> >> By debugging it a bit more closely, it seems to be stuck calling >> Handshake.execute() (not stuck in the loop within this, buy within the >> loop within write(), reiterating with status NEED_WRAP). >> >> >> If I change this in the constructor (double the size of the output >> buffer), it also fixes the problem: >> public Handshake(Transport transport, Negotiator negotiator, int size) { >> this.output = ByteBuffer.allocate(size*2); >> this.input = ByteBuffer.allocate(size); >> >> >> Considering that: >> - doubling the output buffer size makes it work, >> - disabling client auth send the CertificateRequest message to the >> client, which would include a list of accepted CAs, >> >> my guess is that this has nothing to do with the trust store. >> Rather, it has to do with the output buffer being too short. What >> happens with the default trust store would just be a side-effect of >> the CertificateRequest message being longer (since the default trust >> store comes with a number of CAs to put in the DN list). >> >> >> >> Unlike read(), write() doesn't seem to have a "count" to write more. >> The following change seems to solve the problem: >> >> private Status write() throws IOException { >> return write(5); >> } >> >> private Status write(int count) throws IOException { >> while (count> 0) { >> SSLEngineResult result = engine.wrap(empty, output); >> HandshakeStatus status = result.getHandshakeStatus(); >> >> switch (status) { >> case NOT_HANDSHAKING: >> case FINISHED: >> case NEED_UNWRAP: >> return SERVER; >> case NEED_WRAP: >> return write(count - 1); >> case NEED_TASK: >> execute(); >> } >> } >> return SERVER; >> } >> >> >> >> >> Best wishes, >> >> Bruno. >> >> >> >> >> >> import org.simpleframework.http.core.Container; >> import org.simpleframework.transport.connect.Connection; >> import org.simpleframework.transport.connect.SocketConnection; >> import org.simpleframework.http.Response; >> import org.simpleframework.http.Request; import >> java.net.InetSocketAddress; import java.net.SocketAddress; import >> java.security.KeyStore; import java.io.FileInputStream; import >> java.io.IOException; import java.io.PrintStream; >> >> import javax.net.ssl.KeyManagerFactory; import >> javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; >> >> public class HelloWorld implements Container { >> public void handle(Request request, Response response) { >> try { >> PrintStream body = response.getPrintStream(); >> long time = System.currentTimeMillis(); >> >> response.set("Content-Type", "text/plain"); >> response.set("Server", "HelloWorld/1.0 (Simple 4.0)"); >> response.setDate("Date", time); >> response.setDate("Last-Modified", time); >> >> body.println("Hello World"); >> body.close(); >> } catch (IOException e) { >> // TODO Auto-generated catch block >> e.printStackTrace(); >> } >> } >> >> public static void main(String[] list) throws Exception { >> Container container = new HelloWorld(); >> Connection connection = new SocketConnection(container); >> SocketAddress address = new InetSocketAddress(8443); >> >> KeyManagerFactory kmf = null; >> KeyStore keyStore = KeyStore.getInstance("PKCS12"); >> FileInputStream keyStoreInputStream = null; >> try { >> keyStoreInputStream = new FileInputStream( >> "/.../path/to/localhost.p12"); >> keyStore.load(keyStoreInputStream, "testtest".toCharArray()); >> } finally { >> if (keyStoreInputStream != null) { >> keyStoreInputStream.close(); >> } >> } >> >> kmf = KeyManagerFactory.getInstance("SunX509"); >> kmf.init(keyStore, "testtest".toCharArray()); >> >> TrustManagerFactory tmf = null; >> // Uncommenting this makes it work, but it shouldn't be needed. >> // tmf = TrustManagerFactory.getInstance("PKIX"); >> // tmf.init(keyStore); >> >> SSLContext sslContext = SSLContext.getInstance("TLS"); >> sslContext.init(kmf != null ? kmf.getKeyManagers() : null, >> tmf != null ? tmf.getTrustManagers() : null, null); >> >> connection.connect(address, sslContext); >> } >> } >> >> ---------------------------------------------------------------------- >> -------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> ********************************************************************** >> ************* The Royal Bank of Scotland plc. Registered in Scotland >> No 90312. >> Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> Authorised and regulated by the Financial Services Authority. The >> Royal Bank of Scotland N.V. is authorised and regulated by the De >> Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and >> is registered in the Commercial Register under number 33002587. >> Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. >> The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are >> authorised to act as agent for each other in certain jurisdictions. >> >> This e-mail message is confidential and for use by the addressee only. >> If the message is received by anyone other than the addressee, please >> return the message to the sender by replying to it and then delete the >> message from your computer. Internet e-mails are not necessarily >> secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland >> N.V. including its affiliates ("RBS group") does not accept >> responsibility for changes made to this message after it was sent. >> >> Whilst all reasonable care has been taken to avoid the transmission of >> viruses, it is the responsibility of the recipient to ensure that the >> onward transmission, opening or use of this message and any >> attachments will not adversely affect its systems or data. No >> responsibility is accepted by the RBS group in this regard and the >> recipient should carry out such virus and other checks as it considers appropriate. >> >> Visit our website at www.rbs.com >> >> ********************************************************************** >> ************* >> >> >> ---------------------------------------------------------------------- >> -------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support |
From: <nia...@rb...> - 2010-03-26 14:49:25
|
Thanks, really appreciate the feedback, especially considering you went to the trouble of finding a solution. Ill ensure to add this to the next release (4.1.20) also. Cheers, Niall -----Original Message----- From: Bruno Harbulot [mailto:Bru...@ma...] Sent: 26 March 2010 14:40 To: Simple support and user issues Cc: GALLAGHER, Niall, GBM Subject: Re: [Simpleweb-Support] SSL handshake issue Hi, Changing the write method is sufficient. Best wishes, Bruno. On 26/03/2010 14:33, nia...@rb... wrote: > Hi, > > So does the change to the write method alone solve the problem (where you add a count). Or did you have to increase the output buffer as well as change the write method? > > Thanks, > Niall > > -----Original Message----- > From: Bruno Harbulot [mailto:Bru...@ma...] > Sent: 26 March 2010 14:09 > To: sim...@li... > Subject: [Simpleweb-Support] SSL handshake issue > > Hello, > > I've been debugging an issue we've just had in Restlet with the Simple connector, following the change of configuration of SSL, and tracked it down to the Simple library (this doesn't happen with the Grizzly or Jetty connectors, even in NIO mode). > > I've been able to reproduce this problem with SimpleWeb directly (without Restlet). I'm pasting the test application (taken from the Simple tutorial and adapted to have an SSLContext) at the end. > > The problem is that the TrustManagerFactory needs to be initialised with a store that trusts the certificate of the server itself. This is normally not required: the trust manager is for checking remote certificates, not local ones. > > What happens is that the connection hangs and the server's CPU usage increases. This is reproducible on OSX 10.6 (and I think the other user who's experiencing the problem is under Linux). > > > If I turn on SSL debugging with -Djavax.net.debug=ssl,handshake, I can see this message: > *** ServerHelloDone > However, when analysing the packets with Wireshark, the handshake > stops right after ClientHello (no ServerHello, no Certificate, no > ServerHelloDone) are visible. > > > I haven't looked in details into the SimpleWeb code, but if I comment this out in org.simpleframework.transport.Handshake, it works: > // engine.setWantClientAuth(true); > > > By debugging it a bit more closely, it seems to be stuck calling > Handshake.execute() (not stuck in the loop within this, buy within the > loop within write(), reiterating with status NEED_WRAP). > > > If I change this in the constructor (double the size of the output > buffer), it also fixes the problem: > public Handshake(Transport transport, Negotiator negotiator, int size) { > this.output = ByteBuffer.allocate(size*2); > this.input = ByteBuffer.allocate(size); > > > Considering that: > - doubling the output buffer size makes it work, > - disabling client auth send the CertificateRequest message to the > client, which would include a list of accepted CAs, > > my guess is that this has nothing to do with the trust store. > Rather, it has to do with the output buffer being too short. What > happens with the default trust store would just be a side-effect of > the CertificateRequest message being longer (since the default trust > store comes with a number of CAs to put in the DN list). > > > > Unlike read(), write() doesn't seem to have a "count" to write more. > The following change seems to solve the problem: > > private Status write() throws IOException { > return write(5); > } > > private Status write(int count) throws IOException { > while (count> 0) { > SSLEngineResult result = engine.wrap(empty, output); > HandshakeStatus status = result.getHandshakeStatus(); > > switch (status) { > case NOT_HANDSHAKING: > case FINISHED: > case NEED_UNWRAP: > return SERVER; > case NEED_WRAP: > return write(count - 1); > case NEED_TASK: > execute(); > } > } > return SERVER; > } > > > > > Best wishes, > > Bruno. > > > > > > import org.simpleframework.http.core.Container; > import org.simpleframework.transport.connect.Connection; > import org.simpleframework.transport.connect.SocketConnection; > import org.simpleframework.http.Response; > import org.simpleframework.http.Request; import > java.net.InetSocketAddress; import java.net.SocketAddress; import > java.security.KeyStore; import java.io.FileInputStream; import > java.io.IOException; import java.io.PrintStream; > > import javax.net.ssl.KeyManagerFactory; import > javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; > > public class HelloWorld implements Container { > public void handle(Request request, Response response) { > try { > PrintStream body = response.getPrintStream(); > long time = System.currentTimeMillis(); > > response.set("Content-Type", "text/plain"); > response.set("Server", "HelloWorld/1.0 (Simple 4.0)"); > response.setDate("Date", time); > response.setDate("Last-Modified", time); > > body.println("Hello World"); > body.close(); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > public static void main(String[] list) throws Exception { > Container container = new HelloWorld(); > Connection connection = new SocketConnection(container); > SocketAddress address = new InetSocketAddress(8443); > > KeyManagerFactory kmf = null; > KeyStore keyStore = KeyStore.getInstance("PKCS12"); > FileInputStream keyStoreInputStream = null; > try { > keyStoreInputStream = new FileInputStream( > "/.../path/to/localhost.p12"); > keyStore.load(keyStoreInputStream, "testtest".toCharArray()); > } finally { > if (keyStoreInputStream != null) { > keyStoreInputStream.close(); > } > } > > kmf = KeyManagerFactory.getInstance("SunX509"); > kmf.init(keyStore, "testtest".toCharArray()); > > TrustManagerFactory tmf = null; > // Uncommenting this makes it work, but it shouldn't be needed. > // tmf = TrustManagerFactory.getInstance("PKIX"); > // tmf.init(keyStore); > > SSLContext sslContext = SSLContext.getInstance("TLS"); > sslContext.init(kmf != null ? kmf.getKeyManagers() : null, > tmf != null ? tmf.getTrustManagers() : null, null); > > connection.connect(address, sslContext); > } > } > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, > and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > ********************************************************************** > ************* The Royal Bank of Scotland plc. Registered in Scotland > No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the De > Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and > is registered in the Commercial Register under number 33002587. > Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. > The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are > authorised to act as agent for each other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept > responsibility for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the > onward transmission, opening or use of this message and any > attachments will not adversely affect its systems or data. No > responsibility is accepted by the RBS group in this regard and the > recipient should carry out such virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > ********************************************************************** > ************* > > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, > and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support |
From: Bruno H. <Bru...@ma...> - 2010-03-26 14:40:31
|
Hi, Changing the write method is sufficient. Best wishes, Bruno. On 26/03/2010 14:33, nia...@rb... wrote: > Hi, > > So does the change to the write method alone solve the problem (where you add a count). Or did you have to increase the output buffer as well as change the write method? > > Thanks, > Niall > > -----Original Message----- > From: Bruno Harbulot [mailto:Bru...@ma...] > Sent: 26 March 2010 14:09 > To: sim...@li... > Subject: [Simpleweb-Support] SSL handshake issue > > Hello, > > I've been debugging an issue we've just had in Restlet with the Simple connector, following the change of configuration of SSL, and tracked it down to the Simple library (this doesn't happen with the Grizzly or Jetty connectors, even in NIO mode). > > I've been able to reproduce this problem with SimpleWeb directly (without Restlet). I'm pasting the test application (taken from the Simple tutorial and adapted to have an SSLContext) at the end. > > The problem is that the TrustManagerFactory needs to be initialised with a store that trusts the certificate of the server itself. This is normally not required: the trust manager is for checking remote certificates, not local ones. > > What happens is that the connection hangs and the server's CPU usage increases. This is reproducible on OSX 10.6 (and I think the other user who's experiencing the problem is under Linux). > > > If I turn on SSL debugging with -Djavax.net.debug=ssl,handshake, I can see this message: > *** ServerHelloDone > However, when analysing the packets with Wireshark, the handshake stops right after ClientHello (no ServerHello, no Certificate, no > ServerHelloDone) are visible. > > > I haven't looked in details into the SimpleWeb code, but if I comment this out in org.simpleframework.transport.Handshake, it works: > // engine.setWantClientAuth(true); > > > By debugging it a bit more closely, it seems to be stuck calling > Handshake.execute() (not stuck in the loop within this, buy within the > loop within write(), reiterating with status NEED_WRAP). > > > If I change this in the constructor (double the size of the output > buffer), it also fixes the problem: > public Handshake(Transport transport, Negotiator negotiator, int size) { > this.output = ByteBuffer.allocate(size*2); > this.input = ByteBuffer.allocate(size); > > > Considering that: > - doubling the output buffer size makes it work, > - disabling client auth send the CertificateRequest message to the > client, which would include a list of accepted CAs, > > my guess is that this has nothing to do with the trust store. Rather, > it has to do with the output buffer being too short. What happens with > the default trust store would just be a side-effect of the > CertificateRequest message being longer (since the default trust store > comes with a number of CAs to put in the DN list). > > > > Unlike read(), write() doesn't seem to have a "count" to write more. The > following change seems to solve the problem: > > private Status write() throws IOException { > return write(5); > } > > private Status write(int count) throws IOException { > while (count> 0) { > SSLEngineResult result = engine.wrap(empty, output); > HandshakeStatus status = result.getHandshakeStatus(); > > switch (status) { > case NOT_HANDSHAKING: > case FINISHED: > case NEED_UNWRAP: > return SERVER; > case NEED_WRAP: > return write(count - 1); > case NEED_TASK: > execute(); > } > } > return SERVER; > } > > > > > Best wishes, > > Bruno. > > > > > > import org.simpleframework.http.core.Container; > import org.simpleframework.transport.connect.Connection; > import org.simpleframework.transport.connect.SocketConnection; > import org.simpleframework.http.Response; > import org.simpleframework.http.Request; > import java.net.InetSocketAddress; > import java.net.SocketAddress; > import java.security.KeyStore; > import java.io.FileInputStream; > import java.io.IOException; > import java.io.PrintStream; > > import javax.net.ssl.KeyManagerFactory; > import javax.net.ssl.SSLContext; > import javax.net.ssl.TrustManagerFactory; > > public class HelloWorld implements Container { > public void handle(Request request, Response response) { > try { > PrintStream body = response.getPrintStream(); > long time = System.currentTimeMillis(); > > response.set("Content-Type", "text/plain"); > response.set("Server", "HelloWorld/1.0 (Simple 4.0)"); > response.setDate("Date", time); > response.setDate("Last-Modified", time); > > body.println("Hello World"); > body.close(); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > public static void main(String[] list) throws Exception { > Container container = new HelloWorld(); > Connection connection = new SocketConnection(container); > SocketAddress address = new InetSocketAddress(8443); > > KeyManagerFactory kmf = null; > KeyStore keyStore = KeyStore.getInstance("PKCS12"); > FileInputStream keyStoreInputStream = null; > try { > keyStoreInputStream = new FileInputStream( > "/.../path/to/localhost.p12"); > keyStore.load(keyStoreInputStream, "testtest".toCharArray()); > } finally { > if (keyStoreInputStream != null) { > keyStoreInputStream.close(); > } > } > > kmf = KeyManagerFactory.getInstance("SunX509"); > kmf.init(keyStore, "testtest".toCharArray()); > > TrustManagerFactory tmf = null; > // Uncommenting this makes it work, but it shouldn't be needed. > // tmf = TrustManagerFactory.getInstance("PKIX"); > // tmf.init(keyStore); > > SSLContext sslContext = SSLContext.getInstance("TLS"); > sslContext.init(kmf != null ? kmf.getKeyManagers() : null, > tmf != null ? tmf.getTrustManagers() : null, null); > > connection.connect(address, sslContext); > } > } > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the > De Nederlandsche Bank and has its seat at Amsterdam, the > Netherlands, and is registered in the Commercial Register under > number 33002587. Registered Office: Gustav Mahlerlaan 10, > Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and > The Royal Bank of Scotland plc are authorised to act as agent for each > other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept responsibility > for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the onward > transmission, opening or use of this message and any attachments will > not adversely affect its systems or data. No responsibility is accepted > by the RBS group in this regard and the recipient should carry out such > virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > *********************************************************************************** > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support |
From: <nia...@rb...> - 2010-03-26 14:33:47
|
Hi, So does the change to the write method alone solve the problem (where you add a count). Or did you have to increase the output buffer as well as change the write method? Thanks, Niall -----Original Message----- From: Bruno Harbulot [mailto:Bru...@ma...] Sent: 26 March 2010 14:09 To: sim...@li... Subject: [Simpleweb-Support] SSL handshake issue Hello, I've been debugging an issue we've just had in Restlet with the Simple connector, following the change of configuration of SSL, and tracked it down to the Simple library (this doesn't happen with the Grizzly or Jetty connectors, even in NIO mode). I've been able to reproduce this problem with SimpleWeb directly (without Restlet). I'm pasting the test application (taken from the Simple tutorial and adapted to have an SSLContext) at the end. The problem is that the TrustManagerFactory needs to be initialised with a store that trusts the certificate of the server itself. This is normally not required: the trust manager is for checking remote certificates, not local ones. What happens is that the connection hangs and the server's CPU usage increases. This is reproducible on OSX 10.6 (and I think the other user who's experiencing the problem is under Linux). If I turn on SSL debugging with -Djavax.net.debug=ssl,handshake, I can see this message: *** ServerHelloDone However, when analysing the packets with Wireshark, the handshake stops right after ClientHello (no ServerHello, no Certificate, no ServerHelloDone) are visible. I haven't looked in details into the SimpleWeb code, but if I comment this out in org.simpleframework.transport.Handshake, it works: // engine.setWantClientAuth(true); By debugging it a bit more closely, it seems to be stuck calling Handshake.execute() (not stuck in the loop within this, buy within the loop within write(), reiterating with status NEED_WRAP). If I change this in the constructor (double the size of the output buffer), it also fixes the problem: public Handshake(Transport transport, Negotiator negotiator, int size) { this.output = ByteBuffer.allocate(size*2); this.input = ByteBuffer.allocate(size); Considering that: - doubling the output buffer size makes it work, - disabling client auth send the CertificateRequest message to the client, which would include a list of accepted CAs, my guess is that this has nothing to do with the trust store. Rather, it has to do with the output buffer being too short. What happens with the default trust store would just be a side-effect of the CertificateRequest message being longer (since the default trust store comes with a number of CAs to put in the DN list). Unlike read(), write() doesn't seem to have a "count" to write more. The following change seems to solve the problem: private Status write() throws IOException { return write(5); } private Status write(int count) throws IOException { while (count > 0) { SSLEngineResult result = engine.wrap(empty, output); HandshakeStatus status = result.getHandshakeStatus(); switch (status) { case NOT_HANDSHAKING: case FINISHED: case NEED_UNWRAP: return SERVER; case NEED_WRAP: return write(count - 1); case NEED_TASK: execute(); } } return SERVER; } Best wishes, Bruno. import org.simpleframework.http.core.Container; import org.simpleframework.transport.connect.Connection; import org.simpleframework.transport.connect.SocketConnection; import org.simpleframework.http.Response; import org.simpleframework.http.Request; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.security.KeyStore; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintStream; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; public class HelloWorld implements Container { public void handle(Request request, Response response) { try { PrintStream body = response.getPrintStream(); long time = System.currentTimeMillis(); response.set("Content-Type", "text/plain"); response.set("Server", "HelloWorld/1.0 (Simple 4.0)"); response.setDate("Date", time); response.setDate("Last-Modified", time); body.println("Hello World"); body.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] list) throws Exception { Container container = new HelloWorld(); Connection connection = new SocketConnection(container); SocketAddress address = new InetSocketAddress(8443); KeyManagerFactory kmf = null; KeyStore keyStore = KeyStore.getInstance("PKCS12"); FileInputStream keyStoreInputStream = null; try { keyStoreInputStream = new FileInputStream( "/.../path/to/localhost.p12"); keyStore.load(keyStoreInputStream, "testtest".toCharArray()); } finally { if (keyStoreInputStream != null) { keyStoreInputStream.close(); } } kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(keyStore, "testtest".toCharArray()); TrustManagerFactory tmf = null; // Uncommenting this makes it work, but it shouldn't be needed. // tmf = TrustManagerFactory.getInstance("PKIX"); // tmf.init(keyStore); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(kmf != null ? kmf.getKeyManagers() : null, tmf != null ? tmf.getTrustManagers() : null, null); connection.connect(address, sslContext); } } ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpleweb-support *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority. The Royal Bank of Scotland N.V. is authorised and regulated by the De Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and is registered in the Commercial Register under number 33002587. Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are authorised to act as agent for each other in certain jurisdictions. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland N.V. including its affiliates ("RBS group") does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by the RBS group in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our website at www.rbs.com *********************************************************************************** |
From: Bruno H. <Bru...@ma...> - 2010-03-26 14:08:59
|
Hello, I've been debugging an issue we've just had in Restlet with the Simple connector, following the change of configuration of SSL, and tracked it down to the Simple library (this doesn't happen with the Grizzly or Jetty connectors, even in NIO mode). I've been able to reproduce this problem with SimpleWeb directly (without Restlet). I'm pasting the test application (taken from the Simple tutorial and adapted to have an SSLContext) at the end. The problem is that the TrustManagerFactory needs to be initialised with a store that trusts the certificate of the server itself. This is normally not required: the trust manager is for checking remote certificates, not local ones. What happens is that the connection hangs and the server's CPU usage increases. This is reproducible on OSX 10.6 (and I think the other user who's experiencing the problem is under Linux). If I turn on SSL debugging with -Djavax.net.debug=ssl,handshake, I can see this message: *** ServerHelloDone However, when analysing the packets with Wireshark, the handshake stops right after ClientHello (no ServerHello, no Certificate, no ServerHelloDone) are visible. I haven't looked in details into the SimpleWeb code, but if I comment this out in org.simpleframework.transport.Handshake, it works: // engine.setWantClientAuth(true); By debugging it a bit more closely, it seems to be stuck calling Handshake.execute() (not stuck in the loop within this, buy within the loop within write(), reiterating with status NEED_WRAP). If I change this in the constructor (double the size of the output buffer), it also fixes the problem: public Handshake(Transport transport, Negotiator negotiator, int size) { this.output = ByteBuffer.allocate(size*2); this.input = ByteBuffer.allocate(size); Considering that: - doubling the output buffer size makes it work, - disabling client auth send the CertificateRequest message to the client, which would include a list of accepted CAs, my guess is that this has nothing to do with the trust store. Rather, it has to do with the output buffer being too short. What happens with the default trust store would just be a side-effect of the CertificateRequest message being longer (since the default trust store comes with a number of CAs to put in the DN list). Unlike read(), write() doesn't seem to have a "count" to write more. The following change seems to solve the problem: private Status write() throws IOException { return write(5); } private Status write(int count) throws IOException { while (count > 0) { SSLEngineResult result = engine.wrap(empty, output); HandshakeStatus status = result.getHandshakeStatus(); switch (status) { case NOT_HANDSHAKING: case FINISHED: case NEED_UNWRAP: return SERVER; case NEED_WRAP: return write(count - 1); case NEED_TASK: execute(); } } return SERVER; } Best wishes, Bruno. import org.simpleframework.http.core.Container; import org.simpleframework.transport.connect.Connection; import org.simpleframework.transport.connect.SocketConnection; import org.simpleframework.http.Response; import org.simpleframework.http.Request; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.security.KeyStore; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintStream; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; public class HelloWorld implements Container { public void handle(Request request, Response response) { try { PrintStream body = response.getPrintStream(); long time = System.currentTimeMillis(); response.set("Content-Type", "text/plain"); response.set("Server", "HelloWorld/1.0 (Simple 4.0)"); response.setDate("Date", time); response.setDate("Last-Modified", time); body.println("Hello World"); body.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] list) throws Exception { Container container = new HelloWorld(); Connection connection = new SocketConnection(container); SocketAddress address = new InetSocketAddress(8443); KeyManagerFactory kmf = null; KeyStore keyStore = KeyStore.getInstance("PKCS12"); FileInputStream keyStoreInputStream = null; try { keyStoreInputStream = new FileInputStream( "/.../path/to/localhost.p12"); keyStore.load(keyStoreInputStream, "testtest".toCharArray()); } finally { if (keyStoreInputStream != null) { keyStoreInputStream.close(); } } kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(keyStore, "testtest".toCharArray()); TrustManagerFactory tmf = null; // Uncommenting this makes it work, but it shouldn't be needed. // tmf = TrustManagerFactory.getInstance("PKIX"); // tmf.init(keyStore); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(kmf != null ? kmf.getKeyManagers() : null, tmf != null ? tmf.getTrustManagers() : null, null); connection.connect(address, sslContext); } } |
From: <nia...@rb...> - 2010-03-25 17:39:03
|
It should be downloadable and available on Maven by the weekend as 4.1.20. Regards, Niall -----Original Message----- From: car...@gm... [mailto:car...@gm...] On Behalf Of Carfield Yim Sent: 25 March 2010 17:37 To: Simple support and user issues Cc: GALLAGHER, Niall, GBM Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Thanks a lot, actually I don't have chance to check out the code and apply the patch and build On Fri, Mar 26, 2010 at 1:34 AM, <nia...@rb...> wrote: > Hi, > > I have noticed a slight issue in the SocketWriter, and although I have never experienced this problem myself it is still possible to cause the loop you mention. Here are the return codes for the FileChannelImpl. > > 35 static final int EOF = -1; // End of file > 36 static final int UNAVAILABLE = -2; // Nothing > available (non-blocking) > 37 static final int INTERRUPTED = -3; // System call > interrupted > 38 static final int UNSUPPORTED = -4; // Operation not > supported > 39 static final int THROWN = -5; // Exception thrown > in JNI code > 40 static final int UNSUPPORTED_CASE = -6; // This case not > supported > > So here I say > > if(size == 0) { > break; > } > > Then add to count, and check if count > 0. However as you can see if -1 to -6 is returned a loop will occur. I have attached the SocketWriter that will fix this. I will release a new version with this fix shortly. > > Thanks, > Niall > > -----Original Message----- > From: GALLAGHER, Niall, GBM > Sent: 24 March 2010 18:55 > To: 'Simple support and user issues' > Subject: RE: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > Ok, thanks, I will investigate this further. Looks like the bug could be in the SegmentBuilder. > > Thanks, > Niall > > > Niall Gallagher > RBS Global Banking & Markets > Office: +44 2070851454 > > -----Original Message----- > From: Christophe Roudet [mailto:cr...@ac...] > Sent: 24 March 2010 18:20 > To: sim...@li... > Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > I had the same problem happening sometimes to times, stuck in > SocketWriter.flush() where segment was null. > > Christophe > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > ********************************************************************** > ************* The Royal Bank of Scotland plc. Registered in Scotland > No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the De > Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and > is registered in the Commercial Register under number 33002587. > Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. > The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are > authorised to act as agent for each other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept > responsibility for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the > onward transmission, opening or use of this message and any > attachments will not adversely affect its systems or data. No > responsibility is accepted by the RBS group in this regard and the > recipient should carry out such virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > ********************************************************************** > ************* > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, > and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > |
From: Carfield Y. <car...@ca...> - 2010-03-25 17:36:53
|
Thanks a lot, actually I don't have chance to check out the code and apply the patch and build On Fri, Mar 26, 2010 at 1:34 AM, <nia...@rb...> wrote: > Hi, > > I have noticed a slight issue in the SocketWriter, and although I have never experienced this problem myself it is still possible to cause the loop you mention. Here are the return codes for the FileChannelImpl. > > 35 static final int EOF = -1; // End of file > 36 static final int UNAVAILABLE = -2; // Nothing available (non-blocking) > 37 static final int INTERRUPTED = -3; // System call interrupted > 38 static final int UNSUPPORTED = -4; // Operation not supported > 39 static final int THROWN = -5; // Exception thrown in JNI code > 40 static final int UNSUPPORTED_CASE = -6; // This case not supported > > So here I say > > if(size == 0) { > break; > } > > Then add to count, and check if count > 0. However as you can see if -1 to -6 is returned a loop will occur. I have attached the SocketWriter that will fix this. I will release a new version with this fix shortly. > > Thanks, > Niall > > -----Original Message----- > From: GALLAGHER, Niall, GBM > Sent: 24 March 2010 18:55 > To: 'Simple support and user issues' > Subject: RE: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > Ok, thanks, I will investigate this further. Looks like the bug could be in the SegmentBuilder. > > Thanks, > Niall > > > Niall Gallagher > RBS Global Banking & Markets > Office: +44 2070851454 > > -----Original Message----- > From: Christophe Roudet [mailto:cr...@ac...] > Sent: 24 March 2010 18:20 > To: sim...@li... > Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > I had the same problem happening sometimes to times, stuck in > SocketWriter.flush() where segment was null. > > Christophe > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the > De Nederlandsche Bank and has its seat at Amsterdam, the > Netherlands, and is registered in the Commercial Register under > number 33002587. Registered Office: Gustav Mahlerlaan 10, > Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and > The Royal Bank of Scotland plc are authorised to act as agent for each > other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept responsibility > for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the onward > transmission, opening or use of this message and any attachments will > not adversely affect its systems or data. No responsibility is accepted > by the RBS group in this regard and the recipient should carry out such > virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > *********************************************************************************** > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > |
From: <nia...@rb...> - 2010-03-25 17:34:10
|
Hi, I have noticed a slight issue in the SocketWriter, and although I have never experienced this problem myself it is still possible to cause the loop you mention. Here are the return codes for the FileChannelImpl. 35 static final int EOF = -1; // End of file 36 static final int UNAVAILABLE = -2; // Nothing available (non-blocking) 37 static final int INTERRUPTED = -3; // System call interrupted 38 static final int UNSUPPORTED = -4; // Operation not supported 39 static final int THROWN = -5; // Exception thrown in JNI code 40 static final int UNSUPPORTED_CASE = -6; // This case not supported So here I say if(size == 0) { break; } Then add to count, and check if count > 0. However as you can see if -1 to -6 is returned a loop will occur. I have attached the SocketWriter that will fix this. I will release a new version with this fix shortly. Thanks, Niall -----Original Message----- From: GALLAGHER, Niall, GBM Sent: 24 March 2010 18:55 To: 'Simple support and user issues' Subject: RE: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Ok, thanks, I will investigate this further. Looks like the bug could be in the SegmentBuilder. Thanks, Niall Niall Gallagher RBS Global Banking & Markets Office: +44 2070851454 -----Original Message----- From: Christophe Roudet [mailto:cr...@ac...] Sent: 24 March 2010 18:20 To: sim...@li... Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? I had the same problem happening sometimes to times, stuck in SocketWriter.flush() where segment was null. Christophe ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpleweb-support *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority. The Royal Bank of Scotland N.V. is authorised and regulated by the De Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and is registered in the Commercial Register under number 33002587. Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are authorised to act as agent for each other in certain jurisdictions. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland N.V. including its affiliates ("RBS group") does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by the RBS group in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our website at www.rbs.com *********************************************************************************** |
From: <nia...@rb...> - 2010-03-24 18:54:43
|
Ok, thanks, I will investigate this further. Looks like the bug could be in the SegmentBuilder. Thanks, Niall Niall Gallagher RBS Global Banking & Markets Office: +44 2070851454 -----Original Message----- From: Christophe Roudet [mailto:cr...@ac...] Sent: 24 March 2010 18:20 To: sim...@li... Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? I had the same problem happening sometimes to times, stuck in SocketWriter.flush() where segment was null. Christophe ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpleweb-support *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority. The Royal Bank of Scotland N.V. is authorised and regulated by the De Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and is registered in the Commercial Register under number 33002587. Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are authorised to act as agent for each other in certain jurisdictions. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland N.V. including its affiliates ("RBS group") does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by the RBS group in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our website at www.rbs.com *********************************************************************************** |
From: Christophe R. <cr...@ac...> - 2010-03-24 18:20:19
|
I had the same problem happening sometimes to times, stuck in SocketWriter.flush() where segment was null. Christophe |
From: <nia...@rb...> - 2010-03-24 18:15:47
|
Sorry, forgot the file. Niall Gallagher RBS Global Banking & Markets Office: +44 2070851454 -----Original Message----- From: GALLAGHER, Niall, GBM Sent: 24 March 2010 18:12 To: sim...@li... Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Can you replace your SocketWriter with the attached implementation, if there is spinning this will report an exception. Yes, for operations that take some time, like doing some DB access or requesting data from a remote service. Executing the request asynchronously has distinct advantages, particularly for highly loaded servers. However, for simple page requests its often not required. If you could tell me if you still get the problem after using my patch I would really appreciate it. You may instead see some exceptions. Either way it would be good to see what happens. Niall Gallagher RBS Global Banking & Markets Office: +44 2070851454 -----Original Message----- From: Carfield Yim [mailto:car...@ca...] Sent: 24 March 2010 17:43 To: Simple support and user issues Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Sure, here are the sources BTW, I just applying the Async example from the tutorial and nothing else, what do you mean by you writing from a thread pool? On Tue, Mar 23, 2010 at 6:20 PM, <nia...@rb...> wrote: > Hi, > > There is no deadlock in the thread dump provided. What could be > happening is that the flush could be spinning, but I can not see why the logic is sound. > One thing I noticed is that the SocketWriter is flushing at line 177 > in both threads. This does not match an expression in the 4.1.19 > download. Can you send me the SocketWriter.java that you have used to > build the server. Also can you send me > hk.com.carfield.web.simple.Controller I am particularly intereseted in > the method rawDisplay at line 124. There could be a potential infinite loop writing. > > Another issue, is why are you writing from a thread pool, do you > really need asynchronous execution. Are you performing some long > running operation? You do not need to executed in a thread of your > own. The servicing thread pool of the server is fine for 90% of normal page serving operations. > > Thanks, > Niall > ________________________________ > From: Carfield Yim [mailto:car...@ca...] > Sent: 21 March 2010 03:08 > To: Simple support and user issues > Subject: Re: [Simpleweb-Support] Deadlock in > org.simpleframework.transport.SocketWriter.flush ?? > > Sorry, Just see it reproduce now, attached the thread dump I am not > that sure what is the connected client.... will try to figure that out > The name of the thread are : pool-2thread-5 and pool-2thread-3 On Thu, > Mar 18, 2010 at 6:03 PM, <nia...@rb...> wrote: >> >> Hi, >> >> Can you provide an actual thread dump with kill -QUIT? Also, what is >> the connected client? And what is the name of the thread at 100% CPU? >> >> Thanks, >> Niall >> >> -----Original Message----- >> From: Carfield Yim [mailto:car...@ca...] >> Sent: 17 March 2010 18:21 >> To: Simple support and user issues >> Subject: Re: [Simpleweb-Support] Deadlock in >> org.simpleframework.transport.SocketWriter.flush ?? >> >> I am using 4.1.19 already, pretty sure about that. >> >> On Thu, Mar 18, 2010 at 2:14 AM, <nia...@rb...> wrote: >> > Hi, >> > >> > You are on a very old version still, I can tell from the names of >> > the threads. I fixed an issue with the flusher some time ago. Can >> > you upgrade to 4.1.19? >> > >> > Thanks, >> > Niall >> > >> > -----Original Message----- >> > From: Carfield Yim [mailto:car...@ca...] >> > Sent: 17 March 2010 18:02 >> > To: Simple support and user issues >> > Subject: [Simpleweb-Support] Deadlock in >> > org.simpleframework.transport.SocketWriter.flush ?? >> > >> > Hi, after I upgraded to use simpleframework 4, one of the worker >> > thread will reach 100% CPU after it running few hours, from the >> > jconsole , I see the thread dump is running >> > org.simpleframework.transport.SocketWriter.flush(), will there >> > deadlock for this method?? >> > >> > Here are the stacktrace I get: >> > >> > Name: pool-2-thread-2 >> > State: RUNNABLE >> > Total blocked: 6,030 Total waited: 18,254 >> > >> > Stack trace: >> > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java: >> > 171 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@4860bb11 >> > org.simpleframework.transport.SocketWriter.write(SocketWriter.java: >> > 124 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@4860bb11 >> > org.simpleframework.transport.SocketController.write(SocketController. >> > java:70) >> > org.simpleframework.transport.SocketTransport.write(SocketTransport >> > .ja >> > va:203) >> > org.simpleframework.http.core.TransportSender.send(TransportSender. >> > jav >> > a:125) >> > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. >> > java:156) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:184) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:167) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:21 >> > 9) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:19 >> > 0) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:16 >> > 9) >> > sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) >> > sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) >> > sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) >> > - locked java.io.OutputStreamWriter@27c31ea7 >> > java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) >> > org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java: >> > 138) >> > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268 >> > ) >> > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280 >> > ) >> > org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java >> > :61 >> > ) >> > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNod >> > e.j >> > ava:230) >> > org.apache.velocity.runtime.directive.VelocimacroProxy.render(Veloc >> > ima >> > croProxy.java:172) >> > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDire >> > cti >> > ve.java:114) >> > org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java: >> > 55) >> > org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:1 >> > 66) >> > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDire >> > cti >> > ve.java:114) >> > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNod >> > e.j >> > ava:230) >> > org.apache.velocity.Template.merge(Template.java:256) >> > hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager. >> > jav >> > a:62) >> > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java >> > :82 >> > ) >> > - Hide quoted text - >> > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) >> > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) >> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java: >> > 471 >> > ) >> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) >> > java.util.concurrent.FutureTask.run(FutureTask.java:166) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.a >> > ccess$101(ScheduledThreadPoolExecutor.java:165) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.r >> > un(ScheduledThreadPoolExecutor.java:266) >> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto >> > r.j >> > ava:1110) >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. >> > java:603) >> > java.lang.Thread.run(Thread.java:636) >> > >> > >> > Name: pool-2-thread-1 >> > State: RUNNABLE >> > Total blocked: 302 Total waited: 1,123 >> > >> > Stack trace: >> > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java: >> > 171 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@7a5af320 >> > org.simpleframework.transport.SocketWriter.write(SocketWriter.java: >> > 124 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@7a5af320 >> > org.simpleframework.transport.SocketController.write(SocketController. >> > java:70) >> > org.simpleframework.transport.SocketTransport.write(SocketTransport >> > .ja >> > va:203) >> > org.simpleframework.http.core.TransportSender.send(TransportSender. >> > jav >> > a:125) >> > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. >> > java:156) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:184) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:167) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:21 >> > 9) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:19 >> > 0) >> > sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl. >> > java:516) >> > sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) >> > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:12 >> > 4) >> > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:10 >> > 5) >> > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java >> > :71 >> > ) >> > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) >> > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) >> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java: >> > 471 >> > ) >> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) >> > java.util.concurrent.FutureTask.run(FutureTask.java:166) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.a >> > ccess$101(ScheduledThreadPoolExecutor.java:165) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.r >> > un(ScheduledThreadPoolExecutor.java:266) >> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto >> > r.j >> > ava:1110) >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. >> > java:603) >> > java.lang.Thread.run(Thread.java:636) >> > >> > ------------------------------------------------------------------- >> > --- >> > -------- Download Intel® Parallel Studio Eval Try the new >> > software tools for yourself. Speed compiling, find bugs >> > proactively, and fine-tune applications for parallel performance. >> > See why Intel Parallel Studio got high marks during beta. >> > http://p.sf.net/sfu/intel-sw-dev >> > _______________________________________________ >> > Simpleweb-Support mailing list >> > Sim...@li... >> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> > >> > ******************************************************************* >> > *** >> > ************* The Royal Bank of Scotland plc. Registered in >> > Scotland No 90312. >> > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> > Authorised and regulated by the Financial Services Authority. The >> > Royal Bank of Scotland N.V. is authorised and regulated by the De >> > Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, >> > and is registered in the Commercial Register under number 33002587. >> > Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. >> > The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc >> > are authorised to act as agent for each other in certain jurisdictions. >> > >> > This e-mail message is confidential and for use by the addressee only. >> > If the message is received by anyone other than the addressee, >> > please return the message to the sender by replying to it and then >> > delete the message from your computer. Internet e-mails are not >> > necessarily secure. The Royal Bank of Scotland plc and The Royal >> > Bank of Scotland N.V. including its affiliates ("RBS group") does >> > not accept responsibility for changes made to this message after it was sent. >> > >> > Whilst all reasonable care has been taken to avoid the transmission >> > of viruses, it is the responsibility of the recipient to ensure >> > that the onward transmission, opening or use of this message and >> > any attachments will not adversely affect its systems or data. No >> > responsibility is accepted by the RBS group in this regard and the >> > recipient should carry out such virus and other checks as it >> > considers appropriate. >> > >> > Visit our website at www.rbs.com >> > >> > ******************************************************************* >> > *** >> > ************* >> > >> > >> > ------------------------------------------------------------------- >> > --- >> > -------- Download Intel® Parallel Studio Eval Try the new >> > software tools for yourself. Speed compiling, find bugs >> > proactively, and fine-tune applications for parallel performance. >> > See why Intel Parallel Studio got high marks during beta. >> > http://p.sf.net/sfu/intel-sw-dev >> > _______________________________________________ >> > Simpleweb-Support mailing list >> > Sim...@li... >> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> > >> >> >> --------------------------------------------------------------------- >> --------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> >> --------------------------------------------------------------------- >> --------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, > and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpleweb-support |
From: <nia...@rb...> - 2010-03-24 18:11:43
|
Can you replace your SocketWriter with the attached implementation, if there is spinning this will report an exception. Yes, for operations that take some time, like doing some DB access or requesting data from a remote service. Executing the request asynchronously has distinct advantages, particularly for highly loaded servers. However, for simple page requests its often not required. If you could tell me if you still get the problem after using my patch I would really appreciate it. You may instead see some exceptions. Either way it would be good to see what happens. Niall Gallagher RBS Global Banking & Markets Office: +44 2070851454 -----Original Message----- From: Carfield Yim [mailto:car...@ca...] Sent: 24 March 2010 17:43 To: Simple support and user issues Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Sure, here are the sources BTW, I just applying the Async example from the tutorial and nothing else, what do you mean by you writing from a thread pool? On Tue, Mar 23, 2010 at 6:20 PM, <nia...@rb...> wrote: > Hi, > > There is no deadlock in the thread dump provided. What could be > happening is that the flush could be spinning, but I can not see why the logic is sound. > One thing I noticed is that the SocketWriter is flushing at line 177 > in both threads. This does not match an expression in the 4.1.19 > download. Can you send me the SocketWriter.java that you have used to > build the server. Also can you send me > hk.com.carfield.web.simple.Controller I am particularly intereseted in > the method rawDisplay at line 124. There could be a potential infinite loop writing. > > Another issue, is why are you writing from a thread pool, do you > really need asynchronous execution. Are you performing some long > running operation? You do not need to executed in a thread of your > own. The servicing thread pool of the server is fine for 90% of normal page serving operations. > > Thanks, > Niall > ________________________________ > From: Carfield Yim [mailto:car...@ca...] > Sent: 21 March 2010 03:08 > To: Simple support and user issues > Subject: Re: [Simpleweb-Support] Deadlock in > org.simpleframework.transport.SocketWriter.flush ?? > > Sorry, Just see it reproduce now, attached the thread dump I am not > that sure what is the connected client.... will try to figure that out > The name of the thread are : pool-2thread-5 and pool-2thread-3 On Thu, > Mar 18, 2010 at 6:03 PM, <nia...@rb...> wrote: >> >> Hi, >> >> Can you provide an actual thread dump with kill -QUIT? Also, what is >> the connected client? And what is the name of the thread at 100% CPU? >> >> Thanks, >> Niall >> >> -----Original Message----- >> From: Carfield Yim [mailto:car...@ca...] >> Sent: 17 March 2010 18:21 >> To: Simple support and user issues >> Subject: Re: [Simpleweb-Support] Deadlock in >> org.simpleframework.transport.SocketWriter.flush ?? >> >> I am using 4.1.19 already, pretty sure about that. >> >> On Thu, Mar 18, 2010 at 2:14 AM, <nia...@rb...> wrote: >> > Hi, >> > >> > You are on a very old version still, I can tell from the names of >> > the threads. I fixed an issue with the flusher some time ago. Can >> > you upgrade to 4.1.19? >> > >> > Thanks, >> > Niall >> > >> > -----Original Message----- >> > From: Carfield Yim [mailto:car...@ca...] >> > Sent: 17 March 2010 18:02 >> > To: Simple support and user issues >> > Subject: [Simpleweb-Support] Deadlock in >> > org.simpleframework.transport.SocketWriter.flush ?? >> > >> > Hi, after I upgraded to use simpleframework 4, one of the worker >> > thread will reach 100% CPU after it running few hours, from the >> > jconsole , I see the thread dump is running >> > org.simpleframework.transport.SocketWriter.flush(), will there >> > deadlock for this method?? >> > >> > Here are the stacktrace I get: >> > >> > Name: pool-2-thread-2 >> > State: RUNNABLE >> > Total blocked: 6,030 Total waited: 18,254 >> > >> > Stack trace: >> > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java: >> > 171 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@4860bb11 >> > org.simpleframework.transport.SocketWriter.write(SocketWriter.java: >> > 124 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@4860bb11 >> > org.simpleframework.transport.SocketController.write(SocketController. >> > java:70) >> > org.simpleframework.transport.SocketTransport.write(SocketTransport >> > .ja >> > va:203) >> > org.simpleframework.http.core.TransportSender.send(TransportSender. >> > jav >> > a:125) >> > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. >> > java:156) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:184) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:167) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:21 >> > 9) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:19 >> > 0) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:16 >> > 9) >> > sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) >> > sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) >> > sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) >> > - locked java.io.OutputStreamWriter@27c31ea7 >> > java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) >> > org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java: >> > 138) >> > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268 >> > ) >> > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280 >> > ) >> > org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java >> > :61 >> > ) >> > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNod >> > e.j >> > ava:230) >> > org.apache.velocity.runtime.directive.VelocimacroProxy.render(Veloc >> > ima >> > croProxy.java:172) >> > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDire >> > cti >> > ve.java:114) >> > org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java: >> > 55) >> > org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:1 >> > 66) >> > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDire >> > cti >> > ve.java:114) >> > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNod >> > e.j >> > ava:230) >> > org.apache.velocity.Template.merge(Template.java:256) >> > hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager. >> > jav >> > a:62) >> > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java >> > :82 >> > ) >> > - Hide quoted text - >> > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) >> > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) >> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java: >> > 471 >> > ) >> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) >> > java.util.concurrent.FutureTask.run(FutureTask.java:166) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.a >> > ccess$101(ScheduledThreadPoolExecutor.java:165) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.r >> > un(ScheduledThreadPoolExecutor.java:266) >> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto >> > r.j >> > ava:1110) >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. >> > java:603) >> > java.lang.Thread.run(Thread.java:636) >> > >> > >> > Name: pool-2-thread-1 >> > State: RUNNABLE >> > Total blocked: 302 Total waited: 1,123 >> > >> > Stack trace: >> > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java: >> > 171 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@7a5af320 >> > org.simpleframework.transport.SocketWriter.write(SocketWriter.java: >> > 124 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@7a5af320 >> > org.simpleframework.transport.SocketController.write(SocketController. >> > java:70) >> > org.simpleframework.transport.SocketTransport.write(SocketTransport >> > .ja >> > va:203) >> > org.simpleframework.http.core.TransportSender.send(TransportSender. >> > jav >> > a:125) >> > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. >> > java:156) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:184) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:167) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:21 >> > 9) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:19 >> > 0) >> > sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl. >> > java:516) >> > sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) >> > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:12 >> > 4) >> > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:10 >> > 5) >> > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java >> > :71 >> > ) >> > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) >> > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) >> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java: >> > 471 >> > ) >> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) >> > java.util.concurrent.FutureTask.run(FutureTask.java:166) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.a >> > ccess$101(ScheduledThreadPoolExecutor.java:165) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas >> > k.r >> > un(ScheduledThreadPoolExecutor.java:266) >> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto >> > r.j >> > ava:1110) >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. >> > java:603) >> > java.lang.Thread.run(Thread.java:636) >> > >> > ------------------------------------------------------------------- >> > --- >> > -------- Download Intel® Parallel Studio Eval Try the new >> > software tools for yourself. Speed compiling, find bugs >> > proactively, and fine-tune applications for parallel performance. >> > See why Intel Parallel Studio got high marks during beta. >> > http://p.sf.net/sfu/intel-sw-dev >> > _______________________________________________ >> > Simpleweb-Support mailing list >> > Sim...@li... >> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> > >> > ******************************************************************* >> > *** >> > ************* The Royal Bank of Scotland plc. Registered in >> > Scotland No 90312. >> > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> > Authorised and regulated by the Financial Services Authority. The >> > Royal Bank of Scotland N.V. is authorised and regulated by the De >> > Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, >> > and is registered in the Commercial Register under number 33002587. >> > Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. >> > The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc >> > are authorised to act as agent for each other in certain jurisdictions. >> > >> > This e-mail message is confidential and for use by the addressee only. >> > If the message is received by anyone other than the addressee, >> > please return the message to the sender by replying to it and then >> > delete the message from your computer. Internet e-mails are not >> > necessarily secure. The Royal Bank of Scotland plc and The Royal >> > Bank of Scotland N.V. including its affiliates ("RBS group") does >> > not accept responsibility for changes made to this message after it was sent. >> > >> > Whilst all reasonable care has been taken to avoid the transmission >> > of viruses, it is the responsibility of the recipient to ensure >> > that the onward transmission, opening or use of this message and >> > any attachments will not adversely affect its systems or data. No >> > responsibility is accepted by the RBS group in this regard and the >> > recipient should carry out such virus and other checks as it >> > considers appropriate. >> > >> > Visit our website at www.rbs.com >> > >> > ******************************************************************* >> > *** >> > ************* >> > >> > >> > ------------------------------------------------------------------- >> > --- >> > -------- Download Intel® Parallel Studio Eval Try the new >> > software tools for yourself. Speed compiling, find bugs >> > proactively, and fine-tune applications for parallel performance. >> > See why Intel Parallel Studio got high marks during beta. >> > http://p.sf.net/sfu/intel-sw-dev >> > _______________________________________________ >> > Simpleweb-Support mailing list >> > Sim...@li... >> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> > >> >> >> --------------------------------------------------------------------- >> --------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> >> --------------------------------------------------------------------- >> --------- Download Intel® Parallel Studio Eval Try the new >> software tools for yourself. Speed compiling, find bugs proactively, >> and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, > and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > |
From: Carfield Y. <car...@ca...> - 2010-03-24 17:43:19
|
Sure, here are the sources BTW, I just applying the Async example from the tutorial and nothing else, what do you mean by you writing from a thread pool? On Tue, Mar 23, 2010 at 6:20 PM, <nia...@rb...> wrote: > Hi, > > There is no deadlock in the thread dump provided. What could be happening is > that the flush could be spinning, but I can not see why the logic is sound. > One thing I noticed is that the SocketWriter is flushing at line 177 in both > threads. This does not match an expression in the 4.1.19 download. Can you > send me the SocketWriter.java that you have used to build the server. Also > can you send me hk.com.carfield.web.simple.Controller I am particularly > intereseted in the method rawDisplay at line 124. There could be a potential > infinite loop writing. > > Another issue, is why are you writing from a thread pool, do you really need > asynchronous execution. Are you performing some long running operation? You > do not need to executed in a thread of your own. The servicing thread pool > of the server is fine for 90% of normal page serving operations. > > Thanks, > Niall > ________________________________ > From: Carfield Yim [mailto:car...@ca...] > Sent: 21 March 2010 03:08 > To: Simple support and user issues > Subject: Re: [Simpleweb-Support] Deadlock in > org.simpleframework.transport.SocketWriter.flush ?? > > Sorry, Just see it reproduce now, attached the thread dump > I am not that sure what is the connected client.... will try to figure that > out > The name of the thread are : pool-2thread-5 and pool-2thread-3 > On Thu, Mar 18, 2010 at 6:03 PM, <nia...@rb...> wrote: >> >> Hi, >> >> Can you provide an actual thread dump with kill -QUIT? Also, what is the >> connected client? And what is the name of the thread at 100% CPU? >> >> Thanks, >> Niall >> >> -----Original Message----- >> From: Carfield Yim [mailto:car...@ca...] >> Sent: 17 March 2010 18:21 >> To: Simple support and user issues >> Subject: Re: [Simpleweb-Support] Deadlock in >> org.simpleframework.transport.SocketWriter.flush ?? >> >> I am using 4.1.19 already, pretty sure about that. >> >> On Thu, Mar 18, 2010 at 2:14 AM, <nia...@rb...> wrote: >> > Hi, >> > >> > You are on a very old version still, I can tell from the names of the >> > threads. I fixed an issue with the flusher some time ago. Can you upgrade to >> > 4.1.19? >> > >> > Thanks, >> > Niall >> > >> > -----Original Message----- >> > From: Carfield Yim [mailto:car...@ca...] >> > Sent: 17 March 2010 18:02 >> > To: Simple support and user issues >> > Subject: [Simpleweb-Support] Deadlock in >> > org.simpleframework.transport.SocketWriter.flush ?? >> > >> > Hi, after I upgraded to use simpleframework 4, one of the worker thread >> > will reach 100% CPU after it running few hours, from the jconsole , I see >> > the thread dump is running >> > org.simpleframework.transport.SocketWriter.flush(), will there deadlock for >> > this method?? >> > >> > Here are the stacktrace I get: >> > >> > Name: pool-2-thread-2 >> > State: RUNNABLE >> > Total blocked: 6,030 Total waited: 18,254 >> > >> > Stack trace: >> > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@4860bb11 >> > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@4860bb11 >> > org.simpleframework.transport.SocketController.write(SocketController. >> > java:70) >> > org.simpleframework.transport.SocketTransport.write(SocketTransport.ja >> > va:203) >> > org.simpleframework.http.core.TransportSender.send(TransportSender.jav >> > a:125) >> > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. >> > java:156) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:184) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:167) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:169) >> > sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) >> > sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) >> > sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) >> > - locked java.io.OutputStreamWriter@27c31ea7 >> > java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) >> > org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java: >> > 138) >> > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268) >> > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280) >> > org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java:61 >> > ) >> > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.j >> > ava:230) >> > org.apache.velocity.runtime.directive.VelocimacroProxy.render(Velocima >> > croProxy.java:172) >> > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirecti >> > ve.java:114) >> > org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java: >> > 55) >> > org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166) >> > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirecti >> > ve.java:114) >> > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.j >> > ava:230) >> > org.apache.velocity.Template.merge(Template.java:256) >> > hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager.jav >> > a:62) >> > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:82 >> > ) >> > - Hide quoted text - >> > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) >> > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) >> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471 >> > ) >> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) >> > java.util.concurrent.FutureTask.run(FutureTask.java:166) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.a >> > ccess$101(ScheduledThreadPoolExecutor.java:165) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.r >> > un(ScheduledThreadPoolExecutor.java:266) >> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j >> > ava:1110) >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. >> > java:603) >> > java.lang.Thread.run(Thread.java:636) >> > >> > >> > Name: pool-2-thread-1 >> > State: RUNNABLE >> > Total blocked: 302 Total waited: 1,123 >> > >> > Stack trace: >> > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@7a5af320 >> > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124 >> > ) >> > - locked org.simpleframework.transport.SocketWriter@7a5af320 >> > org.simpleframework.transport.SocketController.write(SocketController. >> > java:70) >> > org.simpleframework.transport.SocketTransport.write(SocketTransport.ja >> > va:203) >> > org.simpleframework.http.core.TransportSender.send(TransportSender.jav >> > a:125) >> > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. >> > java:156) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:184) >> > org.simpleframework.http.core.Transfer.write(Transfer.java:167) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) >> > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) >> > sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl. >> > java:516) >> > sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) >> > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:124) >> > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:105) >> > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:71 >> > ) >> > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) >> > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) >> > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471 >> > ) >> > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) >> > java.util.concurrent.FutureTask.run(FutureTask.java:166) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.a >> > ccess$101(ScheduledThreadPoolExecutor.java:165) >> > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.r >> > un(ScheduledThreadPoolExecutor.java:266) >> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j >> > ava:1110) >> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. >> > java:603) >> > java.lang.Thread.run(Thread.java:636) >> > >> > ---------------------------------------------------------------------- >> > -------- Download Intel® Parallel Studio Eval Try the new >> > software tools for yourself. Speed compiling, find bugs proactively, and >> > fine-tune applications for parallel performance. >> > See why Intel Parallel Studio got high marks during beta. >> > http://p.sf.net/sfu/intel-sw-dev >> > _______________________________________________ >> > Simpleweb-Support mailing list >> > Sim...@li... >> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> > >> > ********************************************************************** >> > ************* The Royal Bank of Scotland plc. Registered in Scotland >> > No 90312. >> > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. >> > Authorised and regulated by the Financial Services Authority. The >> > Royal Bank of Scotland N.V. is authorised and regulated by the De >> > Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and >> > is registered in the Commercial Register under number 33002587. >> > Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. >> > The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are >> > authorised to act as agent for each other in certain jurisdictions. >> > >> > This e-mail message is confidential and for use by the addressee only. >> > If the message is received by anyone other than the addressee, please >> > return the message to the sender by replying to it and then delete the >> > message from your computer. Internet e-mails are not necessarily >> > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland >> > N.V. including its affiliates ("RBS group") does not accept >> > responsibility for changes made to this message after it was sent. >> > >> > Whilst all reasonable care has been taken to avoid the transmission of >> > viruses, it is the responsibility of the recipient to ensure that the >> > onward transmission, opening or use of this message and any >> > attachments will not adversely affect its systems or data. No >> > responsibility is accepted by the RBS group in this regard and the >> > recipient should carry out such virus and other checks as it considers >> > appropriate. >> > >> > Visit our website at www.rbs.com >> > >> > ********************************************************************** >> > ************* >> > >> > >> > ---------------------------------------------------------------------- >> > -------- Download Intel® Parallel Studio Eval Try the new >> > software tools for yourself. Speed compiling, find bugs proactively, >> > and fine-tune applications for parallel performance. >> > See why Intel Parallel Studio got high marks during beta. >> > http://p.sf.net/sfu/intel-sw-dev >> > _______________________________________________ >> > Simpleweb-Support mailing list >> > Sim...@li... >> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> > >> >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval Try the new software tools for >> yourself. Speed compiling, find bugs proactively, and fine-tune applications >> for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support >> >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Simpleweb-Support mailing list >> Sim...@li... >> https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > |
From: <nia...@rb...> - 2010-03-23 10:21:02
|
Hi, There is no deadlock in the thread dump provided. What could be happening is that the flush could be spinning, but I can not see why the logic is sound. One thing I noticed is that the SocketWriter is flushing at line 177 in both threads. This does not match an expression in the 4.1.19 download. Can you send me the SocketWriter.java that you have used to build the server. Also can you send me hk.com.carfield.web.simple.Controller I am particularly intereseted in the method rawDisplay at line 124. There could be a potential infinite loop writing. Another issue, is why are you writing from a thread pool, do you really need asynchronous execution. Are you performing some long running operation? You do not need to executed in a thread of your own. The servicing thread pool of the server is fine for 90% of normal page serving operations. Thanks, Niall ________________________________ From: Carfield Yim [mailto:car...@ca...] Sent: 21 March 2010 03:08 To: Simple support and user issues Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Sorry, Just see it reproduce now, attached the thread dump I am not that sure what is the connected client.... will try to figure that out The name of the thread are : pool-2thread-5 and pool-2thread-3 On Thu, Mar 18, 2010 at 6:03 PM, <nia...@rb...<mailto:nia...@rb...>> wrote: Hi, Can you provide an actual thread dump with kill -QUIT? Also, what is the connected client? And what is the name of the thread at 100% CPU? Thanks, Niall -----Original Message----- From: Carfield Yim [mailto:car...@ca...<mailto:car...@ca...>] Sent: 17 March 2010 18:21 To: Simple support and user issues Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? I am using 4.1.19 already, pretty sure about that. On Thu, Mar 18, 2010 at 2:14 AM, <nia...@rb...<mailto:nia...@rb...>> wrote: > Hi, > > You are on a very old version still, I can tell from the names of the threads. I fixed an issue with the flusher some time ago. Can you upgrade to 4.1.19? > > Thanks, > Niall > > -----Original Message----- > From: Carfield Yim [mailto:car...@ca...<mailto:car...@ca...>] > Sent: 17 March 2010 18:02 > To: Simple support and user issues > Subject: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > Hi, after I upgraded to use simpleframework 4, one of the worker thread will reach 100% CPU after it running few hours, from the jconsole , I see the thread dump is running org.simpleframework.transport.SocketWriter.flush(), will there deadlock for this method?? > > Here are the stacktrace I get: > > Name: pool-2-thread-2 > State: RUNNABLE > Total blocked: 6,030 Total waited: 18,254 > > Stack trace: > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171 > ) > - locked org.simpleframework.transport.SocketWriter@4860bb11 > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124 > ) > - locked org.simpleframework.transport.SocketWriter@4860bb11 > org.simpleframework.transport.SocketController.write(SocketController. > java:70) > org.simpleframework.transport.SocketTransport.write(SocketTransport.ja > va:203) > org.simpleframework.http.core.TransportSender.send(TransportSender.jav > a:125) > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. > java:156) > org.simpleframework.http.core.Transfer.write(Transfer.java:184) > org.simpleframework.http.core.Transfer.write(Transfer.java:167) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:169) > sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) > sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) > sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) > - locked java.io.OutputStreamWriter@27c31ea7 > java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) > org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java: > 138) > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268) > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280) > org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java:61 > ) > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.j > ava:230) > org.apache.velocity.runtime.directive.VelocimacroProxy.render(Velocima > croProxy.java:172) > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirecti > ve.java:114) > org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java: > 55) > org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166) > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirecti > ve.java:114) > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.j > ava:230) > org.apache.velocity.Template.merge(Template.java:256) > hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager.jav > a:62) > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:82 > ) > - Hide quoted text - > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471 > ) > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) > java.util.concurrent.FutureTask.run(FutureTask.java:166) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.a > ccess$101(ScheduledThreadPoolExecutor.java:165) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.r > un(ScheduledThreadPoolExecutor.java:266) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j > ava:1110) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. > java:603) > java.lang.Thread.run(Thread.java:636) > > > Name: pool-2-thread-1 > State: RUNNABLE > Total blocked: 302 Total waited: 1,123 > > Stack trace: > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171 > ) > - locked org.simpleframework.transport.SocketWriter@7a5af320 > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124 > ) > - locked org.simpleframework.transport.SocketWriter@7a5af320 > org.simpleframework.transport.SocketController.write(SocketController. > java:70) > org.simpleframework.transport.SocketTransport.write(SocketTransport.ja > va:203) > org.simpleframework.http.core.TransportSender.send(TransportSender.jav > a:125) > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. > java:156) > org.simpleframework.http.core.Transfer.write(Transfer.java:184) > org.simpleframework.http.core.Transfer.write(Transfer.java:167) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) > sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl. > java:516) > sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:124) > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:105) > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:71 > ) > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471 > ) > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) > java.util.concurrent.FutureTask.run(FutureTask.java:166) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.a > ccess$101(ScheduledThreadPoolExecutor.java:165) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.r > un(ScheduledThreadPoolExecutor.java:266) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j > ava:1110) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. > java:603) > java.lang.Thread.run(Thread.java:636) > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li...<mailto:Sim...@li...> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > ********************************************************************** > ************* The Royal Bank of Scotland plc. Registered in Scotland > No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the De > Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and > is registered in the Commercial Register under number 33002587. > Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. > The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are > authorised to act as agent for each other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept > responsibility for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the > onward transmission, opening or use of this message and any > attachments will not adversely affect its systems or data. No > responsibility is accepted by the RBS group in this regard and the > recipient should carry out such virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com<http://www.rbs.com> > > ********************************************************************** > ************* > > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, > and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li...<mailto:Sim...@li...> > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li...<mailto:Sim...@li...> https://lists.sourceforge.net/lists/listinfo/simpleweb-support ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li...<mailto:Sim...@li...> https://lists.sourceforge.net/lists/listinfo/simpleweb-support |
From: <nia...@rb...> - 2010-03-18 10:03:48
|
Hi, Can you provide an actual thread dump with kill -QUIT? Also, what is the connected client? And what is the name of the thread at 100% CPU? Thanks, Niall -----Original Message----- From: Carfield Yim [mailto:car...@ca...] Sent: 17 March 2010 18:21 To: Simple support and user issues Subject: Re: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? I am using 4.1.19 already, pretty sure about that. On Thu, Mar 18, 2010 at 2:14 AM, <nia...@rb...> wrote: > Hi, > > You are on a very old version still, I can tell from the names of the threads. I fixed an issue with the flusher some time ago. Can you upgrade to 4.1.19? > > Thanks, > Niall > > -----Original Message----- > From: Carfield Yim [mailto:car...@ca...] > Sent: 17 March 2010 18:02 > To: Simple support and user issues > Subject: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > Hi, after I upgraded to use simpleframework 4, one of the worker thread will reach 100% CPU after it running few hours, from the jconsole , I see the thread dump is running org.simpleframework.transport.SocketWriter.flush(), will there deadlock for this method?? > > Here are the stacktrace I get: > > Name: pool-2-thread-2 > State: RUNNABLE > Total blocked: 6,030 Total waited: 18,254 > > Stack trace: > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171 > ) > - locked org.simpleframework.transport.SocketWriter@4860bb11 > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124 > ) > - locked org.simpleframework.transport.SocketWriter@4860bb11 > org.simpleframework.transport.SocketController.write(SocketController. > java:70) > org.simpleframework.transport.SocketTransport.write(SocketTransport.ja > va:203) > org.simpleframework.http.core.TransportSender.send(TransportSender.jav > a:125) > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. > java:156) > org.simpleframework.http.core.Transfer.write(Transfer.java:184) > org.simpleframework.http.core.Transfer.write(Transfer.java:167) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:169) > sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) > sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) > sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) > - locked java.io.OutputStreamWriter@27c31ea7 > java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) > org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java: > 138) > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268) > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280) > org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java:61 > ) > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.j > ava:230) > org.apache.velocity.runtime.directive.VelocimacroProxy.render(Velocima > croProxy.java:172) > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirecti > ve.java:114) > org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java: > 55) > org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166) > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirecti > ve.java:114) > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.j > ava:230) > org.apache.velocity.Template.merge(Template.java:256) > hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager.jav > a:62) > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:82 > ) > - Hide quoted text - > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471 > ) > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) > java.util.concurrent.FutureTask.run(FutureTask.java:166) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.a > ccess$101(ScheduledThreadPoolExecutor.java:165) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.r > un(ScheduledThreadPoolExecutor.java:266) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j > ava:1110) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. > java:603) > java.lang.Thread.run(Thread.java:636) > > > Name: pool-2-thread-1 > State: RUNNABLE > Total blocked: 302 Total waited: 1,123 > > Stack trace: > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171 > ) > - locked org.simpleframework.transport.SocketWriter@7a5af320 > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124 > ) > - locked org.simpleframework.transport.SocketWriter@7a5af320 > org.simpleframework.transport.SocketController.write(SocketController. > java:70) > org.simpleframework.transport.SocketTransport.write(SocketTransport.ja > va:203) > org.simpleframework.http.core.TransportSender.send(TransportSender.jav > a:125) > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer. > java:156) > org.simpleframework.http.core.Transfer.write(Transfer.java:184) > org.simpleframework.http.core.Transfer.write(Transfer.java:167) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) > sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl. > java:516) > sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:124) > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:105) > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:71 > ) > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471 > ) > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) > java.util.concurrent.FutureTask.run(FutureTask.java:166) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.a > ccess$101(ScheduledThreadPoolExecutor.java:165) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.r > un(ScheduledThreadPoolExecutor.java:266) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.j > ava:1110) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor. > java:603) > java.lang.Thread.run(Thread.java:636) > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > ********************************************************************** > ************* The Royal Bank of Scotland plc. Registered in Scotland > No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the De > Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and > is registered in the Commercial Register under number 33002587. > Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. > The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are > authorised to act as agent for each other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept > responsibility for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the > onward transmission, opening or use of this message and any > attachments will not adversely affect its systems or data. No > responsibility is accepted by the RBS group in this regard and the > recipient should carry out such virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > ********************************************************************** > ************* > > > ---------------------------------------------------------------------- > -------- Download Intel® Parallel Studio Eval Try the new > software tools for yourself. Speed compiling, find bugs proactively, > and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpleweb-support |
From: Carfield Y. <car...@ca...> - 2010-03-17 18:20:57
|
I am using 4.1.19 already, pretty sure about that. On Thu, Mar 18, 2010 at 2:14 AM, <nia...@rb...> wrote: > Hi, > > You are on a very old version still, I can tell from the names of the threads. I fixed an issue with the flusher some time ago. Can you upgrade to 4.1.19? > > Thanks, > Niall > > -----Original Message----- > From: Carfield Yim [mailto:car...@ca...] > Sent: 17 March 2010 18:02 > To: Simple support and user issues > Subject: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? > > Hi, after I upgraded to use simpleframework 4, one of the worker thread will reach 100% CPU after it running few hours, from the jconsole , I see the thread dump is running org.simpleframework.transport.SocketWriter.flush(), will there deadlock for this method?? > > Here are the stacktrace I get: > > Name: pool-2-thread-2 > State: RUNNABLE > Total blocked: 6,030 Total waited: 18,254 > > Stack trace: > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171) > - locked org.simpleframework.transport.SocketWriter@4860bb11 > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124) > - locked org.simpleframework.transport.SocketWriter@4860bb11 > org.simpleframework.transport.SocketController.write(SocketController.java:70) > org.simpleframework.transport.SocketTransport.write(SocketTransport.java:203) > org.simpleframework.http.core.TransportSender.send(TransportSender.java:125) > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer.java:156) > org.simpleframework.http.core.Transfer.write(Transfer.java:184) > org.simpleframework.http.core.Transfer.write(Transfer.java:167) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:169) > sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) > sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) > sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) > - locked java.io.OutputStreamWriter@27c31ea7 > java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) > org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java:138) > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268) > org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280) > org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java:61) > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230) > org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:172) > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114) > org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55) > org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166) > org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114) > org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230) > org.apache.velocity.Template.merge(Template.java:256) > hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager.java:62) > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:82) > - Hide quoted text - > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) > java.util.concurrent.FutureTask.run(FutureTask.java:166) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) > java.lang.Thread.run(Thread.java:636) > > > Name: pool-2-thread-1 > State: RUNNABLE > Total blocked: 302 Total waited: 1,123 > > Stack trace: > org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171) > - locked org.simpleframework.transport.SocketWriter@7a5af320 > org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124) > - locked org.simpleframework.transport.SocketWriter@7a5af320 > org.simpleframework.transport.SocketController.write(SocketController.java:70) > org.simpleframework.transport.SocketTransport.write(SocketTransport.java:203) > org.simpleframework.http.core.TransportSender.send(TransportSender.java:125) > org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer.java:156) > org.simpleframework.http.core.Transfer.write(Transfer.java:184) > org.simpleframework.http.core.Transfer.write(Transfer.java:167) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) > org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) > sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl.java:516) > sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:124) > hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:105) > hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:71) > hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) > hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) > java.util.concurrent.FutureTask.run(FutureTask.java:166) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165) > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) > java.lang.Thread.run(Thread.java:636) > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the > De Nederlandsche Bank and has its seat at Amsterdam, the > Netherlands, and is registered in the Commercial Register under > number 33002587. Registered Office: Gustav Mahlerlaan 10, > Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and > The Royal Bank of Scotland plc are authorised to act as agent for each > other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept responsibility > for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the onward > transmission, opening or use of this message and any attachments will > not adversely affect its systems or data. No responsibility is accepted > by the RBS group in this regard and the recipient should carry out such > virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > *********************************************************************************** > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > |
From: <nia...@rb...> - 2010-03-17 18:14:32
|
Hi, You are on a very old version still, I can tell from the names of the threads. I fixed an issue with the flusher some time ago. Can you upgrade to 4.1.19? Thanks, Niall -----Original Message----- From: Carfield Yim [mailto:car...@ca...] Sent: 17 March 2010 18:02 To: Simple support and user issues Subject: [Simpleweb-Support] Deadlock in org.simpleframework.transport.SocketWriter.flush ?? Hi, after I upgraded to use simpleframework 4, one of the worker thread will reach 100% CPU after it running few hours, from the jconsole , I see the thread dump is running org.simpleframework.transport.SocketWriter.flush(), will there deadlock for this method?? Here are the stacktrace I get: Name: pool-2-thread-2 State: RUNNABLE Total blocked: 6,030 Total waited: 18,254 Stack trace: org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171) - locked org.simpleframework.transport.SocketWriter@4860bb11 org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124) - locked org.simpleframework.transport.SocketWriter@4860bb11 org.simpleframework.transport.SocketController.write(SocketController.java:70) org.simpleframework.transport.SocketTransport.write(SocketTransport.java:203) org.simpleframework.http.core.TransportSender.send(TransportSender.java:125) org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer.java:156) org.simpleframework.http.core.Transfer.write(Transfer.java:184) org.simpleframework.http.core.Transfer.write(Transfer.java:167) org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) org.simpleframework.http.core.Accumulator.write(Accumulator.java:169) sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) - locked java.io.OutputStreamWriter@27c31ea7 java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java:138) org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268) org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280) org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java:61) org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230) org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:172) org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114) org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55) org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166) org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114) org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230) org.apache.velocity.Template.merge(Template.java:256) hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager.java:62) hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:82) - Hide quoted text - hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) java.util.concurrent.FutureTask.run(FutureTask.java:166) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) java.lang.Thread.run(Thread.java:636) Name: pool-2-thread-1 State: RUNNABLE Total blocked: 302 Total waited: 1,123 Stack trace: org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171) - locked org.simpleframework.transport.SocketWriter@7a5af320 org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124) - locked org.simpleframework.transport.SocketWriter@7a5af320 org.simpleframework.transport.SocketController.write(SocketController.java:70) org.simpleframework.transport.SocketTransport.write(SocketTransport.java:203) org.simpleframework.http.core.TransportSender.send(TransportSender.java:125) org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer.java:156) org.simpleframework.http.core.Transfer.write(Transfer.java:184) org.simpleframework.http.core.Transfer.write(Transfer.java:167) org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl.java:516) sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:124) hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:105) hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:71) hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) java.util.concurrent.FutureTask.run(FutureTask.java:166) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) java.lang.Thread.run(Thread.java:636) ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Simpleweb-Support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simpleweb-support *********************************************************************************** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority. The Royal Bank of Scotland N.V. is authorised and regulated by the De Nederlandsche Bank and has its seat at Amsterdam, the Netherlands, and is registered in the Commercial Register under number 33002587. Registered Office: Gustav Mahlerlaan 10, Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and The Royal Bank of Scotland plc are authorised to act as agent for each other in certain jurisdictions. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland N.V. including its affiliates ("RBS group") does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by the RBS group in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our website at www.rbs.com *********************************************************************************** |
From: Carfield Y. <car...@ca...> - 2010-03-17 18:02:13
|
Hi, after I upgraded to use simpleframework 4, one of the worker thread will reach 100% CPU after it running few hours, from the jconsole , I see the thread dump is running org.simpleframework.transport.SocketWriter.flush(), will there deadlock for this method?? Here are the stacktrace I get: Name: pool-2-thread-2 State: RUNNABLE Total blocked: 6,030 Total waited: 18,254 Stack trace: org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171) - locked org.simpleframework.transport.SocketWriter@4860bb11 org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124) - locked org.simpleframework.transport.SocketWriter@4860bb11 org.simpleframework.transport.SocketController.write(SocketController.java:70) org.simpleframework.transport.SocketTransport.write(SocketTransport.java:203) org.simpleframework.http.core.TransportSender.send(TransportSender.java:125) org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer.java:156) org.simpleframework.http.core.Transfer.write(Transfer.java:184) org.simpleframework.http.core.Transfer.write(Transfer.java:167) org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) org.simpleframework.http.core.Accumulator.write(Accumulator.java:169) sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220) sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:281) sun.nio.cs.StreamEncoder.write(StreamEncoder.java:124) - locked java.io.OutputStreamWriter@27c31ea7 java.io.OutputStreamWriter.write(OutputStreamWriter.java:207) org.apache.velocity.io.VelocityWriter.flushBuffer(VelocityWriter.java:138) org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:268) org.apache.velocity.io.VelocityWriter.write(VelocityWriter.java:280) org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java:61) org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230) org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:172) org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114) org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55) org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166) org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114) org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230) org.apache.velocity.Template.merge(Template.java:256) hk.com.carfield.core.TemplateManager.mergeTemplate(TemplateManager.java:62) hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:82) - Hide quoted text - hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) java.util.concurrent.FutureTask.run(FutureTask.java:166) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) java.lang.Thread.run(Thread.java:636) Name: pool-2-thread-1 State: RUNNABLE Total blocked: 302 Total waited: 1,123 Stack trace: org.simpleframework.transport.SocketWriter.flush(SocketWriter.java:171) - locked org.simpleframework.transport.SocketWriter@7a5af320 org.simpleframework.transport.SocketWriter.write(SocketWriter.java:124) - locked org.simpleframework.transport.SocketWriter@7a5af320 org.simpleframework.transport.SocketController.write(SocketController.java:70) org.simpleframework.transport.SocketTransport.write(SocketTransport.java:203) org.simpleframework.http.core.TransportSender.send(TransportSender.java:125) org.simpleframework.http.core.ChunkedProducer.produce(ChunkedProducer.java:156) org.simpleframework.http.core.Transfer.write(Transfer.java:184) org.simpleframework.http.core.Transfer.write(Transfer.java:167) org.simpleframework.http.core.Accumulator.write(Accumulator.java:219) org.simpleframework.http.core.Accumulator.write(Accumulator.java:190) sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl.java:516) sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:565) hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:124) hk.com.carfield.web.simple.Controller.rawDisplay(Controller.java:105) hk.com.carfield.web.simple.Controller.handleRequest(Controller.java:71) hk.com.carfield.web.simple.Controller.access$1(Controller.java:40) hk.com.carfield.web.simple.Controller$1.run(Controller.java:173) java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) java.util.concurrent.FutureTask.run(FutureTask.java:166) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165) java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) java.lang.Thread.run(Thread.java:636) |
From: Andrew C. <cla...@gm...> - 2010-03-12 23:09:39
|
Thank did the trick Niall, thanks a mil Andrew On Fri, Mar 12, 2010 at 4:07 PM, <nia...@rb...> wrote: > Hi, > > Whats happening here is that the request is queued for an asynchronous > response, so when you write your data it is passed to a ByteBuffer queue > which is asynchronously flushed by a SocketFlusher if it can not be written > straight away, this allows the servicing thread to return while the kernel > waits for an I/O event do occur. This means that if during delivery there is > an exception you will not see it as its smothered by the internal reactor > (which is using a different thread pool). > > One thing you can do is to commit() and flush() straight away, this > guarantees that the client will get the HTTP header before you start sending > the response. Here I am assuming your clients will not close the connection > in mid response? If this is the case your initial flush will allow you to > determine if the client is closing the connection. > > If this is not enough, you can do the following to get the SocketChannel > and detect if its closed. > > public class SocketSnoopServer implements Server { > private final Server realServer ; > public SocketSnoopServer (Server realServer ){ > this.realServer = realServer ; > } > public void process(Socket socket)throws IOException{ > Map atts = socket.getAttributes(); > SocketChannel channel = socket.getChannel(); > atts.put("*mySocket*", channel); > realServer.process(socket); > } > public void stop() throws Exception{ > realServer.stop(); > } > } > > To create a new server go > > Container container = new MyContainer(); > Processor processor = new ContainerProcessor(container, new > FileAllocator(), 5); > Server server = new ProcessorServer(processor, 5); > Connection connection = new SocketConnection(server); > connection.connect(new InetSocketAddress(80)); > > Then when you go > > request.getAttribute("*mySocket*") > > you will get the SocketChannel. You can then check socket.isClosed() etc.. > > Hope this helps > Niall > ------------------------------ > *From:* Andrew Clarke [mailto:cla...@gm...] > *Sent:* 12 March 2010 15:33 > *To:* sim...@li... > *Subject:* [Simpleweb-Support] Closed client socket not causing an > exception to be thrown > > I am using simpleframework for a restful API which responds to ~10 requests > per second. > API clients will give up on a request if it takes more than x milliseconds > and I need to be able to detect this within the Container. > I have exception handling in Container.handle method but it appears that no > exception is thrown if i close a client socket before the response has been > sent in fact when I send the response to the client : > > httpResponse.getPrintStream().print(responseStr); > httpResponse.getPrintStream().flush(); > > I seem to be able to flush the print stream and no exception is thrown even > though I have already closed the client socket. > > Any ideas what may be happening here? > > Thanks > > Andrew > > *********************************************************************************** > The Royal Bank of Scotland plc. Registered in Scotland No 90312. > Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. > Authorised and regulated by the Financial Services Authority. The > Royal Bank of Scotland N.V. is authorised and regulated by the > De Nederlandsche Bank and has its seat at Amsterdam, the > Netherlands, and is registered in the Commercial Register under > number 33002587. Registered Office: Gustav Mahlerlaan 10, > Amsterdam, The Netherlands. The Royal Bank of Scotland N.V. and > The Royal Bank of Scotland plc are authorised to act as agent for each > other in certain jurisdictions. > > This e-mail message is confidential and for use by the addressee only. > If the message is received by anyone other than the addressee, please > return the message to the sender by replying to it and then delete the > message from your computer. Internet e-mails are not necessarily > secure. The Royal Bank of Scotland plc and The Royal Bank of Scotland > N.V. including its affiliates ("RBS group") does not accept responsibility > for changes made to this message after it was sent. > > Whilst all reasonable care has been taken to avoid the transmission of > viruses, it is the responsibility of the recipient to ensure that the onward > transmission, opening or use of this message and any attachments will > not adversely affect its systems or data. No responsibility is accepted > by the RBS group in this regard and the recipient should carry out such > virus and other checks as it considers appropriate. > > Visit our website at www.rbs.com > > *********************************************************************************** > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Simpleweb-Support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simpleweb-support > > |