You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Colleagues of mine regularly SSH into our servers, start an IRB session to look something up, and forget to logout. When they store database query results in local variables, they obviously occupy memory and can't be garbage collected.
It has happened on more than one occasion that I need to manually free resources because half a dozen IRB sessions have multiple GB of memory allocated. I would like to avoid currently active sessions though (i.e. where a user is actively collecting information).
As far as I can tell, I have no information what an IRB process is currently doing. I can't rely on CPU usage, as swapping may induce some load (on Ubuntu 24.04, I have noticed an otherwise idle IRB process to use up to 1% of CPU in top).
It would be useful if IRB would update the process title (Process.setproctitle) to something meaningful, for example:
"irb - running ...", when a command is currently running (maybe show the first few characters of the command?)
"irb - idle since 13:55", when no command is running
Maybe this is achievable through a piece of code in .irbrc, but I haven't figured out how to do that.
Result of irb_info
irb(main):001> irb_info
Ruby version: 3.2.3
IRB version: irb 1.14.0 (2024-07-06)
InputMethod: RelineInputMethod with Reline 0.5.9
Completion: Autocomplete, RegexpCompletor
.irbrc paths: /home/[redacted]/.irbrc
RUBY_PLATFORM: x86_64-linux-gnu
LANG env: en_US.UTF-8
East Asian Ambiguous Width: 1
This is Ruby/IRB from Ubuntu 24.04 packages.
Terminal Emulator
Tilix on the workstation. This should not matter
Setting Files
Are you using ~/.irbrc and ~/.inputrc?
not really, ~/.irbrc includes only commented # IRB.conf[:USE_MULTILINE] = false
The text was updated successfully, but these errors were encountered:
I think there is a negative impact of overriding proc title.
If we do it, meaningfull proc name like ruby script_name.rbmy_awsome_rails_app_console will be overrided.
I think this should be done in .irbrc or in application code, not by default.
However, there are no pre/post evaluation hooks. Perhaps we can add more hooks.
I agree on your point regarding other uses of scripts leveraging the process title.
Come to think of it, there's also a potential security problem, when the code block argument is something like pw = "supersecret\n", even if evaluating that may only take a few CPU cycles before the process title is changed back to "idle".
However, having a callback to run things around a command evaluation would be very valuable for this use case.
Description
Colleagues of mine regularly SSH into our servers, start an IRB session to look something up, and forget to logout. When they store database query results in local variables, they obviously occupy memory and can't be garbage collected.
It has happened on more than one occasion that I need to manually free resources because half a dozen IRB sessions have multiple GB of memory allocated. I would like to avoid currently active sessions though (i.e. where a user is actively collecting information).
As far as I can tell, I have no information what an IRB process is currently doing. I can't rely on CPU usage, as swapping may induce some load (on Ubuntu 24.04, I have noticed an otherwise idle IRB process to use up to 1% of CPU in
top
).It would be useful if IRB would update the process title (
Process.setproctitle
) to something meaningful, for example:Maybe this is achievable through a piece of code in
.irbrc
, but I haven't figured out how to do that.Result of irb_info
This is Ruby/IRB from Ubuntu 24.04 packages.
Terminal Emulator
Tilix on the workstation. This should not matter
Setting Files
Are you using
~/.irbrc
and~/.inputrc
?~/.irbrc
includes only commented# IRB.conf[:USE_MULTILINE] = false
The text was updated successfully, but these errors were encountered: