Am 26.01.2017 12:09, schrieb Felix Schumacher:
Am 26. Januar 2017 09:02:55 MEZ schrieb [email protected]:
https://bz.apache.org/bugzilla/show_bug.cgi?id=60607

--- Comment #12 from Philippe Mouawad <[email protected]>
---
(In reply to Sean Chang from comment #10)
And some request failed due to file not found, but actually the file
is
there and succeed for some other requests.

java.io.FileNotFoundException: /home/cosben/cos_upload/2bill/200K.ts
(Too
many open files)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at org.apache.http.entity.FileEntity.getContent(FileEntity.java:88)
        at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.
sendEntityData(HTTPHC4Impl.java:1459)
        at

I think we are leaking file descriptors here. I will look into it.

You can see the fd leak, if you use httpclient 4 with PUT and a file from disk to upload. The attached patch should fix it. I will submit a bug this evening and commit the patch.

Felix


Felix


org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.
java:585)
        at

org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:
399)
        at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.
sample(HTTPSamplerProxy.java:74)
        at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.
sample(HTTPSamplerBase.java:1176)
        at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.
sample(HTTPSamplerBase.java:1165)
        at

org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.
java:473)
        at

org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:252)
        at java.lang.Thread.run(Thread.java:745)

This does not mean the file is not here, it means you reach a linux
limit on
file descriptors.
If you don't hit this with the other version of JMeter then it could be
a
jmeter issue but it's not sure.
https://easyengine.io/tutorials/linux/increase-open-files-limit/


1/ Run ulimit -a with the user that runs jmeter .
2/ How many threads are you running ?
Did you compare versions of JMeter with exactly the same script and
user.properties/jmeter.properties ?
Thank you
diff --git 
a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java 
b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
index 89591f4..8627ac0 100644
--- a/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
+++ b/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
@@ -20,6 +20,7 @@ package org.apache.jmeter.protocol.http.sampler;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
@@ -1455,10 +1456,12 @@ public class HTTPHC4Impl extends HTTPHCAbstractImpl {
             if(entityEntry.isRepeatable()) {
                 entityBody = new StringBuilder(1000);
                 // FIXME Charset
-                entityBody.append(IOUtils.toString(new BoundedInputStream(
-                        entityEntry.getContent(), MAX_BODY_RETAIN_SIZE)));
-                if (entityEntry.getContentLength() > MAX_BODY_RETAIN_SIZE) {
-                    entityBody.append("<actual file content shortened>");
+                try (InputStream in = entityEntry.getContent();
+                        InputStream bounded = new BoundedInputStream(in, 
MAX_BODY_RETAIN_SIZE)) {
+                    entityBody.append(IOUtils.toString(bounded));
+                    if (entityEntry.getContentLength() > MAX_BODY_RETAIN_SIZE) 
{
+                        entityBody.append("<actual file content shortened>");
+                    }
                 }
             }
             else { 

Reply via email to