tty-command: fatal: No live threads left. Deadlock?

Does TTY::Command use threads in some way? It looks like it does, and as odd as it seems, I think it may be responsible for some very strange and hard to reproduce fatal: No live threads left. Deadlock? exceptions I’ve started getting in my app since introducing TTY::Command.

Could it be causing a deadlock somehow? Any ideas?

The backtrace looks like:

[GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command/process_runner.rb:128 :in `join`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command/process_runner.rb:128 :in `block in read_streams`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command/process_runner.rb:127 :in `each`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command/process_runner.rb:127 :in `read_streams`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command/process_runner.rb:45 :in `run!`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command.rb:174 :in `block in execute_command`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command.rb:174 :in `synchronize`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command.rb:174 :in `execute_command`
 [GEM_ROOT]/gems/tty-command-0.6.0/lib/tty/command.rb:94 :in `run`
[PROJECT_ROOT]/app/services/chf/create_dzi_service.rb:123 :in `block in create_dzi!`

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@jrochkind sorry, this is embarrassing. Got my ass kicked by flu bug and haven’t looked at this code for a while. I’m really hoping to release version this weekend. Let’s hope heavens will provide 😄

As as side effect of tty components getting more popular, I get sidetracked by important issues. As much as I wanted to finish work on this last week, I needed to fix tty-screen that is used by kontena.io in their CLI tool among other tty components. I also found out that fastlane is using this component as well. So I felt I needed to prioritise that component over this. I feel super stoked that people are using tty libs more and more! (that was elaborate excuse, don’t you think? 😄 )

I’ve stripped all the thread synchronization out. There is no need for it, as there should not be any contention for resources on Ruby level. I thought about what you have indicated about buffers filling up on the system level, and as a solution will try to make sure that the writes are non-blocking to potentially prevent readers waiting. Once happy, which will definitely be this week, I will release a new version for you to try out. Thanks for your patience.