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
Crash after Name or service not known
error
#26
Comments
I reproduce indeed using your test. |
You can easily work around that crash if you set the 'idle' listener in the load callback iff there is no error at that stage. |
Two successive calls of png() are responsible for the crash. |
Got it, |
So, it is better to set up |
In the following code that uses the var arr = [
"https://www.mezilla.org/en-US/",
"https://www.google.com"
];
async.eachSeries(arr, function(it, cb) {
var href = it;
var filePath = path.resolve(__dirname, './shots/outN.png');
console.error('---> LOAD', href);
w.load(href, {}, function(err) {
console.error('---> LOAD-COMPLETE');
if(err) {
console.error('---> LOAD-ERR', err);
cb();
} else {
console.error('---> SETTING-IDLE');
w.once('idle', function() {
w.png(filePath, function(err) {
console.error('---> PNG', href, err);
cb();
});
});
}
});
}, function(err) {
done(err);
}); Not sure what is the problem? A complete test might something like this: var WebKit = require('../');
var expect = require('expect.js');
var fs = require('fs');
var path = require('path');
var async = require('async');
describe.only("ordered png render calls", function suite() {
this.timeout(20000);
var w;
before(function(cb) {
var inst = new WebKit();
inst.init({}, function(err) {
if (err) return cb(err);
w = inst;
cb();
});
});
it("should not stall", function(done) {
var arr = [
"https://www.mezilla.org/en-US/",
"https://www.google.com/",
"https://www.debian.org/"
];
async.eachSeries(arr, function(it, cb) {
var href = it;
var filePath = path.resolve(__dirname, './shots/outN.png');
console.error('---> LOAD', href);
w.load(href, {}, function(err) {
console.error('---> LOAD-COMPLETE'); // <--- callback not called for the second time
if(err) {
console.error('---> LOAD-ERR', err);
cb();
} else {
console.error('---> SETTING-IDLE');
w.once('idle', function() {
w.png(filePath, function(err) {
console.error('---> PNG', href, err);
cb();
});
});
}
});
}, function(err) {
done(err);
});
});
}); And the same problem reproduced in case of 404: var arr = [
"http://www.google.com/asdsad"
"https://www.google.com/"
]; |
When running two requests one after the other, If the first request contains a bad URL, the second request crashes the app.
The first request reports an error (as expected):
The second request terminates the app (unexpected):
Sample code (might be a bit long):
The text was updated successfully, but these errors were encountered: