Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetching metadata on VMs with pre-defined user-data of Alibaba Cloud causing a never-end recursion, maybe other Cloud Service Providers are affected too #1765

Open
ETiV opened this issue Aug 10, 2022 · 1 comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.

Comments

@ETiV
Copy link
Contributor

ETiV commented Aug 10, 2022

Description

The content of user-data API should be stored properly, not to be continuously requested line by line.

On Alibaba Cloud, the user-data API (URL: http://100.100.100.200/2016-01-01/user-data ) responds the cloud-init config file in a multi-lined plain text way, and the first line is #cloud-config( or #!/bin/bash ) , which caused the URL will be requested later becomes http://100.100.100.200/2016-01-01/user-data/#cloud-config, the metadata API will respond the same content as before, so the recursion will never end.

Ohai Version

I'm using GitLab: GitLab (latest, 15.2.2) -> chef (17.10.0) -> ohai (17.9.0)

Platform Version

VMs on Alibaba Cloud, but I think those Clouds having the same user-data responding logic will have the same issue.

Ohai Output

I'm sorry I'll put the output of GitLab here.

WARN: Plugin Alibaba threw exception #<SystemStackError: stack level too deep> /opt/gitlab/embedded/lib/ruby/2.7.0/net/protocol.rb:277:in `block in write0'

/opt/gitlab/embedded/lib/ruby/2.7.0/net/protocol.rb:275:in `each'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/protocol.rb:275:in `each_with_index'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/protocol.rb:275:in `write0'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/protocol.rb:248:in `block in write'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/protocol.rb:265:in `writing'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/protocol.rb:247:in `write'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/http/generic_request.rb:335:in `write_header'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/http/generic_request.rb:129:in `exec'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/http.rb:1521:in `block in transport_request'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/http.rb:1519:in `catch'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/http.rb:1519:in `transport_request'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/http.rb:1492:in `request'
/opt/gitlab/embedded/lib/ruby/2.7.0/net/http.rb:1241:in `get'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:38:in `http_get'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:42:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/plugins/alibaba.rb:64:in `block (2 levels) in <main>'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin/versionvii.rb:139:in `instance_eval'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin/versionvii.rb:139:in `run_plugin'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin.rb:115:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin.rb:200:in `safe_run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/runner.rb:99:in `run_v7_plugin'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/runner.rb:57:in `block in run_plugin'
/opt/gitlab/embedded/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/runner.rb:50:in `run_plugin'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/system.rb:131:in `block in run_plugins'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/system.rb:130:in `each'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/system.rb:130:in `run_plugins'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/ohai-17.9.0/lib/ohai/system.rb:105:in `all_plugins'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/client.rb:589:in `run_ohai'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/client.rb:256:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/application.rb:305:in `run_with_graceful_exit_option'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/application.rb:281:in `block in run_chef_client'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/local_mode.rb:42:in `with_server_connectivity'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/application.rb:264:in `run_chef_client'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/application/base.rb:352:in `run_application'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-17.10.0/lib/chef/application.rb:67:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/chef-bin-17.10.0/bin/cinc-client:25:in `<top (required)>'
/opt/gitlab/embedded/bin/cinc-client:23:in `load'
/opt/gitlab/embedded/bin/cinc-client:23:in `<main>'
@ETiV ETiV added Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected. labels Aug 10, 2022
@sagehou
Copy link

sagehou commented Jul 24, 2023

Same issue.

# Logfile created on 2023-07-19 01:15:14 +0800 by logger.rb/v1.4.3
[2023-07-19T01:15:14+08:00] INFO: Started Cinc Zero at chefzero://localhost:1 with repository at /opt/gitlab/embedded (One version per cookbook)
[2023-07-19T01:15:14+08:00] INFO: *** Cinc Client 17.10.0 ***
[2023-07-19T01:15:14+08:00] INFO: Platform: x86_64-linux
[2023-07-19T01:15:14+08:00] INFO: Cinc-client pid: 29126
[2023-07-19T01:25:23+08:00] WARN: Plugin Alibaba threw exception #<SystemStackError: stack level too deep> /opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-pro
tocol-0.1.3/lib/net/protocol.rb:279:in `block in write0'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:277:in `each'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:277:in `each_with_index'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:277:in `write0'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:250:in `block in write'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:267:in `writing'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:249:in `write'
/opt/gitlab/embedded/lib/ruby/3.0.0/net/http/generic_request.rb:335:in `write_header'
/opt/gitlab/embedded/lib/ruby/3.0.0/net/http/generic_request.rb:129:in `exec'
/opt/gitlab/embedded/lib/ruby/3.0.0/net/http.rb:1550:in `block in transport_request'
/opt/gitlab/embedded/lib/ruby/3.0.0/net/http.rb:1548:in `catch'
/opt/gitlab/embedded/lib/ruby/3.0.0/net/http.rb:1548:in `transport_request'
/opt/gitlab/embedded/lib/ruby/3.0.0/net/http.rb:1521:in `request'
/opt/gitlab/embedded/lib/ruby/3.0.0/net/http.rb:1270:in `get'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:38:in `http_get'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:42:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
......
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:52:in `block in fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `each'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/mixin/alibaba_metadata.rb:51:in `fetch_metadata'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/plugins/alibaba.rb:64:in `block (2 levels) in <main>'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin/versionvii.rb:139:in `instance_eval'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin/versionvii.rb:139:in `run_plugin'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin.rb:115:in `run'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/dsl/plugin.rb:200:in `safe_run'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/runner.rb:99:in `run_v7_plugin'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/runner.rb:57:in `block in run_plugin'
/opt/gitlab/embedded/lib/ruby/3.0.0/benchmark.rb:308:in `realtime'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/runner.rb:50:in `run_plugin'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/system.rb:131:in `block in run_plugins'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/system.rb:130:in `each'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/system.rb:130:in `run_plugins'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/ohai-17.9.0/lib/ohai/system.rb:105:in `all_plugins'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/client.rb:589:in `run_ohai'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/client.rb:256:in `run'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:305:in `run_with_graceful_exit_option'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:281:in `block in run_chef_client'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/local_mode.rb:42:in `with_server_connectivity'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:264:in `run_chef_client'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application/base.rb:352:in `run_application'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-17.10.0/lib/chef/application.rb:67:in `run'
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/chef-bin-17.10.0/bin/cinc-client:25:in `<top (required)>'
/opt/gitlab/embedded/bin/cinc-client:25:in `load'
/opt/gitlab/embedded/bin/cinc-client:25:in `<main>'
[2023-07-19T01:25:30+08:00] INFO: Setting the run_list to ["recipe[gitlab-ee]"] from CLI options
[2023-07-19T01:25:30+08:00] INFO: Run List is [recipe[gitlab-ee]]
[2023-07-19T01:25:30+08:00] INFO: Run List expands to [gitlab-ee]
[2023-07-19T01:25:30+08:00] INFO: Starting Cinc Client Run for gitlab
[2023-07-19T01:25:30+08:00] INFO: Running start handlers
[2023-07-19T01:25:30+08:00] INFO: Start handlers complete.
[2023-07-19T01:25:31+08:00] INFO: Loading cookbooks [[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected].
0, [email protected], [email protected], [email protected], [email protected], [email protected]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged. Type: Bug Does not work as expected.
Projects
None yet
Development

No branches or pull requests

2 participants