Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

[hold] Propagate user.home to subprocess #130

Closed
wants to merge 1 commit into from
Closed

Conversation

NatashaL
Copy link
Contributor

@NatashaL NatashaL commented Aug 3, 2018

When forking, the BigQuery client used by BigQueryContext looks for the local google cloud project, which is fetched following this priority of locations: https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java#L332

The last most alternative is reading from the local $HOME/.config/gcloud/ and if the preferred home folder location is not propagate properly, the subprocess ends up using the default home folder location https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java#L370

@NatashaL
Copy link
Contributor Author

NatashaL commented Aug 3, 2018

@labianchin
Copy link
Contributor

Makes sense. This seems related to #101 . As a follow up of this PR, I wonder if we should consider passing more/all java properties to the subprocess.

@NatashaL NatashaL changed the title Propagate user.home to subprocess [hold] Propagate user.home to subprocess Aug 3, 2018
@NatashaL
Copy link
Contributor Author

NatashaL commented Aug 3, 2018

Ah it seems precisely because checking $HOME is the very last step in trying to get the gcp project, it's still not enough when trying to run on a remote gcp server - it then probably gets the gcp project it's running in after all https://github.com/GoogleCloudPlatform/google-cloud-java/blob/master/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/ServiceOptions.java#L449

@NatashaL
Copy link
Contributor Author

NatashaL commented Aug 3, 2018

As @danielnorberg mentions here #101, maybe this should be configurable per task or per context

@danielnorberg
Copy link
Contributor

I don’t understand this. Afaik java defaults the system propertyuser.home to be $HOME and no manual propagation should be necessary.

If manual propagation is indeed necessary we should have tests verifying the desired effect.

@labianchin
Copy link
Contributor

I don’t understand this. Afaik java defaults the system propertyuser.home to be $HOME and no manual propagation should be necessary.

I think this might be some behavior from distroless java. From experience setting HOME env var has no effect on java user.home property.

@danielnorberg
Copy link
Contributor

But we’re not setting user.home in our code. And afaik distroless doesn’t either. So still doesn’t make sense to me.

@NatashaL
Copy link
Contributor Author

NatashaL commented Aug 3, 2018

Closing this after verifying flo.forking=false doesn't change the behaviour

@NatashaL NatashaL closed this Aug 3, 2018
@NatashaL NatashaL deleted the sys-props-forking branch August 10, 2018 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants