jinrongluo opened a new issue #368:
URL: https://github.com/apache/incubator-eventmesh/issues/368
EventMesh SDK's Http LiteConsumer is using HttpClient to make a RPC to
EventMesh Runtime. But the HttpClient is static and shared by all LiteConsumer
instances (as Class variable). There are two problems for using static variable
here:
1. when multiple LiteConsumer instances are sharing the same HttClient, when
one LiteConsumer shutdown(), the other LiteConsumer cannot make any RPC calls.
That's because shutdown() will invoke httpClient.close();
2. I also observed racing condition of using this HttpClient. That's
because the HttpClient is not close() and clean up its resource until
LiteConsumer.shutdown(). This HttpClient is managed by PooledHttpClientManager,
and it is meant to be used by multi-thread process, and needs to close() after
finishing using it.
To reproduce the racing condition issue. I slightly modify the
`eventmesh-test` project's
`org.apache.eventmesh.http.demo.sub.service.SubService` class, with the
followings
```
liteConsumer = new LiteConsumer(eventMeshClientConfig);
liteConsumer.start();
liteConsumer.subscribe(topicList, url);
Thread.sleep(30000);
liteConsumer.unsubscribe(topicList, url);
Thread.sleep(30000);
liteConsumer.subscribe(topicList, url);
Thread.sleep(30000);
liteConsumer.unsubscribe(topicList, url);
```
The relevent log is attach in a file
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]