browsh-org / browsh

A fully-modern text-based browser, rendering to TTY and browsers
https://www.brow.sh
GNU Lesser General Public License v2.1
16.93k stars 411 forks source link

Mouse interaction causes runtime error #63

Closed MrSrsen closed 6 years ago

MrSrsen commented 6 years ago

Hello there. I was trying your application trough public SSH demo server and when i connected i get this error.

martin@martin-mbp:~$ ssh brow.sh
Welcome to brow.sh (1.2.0)
Starting your public session, which will only last 5 minutes and be logged.
Startup URL: https://www.brow.sh/ssh-welcome
Please wait...
Logging to: /app/debug.log

      ***********************                                                                 

Starting Browsh, the modern text-based web browser.                                           
Waiting for Firefox to connect...                                                             

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6de976]

goroutine 24 [running]:
browsh/interfacer/src/browsh.handleMouseEvent(0xc42022bf20)
    /home/travis/gopath/src/browsh/interfacer/src/browsh/tty.go:151 +0x36
browsh/interfacer/src/browsh.readStdin()
    /home/travis/gopath/src/browsh/interfacer/src/browsh/tty.go:46 +0xd3
created by browsh/interfacer/src/browsh.TTYStart
    /home/travis/gopath/src/browsh/interfacer/src/browsh/browsh.go:185 +0xf2
Connection to brow.sh closed.
martin@martin-mbp:~$ 35;1;13M0;1;13M32;2;13M32;3;14M32;4;14M32;5;14M32;6;14M32;7;14M0;7;14m

Application crashed and it's keeping getting errors as i was moving cursor over terminal window.

tombh commented 6 years ago

Oh, how interesting. I wonder if OSX terminal sends unusual mouse escape sequences? Did you try more than once? And also try without ever putting the mouse inside the terminal pane.

MrSrsen commented 6 years ago

Yes and I also tried terminal on XQuarts. Sometimes it crush also without cursor moving so it may be something unrelated. And I also suppose it should not look like this screenshot

And i also tried it on Android Termux and it worked just fine :) ... Keep doing great work.

tombh commented 6 years ago

Thanks :)

I've never heard of XQuarts, how recent is it? That screenshot it is definitely caused by lack of true colour support. This page lists all the currently known true colour terminals: https://gist.github.com/XVilka/8346728

MrSrsen commented 6 years ago

XQuartz is to my understanding legacy library for xserver support in MacOS. And screenshot is from regular Terminal.app. I'm using MacOS 10.13.4, Terminal 2.8.2. I also have checked option "xterm-256color" in my Terminal color settings (default option).

If it helps this is my result after running some test cases from your link: colors

tombh commented 6 years ago

It looks pretty likely that Terminal.app doesn't actually support true color :( It's not mentioned as a working terminal here: https://gist.github.com/XVilka/8346728 and this comment from 4 years ago, seems to confirm it: https://gist.github.com/XVilka/8346728#gistcomment-1363096

Apparently your best choice is iTerm2.#

Mackaber commented 6 years ago

I'm using iTerm2 with similar results... I don't think its related to the terminal, because doing ssh brow.sh works just fine...

screen shot 2018-07-09 at 1 24 05 pm
puppycodes commented 6 years ago

+1 getting this error

albill commented 6 years ago

I'm seeing the same problem on current OS X trying to run it through the Docker image with

docker run -it browsh/browsh

tombh commented 6 years ago

So the referenced line tty.go:151 deals with mouse coords. So I wonder what happens if those with this error can reliably reproduce the error by starting browsh with the mouse outside the terminal window, then just moving the mouse inside to trigger the error.

Either way running browsh with the -debug argument and sending me any relevant parts of ./debug.log might reveal something.

puppycodes commented 6 years ago

I'm also using Iterm2, I think the issue might be outside of the native osx terminal

Starting Browsh, the modern text-based web browser.
Waiting for Firefox to connect...panic: runtime error: invalid memory address or nil pointer dereference
                                        [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10a73fe]

                                               goroutine 19 [running]:
      os.(*Process).signal(0x0, 0x13d6a60, 0x152c2b0, 0x0, 0x0)
