GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unrecognized http status code: 411 when detaching disk via InstanceClient#detachDiskInstance · Issue #3735 · googleapis/google-cloud-java

Unrecognized http status code: 411 when detaching disk via InstanceClient#detachDiskInstance #3735

New issue
Copy link
New issue
Copy link
Closed
Closed
Unrecognized http status code: 411 when detaching disk via InstanceClient#detachDiskInstance#3735
Copy link
Assignees
andreamlin
Labels
🚨 criticalP0 critical issue. Requires immediate fixapi: computeIssues related to the Compute Engine API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: questionRequest for information or clarification. Not an issue.

Description

@kitsenky
kitsenky
opened on Sep 26, 2018
Issue body actions

When trying to detach disk via InstanceClient#detachDiskInstance the operation fails with the stacktrace

Sep 26, 2018 10:51:28 PM com.google.common.util.concurrent.AbstractFuture executeListener
SEVERE: RuntimeException while executing runnable com.google.common.util.concurrent.Futures$4@7b8f7c5c with executor MoreExecutors.directExecutor()
java.lang.IllegalArgumentException: Unrecognized http status code: 411
	at com.google.api.gax.httpjson.HttpJsonStatusCode.httpStatusToStatusCode(HttpJsonStatusCode.java:102)
	at com.google.api.gax.httpjson.HttpJsonExceptionCallable$ExceptionTransformingFuture.onFailure(HttpJsonExceptionCallable.java:99)
	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
	at com.google.common.util.concurrent.Futures$4.run(Futures.java:1123)
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435)
	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900)
	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811)
	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675)
	at com.google.api.core.AbstractApiFuture$InternalSettableFuture.setException(AbstractApiFuture.java:95)
	at com.google.api.core.AbstractApiFuture.setException(AbstractApiFuture.java:77)
	at com.google.api.core.SettableApiFuture.setException(SettableApiFuture.java:52)
	at com.google.api.gax.httpjson.HttpRequestRunnable.run(HttpRequestRunnable.java:145)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Activity

  1. kitsenky commented on Sep 27, 2018

    @kitsenky
    kitsenky
    on Sep 27, 2018
    Author
    More actions

    Actually every usage of InstanceClient#detachDiskInstance fails. Here is example of code that fails:

    import com.google.cloud.compute.v1.AttachedDiskInitializeParams;
    import com.google.cloud.compute.v1.Disk;
    import com.google.cloud.compute.v1.DiskClient;
    import com.google.cloud.compute.v1.Instance;
    import com.google.cloud.compute.v1.InstanceClient;
    import com.google.cloud.compute.v1.NetworkInterface;
    import com.google.cloud.compute.v1.Operation;
    import com.google.cloud.compute.v1.ProjectGlobalImageName;
    import com.google.cloud.compute.v1.ProjectGlobalNetworkName;
    import com.google.cloud.compute.v1.ProjectRegionSubnetworkName;
    import com.google.cloud.compute.v1.ProjectZoneDiskName;
    import com.google.cloud.compute.v1.ProjectZoneDiskTypeName;
    import com.google.cloud.compute.v1.ProjectZoneInstanceName;
    import com.google.cloud.compute.v1.ProjectZoneMachineTypeName;
    import com.google.cloud.compute.v1.ProjectZoneName;
    
    import java.io.IOException;
    import java.util.UUID;
    
    public class NewApiExample {
    
        private static String PROJECT = "YOUR_PROGECT";
        private static String REGION = "us-west1";
        private static String ZONE = "us-west1-a";
        private static String NETWORK = "YOUR_NETWORK";
        private static String SUBNET = "YOUR_SUBNETWORK";
        private static String IMAGE = "YOUR_UBUNTU_IMAGE";
        public static void main(String[] args) throws InterruptedException {
            String uuid = UUID.randomUUID().toString();
            long startAt =System.currentTimeMillis();
            try (InstanceClient instanceClient = InstanceClient.create(); DiskClient diskClient = DiskClient.create()) {
                System.out.println("Clients created in " + (System.currentTimeMillis() - startAt) + "ms.");
                ProjectZoneName zone = ProjectZoneName.of(PROJECT, ZONE);
                ProjectZoneMachineTypeName machineTypeName = ProjectZoneMachineTypeName
                    .of(String.format("custom-%s-%s", 4, 4 * 1024), PROJECT, ZONE);
                ProjectGlobalNetworkName networkName = ProjectGlobalNetworkName.of(NETWORK, PROJECT);
                ProjectRegionSubnetworkName subnetworkName = ProjectRegionSubnetworkName
                    .of(PROJECT, REGION, SUBNET);
                ProjectGlobalImageName imageName = ProjectGlobalImageName.of(IMAGE, PROJECT);
                NetworkInterface networkInterface = NetworkInterface.newBuilder()
                    .setNetwork(networkName.toString())
                    .setSubnetwork(subnetworkName.toString())
                    .build();
                AttachedDisk bootDisk = AttachedDisk.newBuilder()
                    .setAutoDelete(true)
                    .setBoot(true)
                    .setInitializeParams(AttachedDiskInitializeParams.newBuilder()
                        .setSourceImage(imageName.toString())
                        .setDiskSizeGb(String.valueOf(25))
                        .build())
                    .build();
    
                ProjectZoneInstanceName instanceName = ProjectZoneInstanceName
                    .of(String.format("test-api-instance-%s", uuid), PROJECT, ZONE);
    
                Instance instanceResource = Instance.newBuilder()
                    .setName(instanceName.getInstance())
                    .addNetworkInterfaces(networkInterface)
                    .setMachineType(machineTypeName.toString()) 
                    .addDisks(bootDisk)
                    .build();
                Operation op1 = instanceClient.insertInstance(zone, instanceResource);
                System.out.println(String.format("Instance created: %s", op1.toString()));
    
                ProjectZoneDiskTypeName diskTypeName = ProjectZoneDiskTypeName.of("pd-standard", PROJECT, ZONE);
                ProjectZoneDiskName diskName = ProjectZoneDiskName
                    .of(String.format("test-api-device-name-%s", uuid), PROJECT, ZONE);
    
                Disk disk = Disk.newBuilder()
                    .setName(diskName.getDisk())
                    .setSizeGb(String.valueOf(7))
                    .setType(diskTypeName.toString())
                    .build();
    
                Operation op2 = diskClient.insertDisk(zone, disk);
                System.out.println(String.format("Disk created: %s", op2.toString()));
                Thread.sleep(10000);
    
                AttachedDisk attachedDisk = AttachedDisk.newBuilder()
                    .setDeviceName(diskName.getDisk())
                    .setAutoDelete(false)
                    .setMode("READ_WRITE")
                    .setSource(diskName.toString())
                    .build();
                Operation op3 = instanceClient.attachDiskInstance(instanceName, false, attachedDisk);
                System.out.println(String.format("Disk attached: %s", op3.toString()));
                Thread.sleep(10000);
    
                System.out.println("----------------------------------------");
                System.out.println(String.format(
                    "After getting error you should manually delete instance %s and disk %s",
                    instanceName.getInstance(),
                    diskName.getDisk()
                ));
                System.out.println("----------------------------------------");
                //This operation fails
                Operation op4 = instanceClient.detachDiskInstance(instanceName, diskName.getDisk());
                System.out.println(String.format("Disk detached: %s", op4.toString()));
            } catch (IOException ex) {
                System.out.println(String.format("Error when creating clients %s", ex.getMessage()));
            }
        }
    
    }
    
  2. JustinBeckwith
    added
    triage meI really want to be triaged.
    on Sep 27, 2018
  3. yihanzhen
    added
    type: questionRequest for information or clarification. Not an issue.
    api: computeIssues related to the Compute Engine API.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Sep 27, 2018
  4. JustinBeckwith
    removed
    triage meI really want to be triaged.
    on Sep 27, 2018
  5. kitsenky commented on Oct 3, 2018

    @kitsenky
    kitsenky
    on Oct 3, 2018
    Author
    More actions

    It seems to be more a like bug in detach functionality of compute api v1 than a question.

  6. andreamlin
    self-assigned this
    on Oct 29, 2018
  7. cj-matti-niemenmaa commented on Jan 28, 2019

    @cj-matti-niemenmaa
    cj-matti-niemenmaa
    on Jan 28, 2019
    More actions

    The problem noted at JetBrains/teamcity-google-agent#27 (comment) seems to be the same thing, but with stopInstance. The commonality is that both are POST requests with an empty request body. Presumably, in such a case, the underlying HTTP client doesn't set the Content-Length header at all whereas the server requires it.

  8. andreamlin
    added
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    and removed
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Jan 29, 2019
  9. yoshi-automation
    added
    🚨 criticalP0 critical issue. Requires immediate fix
    on Jan 29, 2019
  10. andreamlin commented on Jan 29, 2019

    @andreamlin
    andreamlin
    on Jan 29, 2019
    Contributor
    More actions

    ack.

    Fix is probably just adding the content-length header to all requests. This fix will be added to the gax-java dependency.

    Thanks for triaging @matti-cujo

  11. andreamlin
    closed this as completedin gax-java#648on Jan 31, 2019
  12. suztomo
    added a commit that references this issue on Mar 9, 2026

    fix: Add labels to converter for listTables method (#3735) (#3736)

    8634822
  13. lqiu96
    added a commit that references this issue on Mar 20, 2026

    fix: Add labels to converter for listTables method (#3735) (#3736)

    c2743fc
  14. chingor13
    added a commit that references this issue on Mar 24, 2026

    chore: add jdk 8 verification to showcase CI (#3735)

    015bdfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @andreamlin
    andreamlin

Labels

🚨 criticalP0 critical issue. Requires immediate fixapi: computeIssues related to the Compute Engine API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.