svn commit: r1838155 - in /tomcat/trunk/java/org/apache/tomcat/util/net: Nio2Endpoint.java SocketWrapperBase.java

2018-08-16 Thread markt
Author: markt
Date: Thu Aug 16 07:34:13 2018
New Revision: 1838155

URL: http://svn.apache.org/viewvc?rev=1838155&view=rev
Log:
Rename and provide a better comment

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1838155&r1=1838154&r2=1838155&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Aug 16 
07:34:13 2018
@@ -572,10 +572,10 @@ public class Nio2Endpoint extends Abstra
 synchronized (writeCompletionHandler) {
 if (nBytes.intValue() < 0) {
 failed(new 
EOFException(sm.getString("iob.failedwrite")), attachment);
-} else if (!writeBuffer.isEmpty()) {
+} else if (!nonBlockingWriteBuffer.isEmpty()) {
 nestedWriteCompletionCount.get().incrementAndGet();
 // Continue writing data using a gathering write
-ByteBuffer[] array = 
writeBuffer.toArray(attachment);
+ByteBuffer[] array = 
nonBlockingWriteBuffer.toArray(attachment);
 getSocket().write(array, 0, array.length,
 toNio2Timeout(getWriteTimeout()), 
TimeUnit.MILLISECONDS,
 array, gatheringWriteCompletionHandler);
@@ -621,10 +621,10 @@ public class Nio2Endpoint extends Abstra
 synchronized (writeCompletionHandler) {
 if (nBytes.longValue() < 0) {
 failed(new 
EOFException(sm.getString("iob.failedwrite")), attachment);
-} else if (!writeBuffer.isEmpty() || 
arrayHasData(attachment)) {
+} else if (!nonBlockingWriteBuffer.isEmpty() || 
arrayHasData(attachment)) {
 // Continue writing data using a gathering write
 nestedWriteCompletionCount.get().incrementAndGet();
-ByteBuffer[] array = 
writeBuffer.toArray(attachment);
+ByteBuffer[] array = 
nonBlockingWriteBuffer.toArray(attachment);
 getSocket().write(array, 0, array.length,
 toNio2Timeout(getWriteTimeout()), 
TimeUnit.MILLISECONDS,
 array, gatheringWriteCompletionHandler);
@@ -1164,11 +1164,11 @@ public class Nio2Endpoint extends Abstra
 off = off + thisTime;
 if (len > 0) {
 // Remaining data must be buffered
-writeBuffer.add(buf, off, len);
+nonBlockingWriteBuffer.add(buf, off, len);
 }
 flushNonBlocking(true);
 } else {
-writeBuffer.add(buf, off, len);
+nonBlockingWriteBuffer.add(buf, off, len);
 }
 }
 }
@@ -1199,11 +1199,11 @@ public class Nio2Endpoint extends Abstra
 transfer(from, socketBufferHandler.getWriteBuffer());
 if (from.remaining() > 0) {
 // Remaining data must be buffered
-writeBuffer.add(from);
+nonBlockingWriteBuffer.add(from);
 }
 flushNonBlocking(true);
 } else {
-writeBuffer.add(from);
+nonBlockingWriteBuffer.add(from);
 }
 }
 }
