[ 
https://issues.apache.org/jira/browse/CXF-8946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17777500#comment-17777500
 ] 

Sebastian Violet edited comment on CXF-8946 at 10/19/23 11:33 PM:
------------------------------------------------------------------

My apologies for not giving the command to run the program.
{code:bash}
mvn clean install spring-boot:run{code}
You can have a simple Express js application that serves the request of the 
JAX-RS client. In may case, it looks something like so:
{code:javascript}
const express = require('express');
const app = express();
const port = 9899;

const bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({ extended: true }));

app.post('/status', (req, res) => {
  res.setHeader('Content-Type', 'application/json');
  // res.send(501, '{"status": "bad"}');
  // res.send(404, '{"status": "bad"}');
  // res.send(200, '{"status": "ok"}');
  res.send(204, '');
});

var server = app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
})

server.keepAliveTimeout = 1200 * 1000;
{code}

And the script to run the load against the SpringBoot app is here: 
[^call_mem_leak.sh]

You can execute it like so:
{code:java}
./call_mem_leak.sh -c 50000 {code}
 
P.S. I have updated the code from above to contain a README.md file for these 
instructions.
 


was (Author: JIRAUSER302659):
My apologies for not giving the command to run the program.
{code:bash}
mvn clean install spring-boot:run{code}
You can have a simple Express js application that serves the request of the 
JAX-RS client. In may case, it looks something like so:
{code:javascript}
const express = require('express');
const app = express();
const port = 9899;

const bodyParser = require("body-parser");
app.use(bodyParser.urlencoded({ extended: true }));

app.post('/status', (req, res) => {
  res.setHeader('Content-Type', 'application/json');
  // res.send(501, '{"status": "bad"}');
  // res.send(404, '{"status": "bad"}');
  // res.send(200, '{"status": "ok"}');
  res.send(204, '');
});

var server = app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`);
})

server.keepAliveTimeout = 1200 * 1000;
{code}

And the script to run the load against the SpringBoot app is here: 
[^call_mem_leak.sh]

You can execute it like so:
{code:java}
./call_mem_leak.sh -c 50000 {code}
 

 

> HttpClient in CXF causing memory leak
> -------------------------------------
>
>                 Key: CXF-8946
>                 URL: https://issues.apache.org/jira/browse/CXF-8946
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 4.0.3
>            Reporter: Sebastian Violet
>            Priority: Major
>         Attachments: CXF-HTTPClient-MemoryLeak.zip, Screenshot 2023-10-19 at 
> 2.29.56 PM.png, call_mem_leak.sh, java_pid17394.hprof.zip, 
> java_pid17394_Leak_Suspects.zip, java_pid91652.0001.hprof.zip, 
> java_pid91652.0001_Leak_Suspects.zip, memory-leak-demo.zip
>
>
> When processing requests using the JAX RS client which used the new 
> HttpClient, there is a memory leak.
> We found this when running it in spring boot using
> {code:java}
> @Async{code}
>  
> I have tried to reproduce it using the attached code, and it seems to work 
> with a low heap size.
>  
> You can execute the code like so:
> {code:java}
> mvn compile exec:exec{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to