Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

[BUG] Slows the the Rails server to a crawl after first use (30+ seconds page loads) #49

Closed
feliperaul opened this issue Sep 18, 2020 · 6 comments · Fixed by #52
Closed
Labels
bug Something isn't working released The issue is resolved with the newest release

Comments

@feliperaul
Copy link

feliperaul commented Sep 18, 2020

Describe the bug

First of all, this gem is awesome. However, I can only use it once, forcing me to restart the rails server afterwards.

The bug manifests itself like this: I use jard anywhere in my code, inspect what I wanted to expect, and then I type exit on it's console to finish execution. I then proceed to remove the jard line and go back to normal life.

However, Rails thens takes an unreasonable time to render the next page... what was a 500ms load in development becomes a Completed 200 OK in 27468ms (27 seconds) after using jard.

What is even weirder is that Chrome keeps spinning even after rails console stated that it had completed the request. It takes one extra minute to display the page in the browser.

To solve it, I need to restart my rails server.

Environment (please complete the following information):

  • OS: MacOs Catalina 10.15.6
  • iTerm2 (tested with and without Overmind)
  • Output when you run tput colors in your terminal: 256
  • Output when you run echo $TERM in your terminal: xterm-256color
  • Output when you run stty:
    speed 38400 baud;
    lflags: echoe echok echoke echoctl pendin
    iflags: iutf8
    oflags: -oxtabs
    cflags: cs8 -parenb
  • Do you use tmux/screen or similar tty multiplexer?: I use Overmind, but I tested with a vanilla rails s in a new tab and it happens just the same
@feliperaul feliperaul added the bug Something isn't working label Sep 18, 2020
@feliperaul
Copy link
Author

An update: while the Chrome tab keeps on spinning, I got this error message:

image

@feliperaul
Copy link
Author

Another update: I can confirm that with binding.pry everything is working as expected.

@0x2c7
Copy link
Owner

0x2c7 commented Sep 18, 2020

Hi @feliperaul, let me confirm:

  • The slowness happens when you inject jard, refresh the page on chrome, inspect, type exit, remove jard. Then, the next page is unacceptably slow right?
  • Or, you inject jard, inspect, then continue and the page load is slow?

The message is interesting. That event should only be raised then the terminal emulator is resized.. Does it popup when you are in Overmind, or in a vanilla terminal emulator?

@feliperaul
Copy link
Author

Hi @nguyenquangminh0711

First option: The slowness happens when I inject jard, refresh the page on chrome, inspect, type exit, remove jard. Then, the next page is unacceptably slow.

About the message, I'm not in front of the computer right now, but if I recall correctly, it was a vanilla Rails terminal.

What happens is, with iTerm2, I use CMD SHIFT ENTER all the time to resize the terminal windows to occupy fullscreen. I probably did that with jard even on the vanilla rails terminal, because when jard is activated only half the screen is too small for it.

Let me know if I can help debugging any further!

@0x2c7
Copy link
Owner

0x2c7 commented Sep 18, 2020

Thank you. I think that's enough for me to debug. At the first glance, I think there are some conflicts between rails autoreload so that tons of scripts are running forever. During that time, when you resize, a race condition happens and pop that error out. I never go into this scenario before. Gonna test it out and let you know if I found some clues 😉

@0x2c7
Copy link
Owner

0x2c7 commented Sep 19, 2020

Hi @feliperaul, I tested on my local, and I can confirm that it's truly a bug. The slowness is significant. I implemented a fix, and the situation is good (for me). Could you test it again by pointing jard to my branch?

gem 'ruby_jard', git: 'https://github.com/nguyenquangminh0711/ruby_jard', ref: 'bug/fix-slowness-after-exit'

@0x2c7 0x2c7 closed this as completed in #52 Sep 20, 2020
@0x2c7 0x2c7 reopened this Sep 20, 2020
@0x2c7 0x2c7 added wait for release released The issue is resolved with the newest release and removed wait for release labels Sep 20, 2020
@0x2c7 0x2c7 closed this as completed Sep 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working released The issue is resolved with the newest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants