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

Added a patch for thread error(can't alloc thread (ThreadError).) #1955

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

nikhil2611
Copy link

@nikhil2611 nikhil2611 commented Dec 7, 2023

Description

Added a monkey patch fix for the below thread error coming up on windows nodes on the execution of the kitchen verify commands. This is coming up due to the current and main thread are in dead state.

Test Summary: 0 successful, 0 failures, 1 skipped Finished verifying <default-windows-2022-base1> (0m18.89s). -----> Test Kitchen is finished. (0m35.20s) /opt/chef-workstation/bin/kitchen: warning: Exception in finalizer #<Proc:0x000000011bf58a18 /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/winrm-2.3.6/lib/winrm/shells/power_shell.rb:33> /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:471:in new': can't alloc thread (ThreadError)
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:471:in create_with_logging_context' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:436:in new'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/timeout-0.3.2/lib/timeout.rb:101:in create_timeout_thread' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/timeout-0.3.2/lib/timeout.rb:134:in block in ensure_timeout_thread_created'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/timeout-0.3.2/lib/timeout.rb:132:in synchronize' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/timeout-0.3.2/lib/timeout.rb:132:in ensure_timeout_thread_created'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/timeout-0.3.2/lib/timeout.rb:181:in timeout' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:515:in query'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in query' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in do_get_block'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in block in do_request' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in protect_keep_alive_disconnected'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in do_request' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient.rb:856:in request'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/httpclient-2.8.3/lib/httpclient.rb:765:in post' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/winrm-2.3.6/lib/winrm/http/transport.rb:176:in send_request'
from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/winrm-2.3.6/lib/winrm/shells/power_shell.rb:42:in close_shell' from /opt/chef-workstation/embedded/lib/ruby/gems/3.1.0/gems/winrm-2.3.6/lib/winrm/shells/power_shell.rb:33:in block in finalize'`

Note- This warning is coming up in the stdout while executing kitchen verify command, though it is not effecting kitchen verify command execution. We have added a patch to fix this warning if the thread is in dead or sleep state.

Issues Resolved

chef/chef-workstation#3073

Check List

Signed-off-by: nikhil2611 <[email protected]>
@damacus damacus self-assigned this Dec 7, 2023
@damacus
Copy link
Contributor

damacus commented Dec 7, 2023

@nikhil2611 can you fix the ChefStyle warnings please, and ping me on here when that's done 👍🏼

Signed-off-by: nikhil2611 <[email protected]>
@nikhil2611
Copy link
Author

nikhil2611 commented Dec 7, 2023

@nikhil2611 can you fix the ChefStyle warnings please, and ping me on here when that's done 👍🏼

@damacus fixed the ChefStyle warnings. Done

@damacus damacus enabled auto-merge (squash) December 7, 2023 18:00
@damacus damacus disabled auto-merge December 7, 2023 18:00
@nikhil2611
Copy link
Author

hello @damacus , do anything else needed in this PR or we are good ? Thanks

@tas50
Copy link
Member

tas50 commented Dec 10, 2023

Why not just get this into the upstream project?

@nikhil2611
Copy link
Author

Why not just get this into the upstream project?

Hey @tas50 , I had created a PR in WinRM repository first - WinRb/WinRM#341. But Matt suggested if we could consider this rescuing higher up in the consuming application (kitchen).

@nikhil2611
Copy link
Author

Hey @damacus, any update on this ?

@mwrock
Copy link
Member

mwrock commented Jan 8, 2024

If we are confident this fixes the issue, I think the upstream PR is preferable. I'd just remove the rescue from that PR because that suppresses an error that should really be raised but I don't see that here so I'm assuming it is not necessary.

I've been fairly absent from ruby since well before 3.0 which might explain why I don't understand how a dead or sleeping ruby thread could be executing and I just wonder if there is a better way to address this. Telling myself to wakeup when I am asleep tends not to work in my personal experience but I guess it does in ruby? :)

@carlosaya
Copy link

hey guys, just wondering if this is the PR I should be following on this issue or if there is another one that I should keep an eye on instead? I see that WinRb/WinRM#341 was closed since @mwrock suggested fixing in the upstream application (kitchen?), but then in his most recent comment on this PR it sounds like he is referring to yet another upstream PR instead of this one to fix the problem.

I think the upstream PR is preferable. I'd just remove the rescue from that PR

Where is that other PR if it isn't this one? Thanks 🙏

@nikhil2611
Copy link
Author


Note- This warning is coming up in the stdout while executing kitchen verify command, though it is not effecting kitchen verify command execution. We have added a patch to fix this warning if the thread is in dead or sleep state.

Here is new PR raised for the same - WinRb/WinRM#342

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

Successfully merging this pull request may close these issues.

None yet

5 participants