home/travis/.gimme/versions/go1.10.3.linux.amd64/src/os/exec_unix.go:56 +0x2e
             os.(*Process).Signal(0x0, 0x13d6a60, 0x152c2b0, 0xc420227e90, 0x18)
                        /home/travis/.gimme/versions/go1.10.3.linux.amd64/src/os/exec.go:129 +0x3f
                                  os.(*Process).kill(0x0, 0xc420076928, 0xc420227e90)
                        /home/travis/.gimme/versions/go1.10.3.linux.amd64/src/os/exec_posix.go:54 +0x43
                                       os.(*Process).Kill(0x0, 0x4, 0x4)
            /home/travis/.gimme/versions/go1.10.3.linux.amd64/src/os/exec.go:114 +0x2b
                          browsh/interfacer/src/browsh.startHeadlessFirefox()
                /home/travis/gopath/src/browsh/interfacer/src/browsh/firefox.go:84 +0x365
tombh commented 6 years ago

Thanks. Could you try running browsh with the -debug argument and sending me any relevant parts of ./debug.log.

puppycodes commented 6 years ago

debug.log

Attempting to connect to Firefox Marionette
Starting Firefox in headless mode
Using default profile at: /Users/******/Library/Application Support/browsh/firefox_profile
osmand commented 6 years ago

debug.log

Attempting to connect to Firefox Marionette Starting Firefox in headless mode Using default profile at: /home/x/.config/browsh/firefox_profile FF-CONSOLE: 1531211027775 Marionette INFO Listening on port 2828 FF-MRNT: 50:{"applicationType":"gecko","marionetteProtocol":3} Sending newSession to Firefox Marionette FF-MRNT: 522:[1,0,null,{"sessionId":"4a4310a1-c434-4c0b-8fb7-bd81b5a0eda0","capabilities":{"browserName":"firefox","browserVersion":"61.0","platformName":"linux","platformVersion":"4.13.0-45-generic","pageLoadStrategy":"normal","acceptInsecureCerts":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"rotatable":false,"moz:accessibilityChecks":false,"moz:headless":true,"moz:processID":11893,"moz:profile":"/home/x/.config/browsh/firefox_profile","moz:useNonSpecCompliantPointerOrigin":false,"moz:webdriverClick":true}}]

Running on local Here it stopped, no response, only the text on the terminal waiting for firefox.

when I move the mouse the following showed up I think

I ran with -debug

Sending setContext to Firefox Marionette FF-MRNT: 13:[1,1,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 25:[1,2,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 13:[1,3,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 13:[1,4,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 25:[1,5,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 13:[1,6,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 13:[1,7,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 25:[1,8,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 13:[1,9,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,10,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,11,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,12,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,13,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,14,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,15,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,16,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,17,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,18,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,19,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,20,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,21,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,22,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,23,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,24,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,25,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,26,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,27,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,28,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,29,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,30,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,31,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,32,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,33,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,34,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,35,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,36,null,{}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,37,null,{}] Sending executeScript to Firefox Marionette FF-MRNT: 26:[1,38,null,{"value":null}] Sending setContext to Firefox Marionette FF-MRNT: 14:[1,39,null,{}] Sending addon:install to Firefox Marionette FF-MRNT: 62:[1,40,null,{"value":"{8ff2d753-2dc8-46de-a837-fa28331d9fcf}"}] Starting Browsh CLI client Webextension not connected. Message not sent: /tty_size,80,24 Incoming web request from browser TTY sending: /tty_size,80,24 TTY sending: /new_tab,https://google.com WEBEXT: Webextension connected to the terminal's websocket server WEBEXT: Starting to listen to TTY WEBEXT: BACKGROUND: Frame loop starting WEBEXT: Message from terminal: /tty_size,80,24 WEBEXT: Requesting browser resize for new TTY dimensions: 80x24 WEBEXT: Not resizing browser window without all of the TTY and character dimensions WEBEXT: Message from terminal: /new_tab,https://google.com WEBEXT: Tab undefined received new focus WEBEXT: New tab created: [object Object] WEBEXT: Not resizing browser window without all of the TTY and character dimensions WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame WEBEXT: Active tab 1 does not have a channel, so not requesting a frame

osmarks commented 6 years ago

I've experienced this with the SSH demo thing using Terminator on Arch Linux.

tombh commented 6 years ago

Right, I've reproduced this exact error with Terminator. Now I can try out some various fixes. Watch this space!

fmauNeko commented 6 years ago

I had the same issue on my Archlinux, and I found out it happens only when I start browsh and then focus another window (easy to do as I use i3). When I keep the mouse over the terminal I opened browsh in until it starts, it works fine. I'm using Tilix under i3-gaps.

MrSrsen commented 6 years ago

Works for me. If you don't mind i close this issue. Thanks for fix. :)

Xses-1 commented 1 year ago

Doesn't work for me on Konsole