SDK will deadlock for no apparent reason too!
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 243
- Forks
- 171
- Avg merge
- 30m
- Merged PRs (30d)
- 4
Description
Please see the corresponding code. After listShapes gets the result, all threads should be terminated. However, the line in the picture is still not destroyed. Continuous triggering will cause the server to freeze.
https://imgur.com/a/Ll4F8Q5
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common-httpclient-jersey</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-core</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-identity</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-bom</artifactId>
<version>3.42.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
public List<String> listShapes(String region, String domain) {
OciUtils ociUtils = new OciUtils(Region.valueOf(region), oracleConfig.getComptentId());
return ociUtils.listShapes(domain);
}
import com.oracle.bmc.ConfigFileReader;
import com.oracle.bmc.Region;
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
import com.oracle.bmc.core.ComputeClient;
import com.oracle.bmc.core.ComputeWaiters;
import com.oracle.bmc.core.VirtualNetworkClient;
import com.oracle.bmc.core.model.*;
import com.oracle.bmc.core.requests.*;
import com.oracle.bmc.core.responses.*;
import com.oracle.bmc.identity.IdentityClient;
import com.oracle.bmc.identity.model.AvailabilityDomain;
import com.oracle.bmc.identity.requests.ListAvailabilityDomainsRequest;
import com.oracle.bmc.identity.responses.ListAvailabilityDomainsResponse;
import com.oracle.bmc.workrequests.WorkRequestClient;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
public class OciUtils {
private ComputeClient computeClient;
private WorkRequestClient workRequestClient;
private ComputeWaiters computeWaiters;
private IdentityClient identityClient;
private VirtualNetworkClient virtualNetworkClient;
private String sshPubKeyFilePath;
private String compartentId;
private Region region;
private static final Logger OCI_MANAGER_LOGGER = LoggerFactory.getLogger("ociManagerAppender");
public OciUtils(Region region, String compartentId) {
this.compartentId = compartentId;
final ConfigFileReader.ConfigFile configFile;
try {
configFile = ConfigFileReader.parseDefault();
} catch (IOException e) {
throw new RuntimeException(e);
}
final AuthenticationDetailsProvider provider = new ConfigFileAuthenticationDetailsProvider(configFile);
this.computeClient = ComputeClient.builder().region(region).build(provider);
this.workRequestClient = WorkRequestClient.builder().build(provider);
workRequestClient.setRegion(region);
this.computeWaiters = computeClient.newWaiters(workRequestClient);
this.identityClient = IdentityClient.builder().build(provider);
identityClient.setRegion(region);
this.virtualNetworkClient = VirtualNetworkClient.builder().build(provider);
virtualNetworkClient.setRegion(region);
}
...
public List<String> listShapes(String domainName) {
List<String> shapesList = new ArrayList<>();
ListShapesRequest listShapesRequest = ListShapesRequest.builder().availabilityDomaindomainName).compartmentId(compartentId).build();
ListShapesResponse listShapesResponse = computeClient.listShapes(listShapesRequest);
List<Shape> shapes = listShapesResponse.getItems();
if (shapes.isEmpty()) {
throw new IllegalStateException("No available shape was found.");
}
for(Shape shape : shapes) {
shapesList.add(shape.getShape());
}
return shapesList;
}
}
I have tried : https://github.com/oracle/oci-java-sdk/issues/596 ,but this thread just haved.
ComputeClient.builder().clientConfigurator(builder -> {
builder.property(JerseyClientProperties.USE_APACHE_CONNECTOR, false);
}).region(region).build(provider);
ComputeClient.builder()..clientConfigurator(builder -> {
builder.property(JerseyClientProperties.APACHE_IDLE_CONNECTION_MONITOR_THREAD_ENABLED, false);
})...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing repeated calls to the shown OciUtils.listShapes entry point with the ComputeClient, using the listed OCI SDK dependencies and inspecting whether client threads remain after the response returns. Compare the behavior with the attempted connector and idle-monitor settings; done means the threads terminate and repeated calls no longer freeze the server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100