Repository navigation
[java-datastore] Starting LocalDatastoreHelper stalls if beta gcloud component is not installed #12002
Copy link
Copy link
Open
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.lang: javaIssues specific to Java.Issues specific to Java.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.status: blockedResolving the issue is dependent on other work.Resolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Environment details
- OS type and version: Debian GNU/Linux 10 (buster) (on Docker)
- Java version: openjdk version "1.8.0_275"
- datastore version(s): com.google.cloud:google-cloud-datastore:jar:1.105.0
Steps to reproduce
- Remove
betacomponent:gcloud components remove beta - Run the code which uses
LocalDatastoreHelper
Code example
import com.google.cloud.datastore.testing.LocalDatastoreHelper;
public class Test {
public static void main(String[] args) throws Exception {
LocalDatastoreHelper emulator = LocalDatastoreHelper.create();
emulator.start();
System.out.println("Started!");
}
}How I found this
- Removed
betacomponent
root@17224e8a6010:/app# gcloud components remove beta --quiet
┌──────────────────────────────────────────┐
│ These components will be removed. │
├──────────────────────┬────────────┬──────┤
│ Name │ Version │ Size │
├──────────────────────┼────────────┼──────┤
│ gcloud Beta Commands │ 2019.05.17 │ │
└──────────────────────┴────────────┴──────┘
...
Uninstall done!
- Run code example, then it stalls.
root@17224e8a6010:/app# mvn exec:java -Dexec.mainClass=Test
Ctrl+Zand runpsto find out what command is executed via LocalDatastoreHelper
^Z
[1]+ Stopped mvn exec:java -Dexec.mainClass=Test
root@17224e8a6010:/app# ps -ef
...
root 1840 1795 0 17:40 pts/1 00:00:00 python2 -S /root/google-cloud-sdk/lib/gcloud.py beta emulators datastore start --host-port=localhost:40079 --consistency=0.9
- Execute the same command at the terminal, then it prompts whether continue to install
betacomponent
root@17224e8a6010:/app# python2 -S /root/google-cloud-sdk/lib/gcloud.py beta emulators datastore start --host-port=localhost:40079 --consistency=0.9
You do not currently have this command group installed. Using it
requires the installation of components: [beta]
Your current Cloud SDK version is: 322.0.0
Installing components from version: 322.0.0
┌─────────────────────────────────────────────┐
│ These components will be installed. │
├──────────────────────┬────────────┬─────────┤
│ Name │ Version │ Size │
├──────────────────────┼────────────┼─────────┤
│ gcloud Beta Commands │ 2019.05.17 │ < 1 MiB │
└──────────────────────┴────────────┴─────────┘
For the latest full release notes, please visit:
https://cloud.google.com/sdk/release_notes
Do you want to continue (Y/n)?
Possible solution
Add --quiet option to run emulator, so as to silently install beta component.
pomu0325/java-datastore@e2cb8f2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.lang: javaIssues specific to Java.Issues specific to Java.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.status: blockedResolving the issue is dependent on other work.Resolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
crwilcox commentedon Jul 22, 2021
It seems the issue here is likely that the process is blocking on https://github.com/googleapis/java-datastore/blob/master/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java#L273
which never occurs as the components aren't present.
Perhaps this method https://github.com/googleapis/java-core/blob/375983090b3700b3fb6a1953626db7efca49cc51/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java#L94 needs a timeout?
8 remaining items
meredithslota commentedon Oct 10, 2022
@prash-mi Can you or @jainsahab take a look?
[-]Starting LocalDatastoreHelper stalls if `beta` gcloud component is not installed[/-][+][java-datastore] Starting LocalDatastoreHelper stalls if `beta` gcloud component is not installed[/+]