rendertron icon indicating copy to clipboard operation
rendertron copied to clipboard

Rendertron closeBrowser: true issues when multiple request comes at same time

Open Sumon-TWeb opened this issue 4 years ago • 10 comments

Error: Navigation failed because browser has disconnected!

Error: Protocol error (Runtime.callFunctionOn): Session closed. Most likely the page has been closed.

I am try to implement rendertron in Angular site, so i have to make closeBrowser to true, else it returns response does not exist This two error comes, when subsequent request comes to the rendertron server. It seems like browser is closed at the middle of an request execution, so all the request to the server is not treated as a separate process? If i make request one by one then there is no issue. Please have a look on this. thank you

Sumon-TWeb avatar Dec 22 '20 10:12 Sumon-TWeb

Hi @Sumon-TWeb,

Can you provide some example URLs where you are seeing this behaviour?

dwsmart avatar Dec 22 '20 11:12 dwsmart

I have exactly same behaviour: Without "closeBrowser:true": response does not exist. With "closeBrowser:true": Error: Navigation failed because browser has disconnected! Reproducible even with https://render-tron.appspot.com/ https://drive.google.com/file/d/1PovresdwMX7ifyfVPUEDK0SK0V_fYKWA/view

p.s. Works without issues on [email protected]

otoming avatar Dec 22 '20 22:12 otoming

Untitled

As you can see, in the attached image two request comes almost same time, after serialization only one request served as 200, other got error. It is SPA angular application, so i have put closeBrowser to true. Thanks.

Sumon-TWeb avatar Dec 23 '20 05:12 Sumon-TWeb

Hey @Sumon-TWeb

Did you change something in the example? This seems to work ok on a local install from the current main branch for me, are you still getting errors your side? (looks like you have made some local changes, perhaps just for logging?, reading the screenshot

dwsmart avatar Jan 12 '21 14:01 dwsmart

Hi, I am getting the exact same issue. I get a 400 error (response does not exist) when closeBrowser = true; and a 500 (navigation failed because the browser has disconnected) when closeBrowser = false. Used v3 as suggested by otoming and it did work.

farablanco avatar Jan 14 '21 02:01 farablanco

I was just looking into this and it seems to be undocumented behaviour with service workers. This only happens when request interception is enabled. I assume that request interception causes a race condition to be more prevalent, where the first request arriving installs and runs the service worker and the second requests gets the response from said service worker, somehow making page.goto return a falsy response value.

I have created a pull request that, once landed, will be part of the 3.2.0 release.

AVGP avatar Jan 26 '21 18:01 AVGP

I had to rollback all my environments to version 3.0.0. I was facing the same errors reported by @Sumon-TWeb, which in my case generated a lot of 500 responses from Rendertron. After rollback I got my environment back to normal.

Please check below how it was looking like during version 3.1.0. In my case closeBrowser was false.

rendertron

ygorth avatar Feb 09 '21 03:02 ygorth

I had to rollback all my environments to version 3.0.0. I was facing the same errors reported by @Sumon-TWeb, which in my case generated a lot of 500 responses from Rendertron. After rollback I got my environment back to normal.

Please check below how it was looking like during version 3.1.0. In my case closeBrowser was false.

rendertron

I've rolled back to 3.0.0 using 'git reset --hard 8951beb' but when I run npm install the output is very different and does not end in success:

image

npm run start:

image

Any idea what I've done wrong / what the problem is?

mikeooi avatar Jun 13 '21 16:06 mikeooi

I had to rollback all my environments to version 3.0.0. I was facing the same errors reported by @Sumon-TWeb, which in my case generated a lot of 500 responses from Rendertron. After rollback I got my environment back to normal. Please check below how it was looking like during version 3.1.0. In my case closeBrowser was false. rendertron

I've rolled back to 3.0.0 using 'git reset --hard 8951beb' but when I run npm install the output is very different and does not end in success:

image

npm run start:

image

Any idea what I've done wrong / what the problem is?

Fixed - Needed to downgrade node to 10

mikeooi avatar Jun 13 '21 17:06 mikeooi

I think this MR resolve problem: https://github.com/GoogleChrome/rendertron/pull/596

ByJacob avatar Jun 14 '21 08:06 ByJacob