Skip to content

Infinite recursion when KNAPSACK_PRO_LOG_LEVEL is set to debug #269

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

Open
dmytro-workday opened this issue Aug 15, 2024 · 2 comments
Open
Labels

Comments

@dmytro-workday
Copy link

dmytro-workday commented Aug 15, 2024

Hi,

We have set KNAPSACK_PRO_LOG_LEVEL=debug and KNAPSACK_PRO_LOG_DIR=log, which leads to the following backtrace:

[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] SystemStackError: stack level too deep (SystemStackError)
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:240:in `map'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:240:in `detected_ci'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:292:in `ci_env_for'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:282:in `env_for'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:20:in `ci_node_index'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro.rb:99:in `logger'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:285:in `env_for'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:20:in `ci_node_index'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro.rb:99:in `logger'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:285:in `env_for'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro/config/env.rb:20:in `ci_node_index'
[2024-08-15 12:56:16] [2024-08-15 12:56:16] [NODE=4] /builds/app/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-7.8.0/lib/knapsack_pro.rb:99:in `logger'

Seems like the issue is related to the following warnings, throws when the logging directory is not enabled:

You have set the environment variable KNAPSACK_PRO_CI_NODE_TOTAL to 36 which could be automatically determined from the CI environment as 9.
You have set the environment variable KNAPSACK_PRO_CI_NODE_INDEX to 1 which could be automatically determined from the CI environment as 0.

The configuration we used is similar to the FAQ answer here:

https://knapsackpro.com/faq/question/parallel_tests-with-knapsack_pro-on-parallel-ci-nodes

@ArturT ArturT added the bug label Aug 16, 2024
@ArturT
Copy link
Member

ArturT commented Aug 16, 2024

@dmytro-workday Could you work around the issue while we look into it? Or is this preventing you from using Knapsack Pro?

@dmytro-workday
Copy link
Author

dmytro-workday commented Aug 16, 2024

Yes. We have removed the _LOG_ variables for now and assigning the logger ourselves instead:

logger = Logger.new("log/knapsack_pro_node_#{KnapsackPro::Config::Env.ci_node_index}.log")
logger.level = ::Logger::DEBUG
KnapsackPro.logger = logger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants