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

robe-start hangs #148

Closed
mcampbell opened this issue Mar 17, 2024 · 6 comments
Closed

robe-start hangs #148

mcampbell opened this issue Mar 17, 2024 · 6 comments

Comments

@mcampbell
Copy link

mcampbell commented Mar 17, 2024

First time user, so not sure if I've misconfigured it.

Env:

 ❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy

GNU Emacs 29.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2024-01-27

Steps:

  • (use-package robe) in *Scratch* (using straight.el)
(use-package robe)
;;; inf-ruby-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.

;; This file is part of GNU Emacs.

;;; Code:

(provide 'inf-ruby-autoloads)

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:

;;; inf-ruby-autoloads.el ends here
;;; robe-autoloads.el --- automatically extracted autoloads (do not edit)   -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.

;; This file is part of GNU Emacs.

;;; Code:

(provide 'robe-autoloads)

;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:

;;; robe-autoloads.el ends here
nil

CPU is normal. Feels like it's hung on i/o, not compute

rbspy dump:

❯ sudo ~/bin/rbspy snapshot --pid 521742
<main> - /home/mcampbell/.asdf/installs/ruby/3.1.2/bin/bundle:28
load [c function] - (unknown)
<top (required)> - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/exe/bundle:36
with_friendly_errors - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/friendly_errors.rb:128
block in <top (required)> - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/exe/bundle:49
start - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli.rb:28
start - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/base.rb:495
dispatch - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli.rb:35
dispatch - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor.rb:393
invoke_command - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/invocation.rb:129
run - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/vendor/thor/lib/thor/command.rb:37
console - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli.rb:517
run - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.25/lib/bundler/cli/console.rb:20
start - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb.rb:420
run - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb.rb:497
catch [c function] - (unknown)
block in run - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb.rb:492
eval_input - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb.rb:601
each_top_level_statement - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb/ruby-lex.rb:281
catch [c function] - (unknown)
block in each_top_level_statement - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb/ruby-lex.rb:280
loop [c function] - (unknown)
block (2 levels) in each_top_level_statement - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb/ruby-lex.rb:279
lex - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb/ruby-lex.rb:296
block in eval_input - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb.rb:553
signal_status - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb.rb:774
block (2 levels) in eval_input - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb.rb:552
gets - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/irb/input-method.rb:424
readmultiline - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/forwardable.rb:240
readmultiline - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/forwardable.rb:240
readmultiline - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/reline.rb:264
inner_readline - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/reline.rb:360
may_req_ambiguous_char_width - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/reline.rb:482
cursor_pos - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/reline/ansi.rb:277
raw [c function] - (unknown)
block in cursor_pos - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/reline/ansi.rb:261
loop [c function] - (unknown)
block (2 levels) in cursor_pos - /home/mcampbell/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/reline/ansi.rb:257
getc [c function] - (unknown)
@dgutov
Copy link
Owner

dgutov commented Mar 17, 2024

When you abort with C-g, can you switch to the inf-ruby buffer that has been created (normally the C-c C-z binding in a ruby file buffer will do that if you have enabled inf-ruby-minor-mode, or you can explicitly call M-x ruby-switch-to-last-ruby-buffer) and see if there is anything relevant in it?

When you type M-x robe-start, does it offer to launch the project REPL first? Your description sounded like that didn't happen. Perhaps you already had a live inf-ruby buffer in that Emacs session?

Does inf-ruby work fine for you in general? Can you interact with the buffer created by M-x inf-ruby-console-auto?

rbspy dump:

The backtrace mentions reline, so perhaps you have a Ruby compiled without libreadline. If you are using Pry and not just Irb as the REPL driver, that could be a problem. I thought that this was primarily an issue for Ruby 3.3, though.

@mcampbell
Copy link
Author

inf-ruby:

[DEPRECATED] bundle console will be replaced by `bin/console` generated by `bundle gem <name>`
▽

re: start repl, yes, it asked me - what I pasted was a second attempt at robe-start

I've never used inf-ruby before, so I'm not sure if it works in general for me.

I'd be happy to install a different version of ruby and try that if you have any suggestions. As you see, I use asdf for my package manager.

@mcampbell
Copy link
Author

I restarted emacs, and inf-ruby does seem to give me a repl in that same directory that robe hangs.

@dgutov
Copy link
Owner

dgutov commented Mar 17, 2024

[DEPRECATED] bundle console will be replaced by bin/console generated by bundle gem <name>

Yes, it looks like a problem with the project repl (the inverted triangle).

I'd be happy to install a different version of ruby and try that if you have any suggestions.

Recompiling your Ruby with readline support could help. I don't have instructions for asdf specificially, but the key might be to install libreadline-dev for your system first.

Also, is that a Rails project? What is the version of Rails? Any other gems or note? Do you use Pry or not?

@mcampbell
Copy link
Author

Ok, I think I got it working ok. What I needed to do:

asdf uninstall ruby 3.1.2  # didn't have readline, and this is the latest non-beta ruby release for cruby
sudo apt-get install libreadline-dev  # this was already installed, but in case this is useful for anyone else.
export RUBY_CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline"
asdf install ruby 3.1.2

# Create a new rails project for testing
gem install rails # since uninstalling ruby, the old rails was uninstalled with it
rails new robe-test
cd robe-test
# Edit Gemfile to add "pry" to the `:development, :test` group
bundle install

M-x robe-start then worked for me.

@dgutov
Copy link
Owner

dgutov commented Mar 17, 2024

Glad you got that working, I'll update the README to make the requirement more clear.

Hopefully we'll get pry/pry#2303 fixed soon-ish, and things will get simpler with Pry's next release.

this is the latest non-beta ruby release for cruby

FWIW, the latest release is 3.3.0, you might want to update your version manager. That version has an additional gotcha, though, so maybe not.

export RUBY_CONFIGURE_OPTS="--with-readline-dir=/usr/include/readline"

Probably dependent on the version manager or distro. That's never been required on my machine with rbenv.

Anyway, thanks for the report.

@dgutov dgutov closed this as completed in 1c46065 Mar 17, 2024
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

No branches or pull requests

2 participants