[
https://issues.apache.org/jira/browse/HDDS-5614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17401445#comment-17401445
]
Tsz-wo Sze commented on HDDS-5614:
----------------------------------
[~adoroszlai], thanks for pointing out the RequestScoped tag. I suspect that
it somehow not working. In the meantime, we will test it with the following
debug code.
{code}
diff --git
a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
index 83809c3cb..fcdb3b534 100644
---
a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
+++
b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
@@ -27,6 +27,7 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.PrivilegedExceptionAction;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.io.Text;
@@ -59,6 +60,8 @@
private static final Logger LOG =
LoggerFactory.getLogger(OzoneClientProducer.class);
+ private static final AtomicInteger COUNT = new AtomicInteger();
+ private int id = COUNT.incrementAndGet();
private OzoneClient client;
@Inject
@@ -79,12 +82,17 @@
@Produces
public OzoneClient createClient() throws WebApplicationException,
IOException {
+ if (client != null) {
+ throw new AssertionError("client is non-null, id=" + id);
+ }
+ LOG.debug("create client {}", id);
client = getClient(ozoneConfiguration);
return client;
}
@PreDestroy
public void destroy() throws IOException {
+ LOG.debug("close client {}", id);
client.close();
}
{code}
> The OzoneClient in s3 endpoint is not closed correctly
> ------------------------------------------------------
>
> Key: HDDS-5614
> URL: https://issues.apache.org/jira/browse/HDDS-5614
> Project: Apache Ozone
> Issue Type: Bug
> Components: S3
> Reporter: Tsz-wo Sze
> Assignee: Tsz-wo Sze
> Priority: Major
>
> In [~kerneltime]'s S3 tests, we found that the close() method in
> EndpointBase.client, which is an OzoneClient, is never called.
> In OzoneClientProducer, client.close() is called in the destroy() method.
> However, the createClient() method keeps overwriting the "client" field. Only
> the last client will be closed.
> {code:java}
> //OzoneClientProducer.java
> @Produces
> public OzoneClient createClient() throws WebApplicationException,
> IOException {
> client = getClient(ozoneConfiguration);
> return client;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]