@@ -1274,8 +1274,8 @@ public class Nio2Endpoint extends Abstra
 synchronized (writeCompletionHandler) {
 if (hasPermit || writePending.tryAcquire()) {
 socketBufferHandler.configureWriteBufferForRead();
-if (!writeBuffer.isEmpty()) {
-ByteBuffer[] array = 
writeBuffer.toArray(socketBufferHandler.getWriteBuffer());
+if (!nonBlockingWriteBuffer.isEmpty()) {
+ByteBuffer[] array = 
nonBlockingWriteBuffer.toArray(socketBufferHandler.getWriteBuffer());
 Nio2Endpoint.startInline();
 getSocket().write(array, 0, array.length, 
toNio2Timeout(getWriteTimeout()),
 TimeUnit.MILLISECONDS, array, 
gatheringWriteCompletionHandler);
@@ -1303,7 +1303,7 @@ public class Nio2Endpoint extends Abstra
 public boolean hasDataToWrite() {
 synchronized (writeCompletionH

svn commit: r1838156 - in /tomcat/tc8.5.x/trunk: ./ java/org/apache/tomcat/util/net/Nio2Endpoint.java java/org/apache/tomcat/util/net/SocketWrapperBase.java

2018-08-16 Thread markt
Author: markt
Date: Thu Aug 16 07:34:40 2018
New Revision: 1838156

URL: http://svn.apache.org/viewvc?rev=1838156&view=rev
Log:
Rename and provide a better comment

Modified:
tomcat/tc8.5.x/trunk/   (props changed)
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 16 07:34:40 2018
@@ -1,2 +1,2 @@
 /tomcat/tc8.0.x/trunk:1809644
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739492,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409
 
,1741501,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744149,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745535,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747
 
404,1747506,1747536,1747924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1
 
756289,1756408-1756410,1756778,1756798,1756878,1756898,1756939,1757123-1757124,1757126,1757128,1757132-1757133,1757136,1757145,1757167-1757168,1757175,1757180,1757182,1757195,1757271,1757278,1757347,1757353-1757354,1757363,1757374,1757399,1757406,1757408,1757485,1757495,1757499,1757527,1757578,1757684,1757722,1757727,1757790,1757799,1757813,1757853,1757883,1757903,1757976,1757997,1758000,1758058,1758072-1758075,1758078-1758079,1758223,1758257,1758261,1758276,1758292,1758369,1758378-1758383,1758421,1758423,1758425-1758427,1758430,1758443,1758448,1758459,1758483,1758486-1758487,1758499,1758525,1758556,1758580,1758582,1758584,1758588,1758842,1759019,1759212,1759224,1759227,1759252,1759274,1759513-1759516,1759611,1759757,1759785-1759790,1760005,1760022,1760109-1760110,1760135,1760200-1760201,1760227,1760300,1760397,1760446,1760454,1760640,1760648,1761057,1761422,1761491,1761498,1761500-1761501,1761550,1761553,1761572,1761574,1761625-1761626,1761628,1761682,1761740,1761752,1762051-176205
 
3,1762123,1762168,1762172,1762182,1762201-1762202,1762204,1762208,1762288,1762296,1762324,1762348,1762353,1762362,1762374,1762492,1762503,1762505,1762541,1762608,1762710,1762753,1762766,1762769,1762944,1762947,1762953,1763167,1763179,1763232,1763259,1763271-1763272,1763276-1763277,1763319-1763320,1763370,1763372,1763375,1763377,1763393,1763412,1763430,1763450,1763462,1763505,1763511-17635

svn commit: r1838163 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AprEndpoint.java SocketWrapperBase.java

2018-08-16 Thread markt
Author: markt
Date: Thu Aug 16 08:55:55 2018
New Revision: 1838163

URL: http://svn.apache.org/viewvc?rev=1838163&view=rev
Log:
Rename methods and expand comments to make the code easier to follow.
Add some TODOs where it appears further work is required.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1838163&r1=1838162&r2=1838163&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Aug 16 
08:55:55 2018
@@ -2576,9 +2576,9 @@ public class AprEndpoint extends Abstrac
 
 
 @Override
-protected void writeByteBufferBlocking(ByteBuffer from) throws 
IOException {
+protected void writeBlockingDirect(ByteBuffer from) throws IOException 
{
 if (from.isDirect()) {
-super.writeByteBufferBlocking(from);
+super.writeBlockingDirect(from);
 } else {
 // The socket write buffer capacity is socket.appWriteBufSize
 ByteBuffer writeBuffer = socketBufferHandler.getWriteBuffer();
@@ -2598,9 +2598,9 @@ public class AprEndpoint extends Abstrac
 
 
 @Override
-protected boolean writeByteBufferNonBlocking(ByteBuffer from) throws 
IOException {
+protected boolean writeNonBlockingDirect(ByteBuffer from) throws 
IOException {
 if (from.isDirect()) {
-return super.writeByteBufferNonBlocking(from);
+return super.writeNonBlockingDirect(from);
 } else {
 // The socket write buffer capacity is socket.appWriteBufSize
 ByteBuffer writeBuffer = socketBufferHandler.getWriteBuffer();

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1838163&r1=1838162&r2=1838163&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Thu Aug 
16 08:55:55 2018
@@ -358,9 +358,24 @@ public abstract class SocketWrapperBase<
 public abstract void close() throws IOException;
 public abstract boolean isClosed();
 
+
 /**
- * Writes the provided data to the socket, buffering any remaining data if
- * used in non-blocking mode.
+ * Writes the provided data to the socket write buffer. If the socket write
+ * buffer fills during the write, the content of the socket write buffer is
+ * written to the network and this method starts to fill the socket write
+ * buffer again. Depending on the size of the data to write, there may be
+ * multiple writes to the network.
+ * 
+ * Non-blocking writes must return immediately and the byte array holding
+ * the data to be written must be immediately available for re-use. It may
+ * not be possible to write sufficient data to the network to allow this to
+ * happen. In this case data that cannot be written to the network and
+ * cannot be held by the socket buffer is stored in the non-blocking write
+ * buffer.
+ * 
+ * Note: There is an implementation assumption that, before switching from
+ *   non-blocking writes to blocking writes, any data remaining in the
+ *   non-blocking write buffer will have been written to the network.
  *
  * @param block true if a blocking write should be used,
  *  otherwise a non-blocking write will be used
@@ -375,10 +390,18 @@ public abstract class SocketWrapperBase<
 return;
 }
 
-// While the implementations for blocking and non-blocking writes are
-// very similar they have been split into separate methods to allow
-// sub-classes to override them individually. NIO2, for example,
-// overrides the non-blocking write but not the blocking write.
+/*
+ * While the implementations for blocking and non-blocking writes are
+ * very similar they have been split into separate methods:
+ * - To allow sub-classes to override them individually. NIO2, for
+ *   example, overrides the non-blocking write but not the blocking
+ *   write.
+ * - To enable a marginally more efficient implemented for blocking
+ *   writes which do not require the additional checks related to the
+ *   use of the non-blocking write buffer
+ *   TODO: Explore re-factoring options to remove the sp

svn commit: r1838164 - in /tomcat/tc8.5.x/trunk: ./ java/org/apache/tomcat/util/net/AprEndpoint.java java/org/apache/tomcat/util/net/SocketWrapperBase.java

2018-08-16 Thread markt
Author: markt
Date: Thu Aug 16 08:56:22 2018
New Revision: 1838164

URL: http://svn.apache.org/viewvc?rev=1838164&view=rev
Log:
Rename methods and expand comments to make the code easier to follow.
Add some TODOs where it appears further work is required.

Modified:
tomcat/tc8.5.x/trunk/   (props changed)
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/tc8.5.x/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 16 08:56:22 2018
@@ -1,2 +1,2 @@
 /tomcat/tc8.0.x/trunk:1809644
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739492,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409
 
,1741501,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744149,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745535,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747
 
404,1747506,1747536,1747924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1
 
756289,1756408-1756410,1756778,1756798,1756878,1756898,1756939,1757123-1757124,1757126,1757128,1757132-1757133,1757136,1757145,1757167-1757168,1757175,1757180,1757182,1757195,1757271,1757278,1757347,1757353-1757354,1757363,1757374,1757399,1757406,1757408,1757485,1757495,1757499,1757527,1757578,1757684,1757722,1757727,1757790,1757799,1757813,1757853,1757883,1757903,1757976,1757997,1758000,1758058,1758072-1758075,1758078-1758079,1758223,1758257,1758261,1758276,1758292,1758369,1758378-1758383,1758421,1758423,1758425-1758427,1758430,1758443,1758448,1758459,1758483,1758486-1758487,1758499,1758525,1758556,1758580,1758582,1758584,1758588,1758842,1759019,1759212,1759224,1759227,1759252,1759274,1759513-1759516,1759611,1759757,1759785-1759790,1760005,1760022,1760109-1760110,1760135,1760200-1760201,1760227,1760300,1760397,1760446,1760454,1760640,1760648,1761057,1761422,1761491,1761498,1761500-1761501,1761550,1761553,1761572,1761574,1761625-1761626,1761628,1761682,1761740,1761752,1762051-176205
 
3,1762123,1762168,1762172,1762182,1762201-1762202,1762204,1762208,1762288,1762296,1762324,1762348,1762353,1762362,1762374,1762492,1762503,1762505,1762541,1762608,1762710,1762753,1762766,1762769,1762944,1762947,1762953,1763167,1763179,1763232,1763259,1763271-1763272,1763276-1763277,1763319-1763320,17

Re: svn commit: r1838163 - in /tomcat/trunk/java/org/apache/tomcat/util/net: AprEndpoint.java SocketWrapperBase.java

2018-08-16 Thread Mark Thomas
On 16/08/18 09:55, ma...@apache.org wrote:
> Author: markt
> Date: Thu Aug 16 08:55:55 2018
> New Revision: 1838163
> 
> URL: http://svn.apache.org/viewvc?rev=1838163&view=rev
> Log:
> Rename methods and expand comments to make the code easier to follow.
> Add some TODOs where it appears further work is required.

This is the start of the clean-up I mentioned in the context of the
HTTP/2 + async thread.

My plan was to clean-up the SocketWrapper layer before working up the
stack. BZ 62628 has thrown a small spanner in the works so I'll probably
detour to look at that first before coming back to the various TODOs
I've just added and then think about moving up the stack.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 62626] Tomcat 9.0.10 APR/Native crashes

2018-08-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62626

--- Comment #5 from jan.pfei...@centrum.cz ---
With NIO2 + OpenSSL no crash so far. No problems detected. Except it cames with
new set of client abort IO exceptions:

"The specified network name is no longer available" and "An existing connection
was forcibly closed by the remote host".

Are there any generic way to detect it? I was forced to enclose stream.write()
to its own try/catch and swallow any IOException it produces.

To our problem: I cant see any other way how to find culprit on my side. Some
kind of stress test would propably trigger it, but with the same result we have
now. I guess it is still related to image serving part as it is only "complex"
part of webapp. Crawlers and "image thieves" spams it a lot. There can be let
say 50 request per second, sometimes for same image, sometimes all ends with
some kind of "client abort exception".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1838188 - in /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java FairBlockingQueue.java MultiLockFairBlockingQueue.java interceptor/StatementFin

2018-08-16 Thread fschumacher
Author: fschumacher
Date: Thu Aug 16 11:01:13 2018
New Revision: 1838188

URL: http://svn.apache.org/viewvc?rev=1838188&view=rev
Log:
Use isEmpty instead of size on collections to test for emptiness

Modified:

tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java

tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java

tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java

Modified: 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1838188&r1=1838187&r2=1838188&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
 Thu Aug 16 11:01:13 2018
@@ -387,8 +387,8 @@ public class ConnectionPool {
 }
 
 /* release all idle connections */
-BlockingQueue pool = 
(idle.size()>0)?idle:(force?busy:idle);
-while (pool.size()>0) {
+BlockingQueue pool = 
(!idle.isEmpty())?idle:(force?busy:idle);
+while (!pool.isEmpty()) {
 try {
 //retrieve the next connection
 PooledConnection con = pool.poll(1000, TimeUnit.MILLISECONDS);
@@ -399,7 +399,7 @@ public class ConnectionPool {
 release(con);
 else
 abandon(con);
-if (pool.size()>0) {
+if (!pool.isEmpty()) {
 con = pool.poll(1000, TimeUnit.MILLISECONDS);
 } else {
 break;
@@ -410,7 +410,7 @@ public class ConnectionPool {
 Thread.currentThread().interrupt();
 }
 }
-if (pool.size()==0 && force && pool!=busy) pool = busy;
+if (pool.isEmpty() && force && pool!=busy) pool = busy;
 }
 if (this.getPoolProperties().isJmxEnabled()) this.jmxPool = null;
 PoolProperties.InterceptorDefinition[] proxies = 
getPoolProperties().getJdbcInterceptorsAsArray();
@@ -980,7 +980,7 @@ public class ConnectionPool {
  */
 public void checkAbandoned() {
 try {
-if (busy.size()==0) return;
+if (busy.isEmpty()) return;
 Iterator locked = busy.iterator();
 int sto = getPoolProperties().getSuspectTimeout();
 while (locked.hasNext()) {
@@ -1027,7 +1027,7 @@ public class ConnectionPool {
 public void checkIdle(boolean ignoreMinSize) {
 
 try {
-if (idle.size()==0) return;
+if (idle.isEmpty()) return;
 long now = System.currentTimeMillis();
 Iterator unlocked = idle.iterator();
 while ( (ignoreMinSize || 
(idle.size()>=getPoolProperties().getMinIdle())) && unlocked.hasNext()) {
@@ -1072,7 +1072,7 @@ public class ConnectionPool {
  */
 public void testAllIdle() {
 try {
-if (idle.size()==0) return;
+if (idle.isEmpty()) return;
 Iterator unlocked = idle.iterator();
 while (unlocked.hasNext()) {
 PooledConnection con = unlocked.next();
@@ -1413,7 +1413,7 @@ public class ConnectionPool {
 cleaner.cancel();
 if (poolCleanTimer != null) {
 poolCleanTimer.purge();
-if (cleaners.size() == 0) {
+if (cleaners.isEmpty()) {
 poolCleanTimer.cancel();
 poolCleanTimer = null;
 }

Modified: 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java?rev=1838188&r1=1838187&r2=1838188&view=diff
==
--- 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
 Thu Aug 16 11:01:13 2018
@@ -96,7 +96,7 @@ public class FairBlockingQueue implem
 ExchangeCountDownLatch c = null;
 try {
 //check to see if threads are waiting for an object
-if (waiters.size() > 0) {
+if (!waiters.isEmpty()) {
 //if threads are waiting grab the latch for that thread
 c = waiters.poll();
 //give the 

svn commit: r1838189 - in /tomcat/tc8.5.x/trunk: ./ modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/

2018-08-16 Thread fschumacher
Author: fschumacher
Date: Thu Aug 16 11:03:13 2018
New Revision: 1838189

URL: http://svn.apache.org/viewvc?rev=1838189&view=rev
Log:
Use isEmpty instead of size on collections to test for emptiness

Modified:
tomcat/tc8.5.x/trunk/   (props changed)

tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java

tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java

tomcat/tc8.5.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java

Propchange: tomcat/tc8.5.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 16 11:03:13 2018
@@ -1,2 +1,2 @@
 /tomcat/tc8.0.x/trunk:1809644
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737903,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175,1738261,1738589,1738623-1738625,1738643,1738816,1738850,1738855,1738946-1738948,1738953-1738954,1738979,1738982,1739079-1739081,1739087,1739113,1739153,1739172,1739176,1739191,1739474,1739492,1739726,1739762,1739775,1739814,1739817-1739818,1739975,1740131,1740324,1740465,1740495,1740508-1740509,1740520,1740535,1740707,1740803,1740810,1740969,1740980,1740991,1740997,1741015,1741033,1741036,1741058,1741060,1741080,1741147,1741159,1741164,1741173,1741181,1741190,1741197,1741202,1741208,1741213,1741221,1741225,1741232,1741409
 
,1741501,1741677,1741892,1741896,1741984,1742023,1742042,1742071,1742090,1742093,1742101,1742105,1742111,1742139,1742146,1742148,1742166,1742181,1742184,1742187,1742246,1742248-1742251,1742263-1742264,1742268,1742276,1742369,1742387,1742448,1742509-1742512,1742917,1742919,1742933,1742975-1742976,1742984,1742986,1743019,1743115,1743117,1743124-1743125,1743134,1743425,1743554,1743679,1743696-1743698,1743700-1743701,1744058,1744064-1744065,1744125,1744149,1744194,1744229,1744270,1744323,1744432,1744684,1744697,1744705,1744713,1744760,1744786,1745083,1745142-1745143,1745145,1745177,1745179-1745180,1745227,1745248,1745254,1745337,1745467,1745473,1745535,1745576,1745735,1745744,1746304,1746306-1746307,1746319,1746327,1746338,1746340-1746341,1746344,1746427,1746441,1746473,1746490,1746492,1746495-1746496,1746499-1746501,1746503-1746507,1746509,1746549,1746551,1746554,1746556,1746558,1746584,1746620,1746649,1746724,1746939,1746989,1747014,1747028,1747035,1747210,1747225,1747234,1747253,1747
 
404,1747506,1747536,1747924,1747980,1747993,1748001,1748253,1748452,1748547,1748629,1748676,1748715,1749287,1749296,1749328,1749373,1749465,1749506,1749508,1749665-1749666,1749763,1749865-1749866,1749898,1749978,1749980,1750011,1750015,1750056,1750480,1750617,1750634,1750692,1750697,1750700,1750703,1750707,1750714,1750718,1750723,1750774,1750899,1750975,1750995,1751061,1751097,1751173,1751438,1751447,1751463,1751702,1752212,1752737,1752745,1753078,1753080,1753358,1753363,1754111,1754140-1754141,1754281,1754310,1754445,1754467,1754494,1754496,1754528,1754532-1754533,1754613,1754714,1754874,1754941,1754944,1754950-1754951,1755005,1755007,1755009,1755132,1755180-1755181,1755185,1755190,1755204-1755206,1755208,1755214,1755224,1755227,1755230,1755629,1755646-1755647,1755650,1755653,1755675,1755680,1755683,1755693,1755717,1755731-1755737,1755812,1755828,1755884,1755890,1755918-1755919,1755942,1755958,1755960,1755970,1755993,1756013,1756019,1756039,1756056,1756083-1756114,1756175,1756288-1
 
756289,1756408-1756410,1756778,1756798,1756878,1756898,1756939,1757123-1757124,1757126,1757128,1757132-1757133,1757136,1757145,1757167-1757168,1757175,1757180,1757182,1757195,1757271,1757278,1757347,1757353-1757354,1757363,1757374,1757399,1757406,1757408,1757485,1757495,1757499,1757527,1757578,1757684,1757722,1757727,1757790,1757799,1757813,1757853,1757883,1757903,1757976,1757997,1758000,1758058,1758072-1758075,1758078-1758079,1758223,1758257,1758261,1758276,1758292,1758369,1758378-1758383,1758421,1758423,1758425-1758427,1758430,1758443,1758448,1758459,1758483,1758486-1758487,1758499,1758525,1758556,1758580,1758582,1758584,1758588,1758842,1759019,1759212,1759224,1759227,1759252,1759274,1759513-1759516,1759611,1759757,1759785-1759790,1760005,1760022,1760109-1760110,1760135,1760200-1760201,1760227,1760300,1760397,1760446,1760454,1760640,1760648,1761057,1761422,1761491,1761498,1761500-1761501,1761550,1761553,1761572,1761574,1761625-1761626,1761628,1761682,1761740,1761752,1762051-176205
 
3,1762123,1762168,1762172,1762182,1762201-1762202,176220

svn commit: r1838190 - in /tomcat/tc7.0.x/trunk: ./ modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/

2018-08-16 Thread fschumacher
Author: fschumacher
Date: Thu Aug 16 11:05:04 2018
New Revision: 1838190

URL: http://svn.apache.org/viewvc?rev=1838190&view=rev
Log:
Use isEmpty instead of size on collections to test for emptiness

Modified:
tomcat/tc7.0.x/trunk/   (props changed)

tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java

tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java

tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/MultiLockFairBlockingQueue.java

tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java

Propchange: tomcat/tc7.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 16 11:05:04 2018
@@ -1,3 +1,3 @@
 
/tomcat/tc8.0.x/trunk:1636525,1637336,1637685,1637709,1638726,1640089,1640276,1640349,1640363,1640366,1640642,1640672,1640674,1640689,1640884,1641001,1641065,1641067,1641375,1641638,1641723,1641726,1641729-1641730,1641736,1641988,1642669-1642670,1642698,1642701,1643205,1643215,1643217,1643230,1643232,1643273,1643285,1643329-1643330,1643511,1643513,1643521,1643539,1643571,1643581-1643582,1643635,1643655,1643738,1643964,1644018,1644333,1644525,1644954,1644992,1645014,1645360,1645456,1645627,1645642,1645686,1645903-1645904,1645908-1645909,1645913,1645920,1646458,1646460-1646462,1646735,1646738-1646741,1646744,1646746,1646748-1646755,1646757,1646759-1646760,1647043,1648816,1651420-1651422,1651844,1652926,1652939-1652940,1652973,1653798,1653817,1653841,1654042,1654161,1654736,1654767,1654787,1656592,1659907,1662986,1663265,1663278,1663325,1663535,1663567,1663679,1663997,1664175,1664321,1664872,1665061,1665086,1666027,1666395,1666503,1666506,1666560,1666570,1666581,1666759,1666967,1666988
 
,1667553-1667555,1667558,1667617,1667633,1667637,1667747,1667767,1667873,1668028,1668137,1668634,1669432,1669801,1669840,1669895-1669896,1670398,1670435,1670592,1670605-1670607,1670609,1670632,1670720,1670725,1670727,1670731,1671114,1672273,1672285,1673759,1674220,1674295,1675469,1675488,1675595,1675831,1676232,1676367-1676369,1676382,1676394,1676483,1676556,1676635,1678178,1679536,1679988,1680256,1681124,1681182,1681703,1681730,1681840,1681864,1681869,1682010,1682034,1682047,1682052-1682053,1682062,1682064,1682070,1682312,1682325,1682331,1682386,1684367,1684385,1685759,1685774,1685827,1685892,1687341,1688904,1689358,1689657,1689921,1692850,1693093,1693108,1693324,1694060,1694115,1694291,1694427,1694431,1694503,1694549,1694789,1694873,1694881,1695356,1695372,1695823-1695825,1696200,1696281,1696379,1696468,1700608,1700871,1700897,1700978,1701094,1701124,1701608,1701668,1701676,1701766,1701944,1702248,1702252,1702314,1702390,1702723,1702725,1702728,1702730,1702733,1702735,1702737,1702
 
739,1702742,1702744,1702748,1702751,1702754,1702758,1702760,1702763,1702766,1708779,1708782,1708806,1709314,1709670,1710347,1710442,1710448,1710490,1710574,1710578,1712226,1712229,1712235,1712255,1712618,1712649,1712655,1712860,1712899,1712903,1712906,1712913,1712926,1712975,1713185,1713262,1713287,1713613,1713621,1713872,1713976,1713994,1713998,1714004,1714013,1714059,1714538,1714580,1715189,1715207,1715544,1715549,1715637,1715639-1715645,1715667,1715683,1715866,1715978,1715981,1716216-1716217,1716355,1716414,1716421,1717208-1717209,1717257,1717283,1717288,1717291,1717421,1717517,1717529,1718797,1718840-1718843,1719348,1719357-1719358,1719400,1719491,1719737,1720235,1720396,1720442,1720446,1720450,1720463,1720658-1720660,1720756,1720816,1721813,1721818,1721831,1721861,1721867,1721882,1722523,1722527,1722800,1722926,1722941,1722997,1723130,1723440,1723488,1723890,1724434,1724674,1724792,1724803,1724902,1725128,1725131,1725154,1725167,1725911,1725921,1725929,1725963-1725965,1725970,1
 
725974,1726171-1726173,1726175,1726179-1726182,1726190-1726191,1726195-1726200,1726203,1726226,1726576,1726630,1726992,1727029,1727037,1727671,1727676,1727900,1728028,1728092,1728439,1728449,1729186,1729362,1731009,1731303,1731867,1731872,1731874,1731876,1731885,1731947,1731955,1731959,1731977,1731984,1732360,1732490,1732672,1732902,1733166,1733603,1733619,1733735,1733752,1733764,1733915,1733941,1733964,1734115,1734133,1734261,1734421,1734531,1736286,1737967,1738173,1738182,1738992,1739039,1739089-1739091,1739294,1739777,1739821,1739981,1740513,1740726,1741019,1741162,1741217,1743647,1743681,1744152,1744272,1746732,1746750,1752739,1754615,1755886,1756018,1758563,1759565,1761686,1762173,1762206,1766280,1767507-1767508,1767653,1767656,1769267,1772949,1773521,1773527,1774104,1777015,1777213,1779330,1783151,1784188,1784966,1785670,1786846,1788260,1788999,1789140,1789402,1791529,1791559,1795291,1796906,1797523,1799214,1800998-1800999,1801003,1801007-1801008,1801017,1801020,1802808,180281
 
4,1803618,1806107,1806733,1807082-1807083,1808707,1808884,1809267,1809644,1809832,1809

Re: [VOTE] Release Apache Tomcat 9.0.11

2018-08-16 Thread Violeta Georgieva
Hi,

На сб, 11.08.2018 г. в 23:32 ч. Mark Thomas  написа:
>
> The proposed Apache Tomcat 9.0.11 release is now available for voting.
>
> The major changes compared to the 9.0.10 release are:
>
> - Fix issues with Servlet asynchronous listeners when using the
>   asynchronous Servlet API in conjunction with HTTP/2.
>
> - Add a default location for the native library: ${catalina.home}/bin
>
> - Make the Jasper (JSP Engine) Java file generation process
>   multi-threaded. By default, one thread will be used per core.
>   Based on a patch by Dan Fabulich.
>
>
> Along with lots of other bug fixes and improvements.
>
> For full details, see the changelog:
> http://svn.apache.org/repos/asf/tomcat/trunk/webapps/docs/changelog.xml
>
> It can be obtained from:
> https://dist.apache.org/repos/dist/dev/tomcat/tomcat-9/v9.0.11/
> The Maven staging repo is:
> https://repository.apache.org/content/repositories/orgapachetomcat-1191/
> The svn tag is:
> http://svn.apache.org/repos/asf/tomcat/tags/TOMCAT_9_0_11/
>
> The proposed 9.0.11 release is:
> [ ] Broken - do not release
> [X] Stable - go ahead and release as 9.0.11

+1

Regards,
Violeta


[Bug 62626] Tomcat 9.0.10 APR/Native crashes

2018-08-16 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62626

--- Comment #6 from Christopher Schultz  ---
(In reply to jan.pfeifer from comment #5)
> With NIO2 + OpenSSL no crash so far. No problems detected. Except it comes
> with new set of client abort IO exceptions:
> 
> "The specified network name is no longer available" and "An existing
> connection was forcibly closed by the remote host".

This is actually what I was hoping to see happen.

tcnative is ... the bare minimum code to get things working; it doesn't have a
huge amount of robustness especially when it comes to all the weird
possibilities when a network connection is involved.

The fact that NIO is telling you that things are in a bad state means that it's
actually true: the bug in tcnative that causes this crash is merely bad
error-handling and not just tcnative not being able to push bytes around. That
bad error-handling can probably be fixed with enough analysis and maybe some
trial-and-error testing on your end (if you are willing to be a guinea pig).

But the fact remains: something "bad" is really happening with your clients
and/or your network and that is the true source of the problem.

> Are there any generic way to detect it? I was forced to enclose
> stream.write() to its own try/catch and swallow any IOException it produces.

That's kind of par for the course, isn't it? Any IO operation can fail for any
reason. If you don't catch it and handle it, Tomcat will (eventually) log it.
What else did you expect to happen?

> To our problem: I cant see any other way how to find culprit on my side.
> Some kind of stress test would probably trigger it, but with the same result
> we have now. I guess it is still related to image serving part as it is only
> "complex" part of webapp. Crawlers and "image thieves" spams it a lot. There
> can be let say 50 request per second, sometimes for same image, sometimes
> all ends with some kind of "client abort exception".

A "client abort" exception happens when the client makes a request and then
hangs-up the phone before you complete the response. It's fairly common and I
wouldn't really expect tcnative to crash under that circumstance, but it's
certainly possible.

In general, ClientAbortExceptions can safely be completely ignored, so don't
worry too much about the fact that they are happening. On a busy site with
large responses (e.g. images) I'd expect lots of them.

Let's keep this BZ issue open and continue to talk about the Java + native
stack traces you have and try to get this resolved. ERROR_ACCESS_VIOLATION is
the same as a segfault (basically null-pointer exception and/or
use-after-free). In this case, it looks like dereferencing a pointer which
probably isn't a pointer (its value is way too low to be valid).

Can you try one more thing for me? Downgrade to Java 1.8.0_whatever and revert
your configuration to use APR+tcnative again and let us know if the crashes
(actual segfaults that kill the JVM) continue.

But let's take your ClientAbortException stuff onto the user list to see if we
can't find maybe some more efficient ways to get your images generated. That
synchronized block looks suspicious to me, and creating new threads all the
time is likely to lead to instability.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org