-
Notifications
You must be signed in to change notification settings - Fork 35
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
[#112] List what timed out #199
Conversation
7fcbacd
to
0ad8219
Compare
Looking forward to find the time to dig into this. Looks exciting! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, it's not working. I put a couple of console.warn
around the new code to make sure it matched on the error and to console.log out what the URLs were:
▶ ./bin/minimalcss.js -d --verbose -o /tmp/songsearch.css https://songsear.ch/song/Starchild/Wolfgun/537590 https://songsear.ch/ https://songsear.ch/q/searching
error.message=Navigation Timeout Exceeded: 30000ms exceeded
YES STARTS WITH
URLS: []
Error: Navigation Timeout Exceeded: 30000ms exceeded
at Promise.then (/Users/peterbe/dev/JAVASCRIPT/minimalcss/node_modules/puppeteer/lib/NavigatorWatcher.js:71:21)
at <anonymous>
Basically, it didn't manage to track any URLs.
src/run.js
Outdated
error.message += `\nFor one of the following urls: ${urls.join( | ||
', ' | ||
)}`; | ||
} else if (urls.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just be } else if (urls.length) {
src/run.js
Outdated
if (error.message.startsWith('Navigation Timeout Exceeded')) { | ||
const urls = tracker.urls(); | ||
if (urls.length > 1) { | ||
error.message += `\nFor one of the following urls: ${urls.join( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sentence is odd. It'd make sense if it started with ...for once of the
.
I'm thinking we can be more direct and blunt. E.g.:
if (url.length) {
error.message += `Tracked URLs that have NOT finished: ${urls.join(',')}`
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I thin the word should be URLs
(not urls
) since it's an acronym of Uniform Resource Locator.
@@ -0,0 +1,18 @@ | |||
const createTracker = page => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could do with a doc string. I don't know what the right JSDoc notation should be but we ought to explain its purpose in life.
"A function that sets up request events on a Puppeteer.Page instance so that we can keep track of which URLs have started being request and which have finished. Ultimately its purpose is it be able to, at any point (e.g. an unexpected navigation error), be able to say which URLs have not finished. Having this list of URLs can be helpful when debugging why you get unpredictable timeouts."
@@ -0,0 +1,18 @@ | |||
const createTracker = page => { | |||
const requests = new Set(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a set? How is a request hashed to be unique?
Also what happens if you have something like:
$(function() {
window.setInterval(function() {
fetch('/api/check-for-new-content').then(...)
}, 1000)
}
Or if there's a repeated <img src="same.png">
and the URL it resolves to doesn't have cache-control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind this. A set is fine. It keeps it simple. We can revisit this later.
tests/main.test.js
Outdated
} catch (e) { | ||
expect(e.message).toMatch('Navigation Timeout Exceeded: 2000ms exceeded'); | ||
expect(e.message).toMatch( | ||
'For one of the following urls: http://localhost:3000/timeout.css?1, http://localhost:3000/timeout.css?2' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That comma is a bit weird. Perhaps we should do it like this:
error.message += `For one of the following urls:\n${urls.join('\n')}`
I put a couple of more
Note that that for every URL started, there's a deleted one. |
I butchered
Nothing interesting again. What was expected to fail, failed. No richer in knowledge as to why it crashes. |
Basically, I think puppeteer is failing us here in that something times out that was never sent to the event system. Perhaps a service-worker or something like that. (e.g. the URLs I tested on uses service workers but beyond that there are no buggy banner ads, web workers, web sockets or anything fancy like that) Last but not least, I did mess with the timeout and when I set it to 500ms it totally works. The URLs that didn't make it in 500ms are listed nicely in the error message. E.g.
|
If we can not catch it with given script then we should reopen ticket in puppeteer repo |
Ha! That's what I was looking to do but got distracted. I'll try to do that. By the way, I can run those URLs that I used to reproduce it locally. It's different in that I can't use HTTPS locally. But it's the same functionality inside the pages. Also, the other obvious difference is that when I use |
You can use self-signed certificate for HTTPS and pass flag to puppeteer to allow untrusted certificates |
I wonder if there's a flag to tell puppeteer to tell Chrome to not bother with service-workers (because, we're not ever coming back with a hot cache). |
Can you rebase this up so it uses the latest puppeteer. I really think the upgrade to puppeteer 1.4.0 solves the mysterious problem with strange timeout exceeded errors. At least I hope so. |
b1ab902
to
8d58670
Compare
Yes. puppeteer/puppeteer#1396 (comment)
Done |
timeout tracker nits
Sorry. I must have forgot to run the tests after I changed the wording in the error message. Will fix that. |
There stereobooster#3 |
fix tests for 112-timeouts branch
I pushed this branch into this repo, you can open PR based on it, if you want to (and close this one) |
I approved, pending the Travis tests pass. |
There we go! Let's do it! |
No description provided.